Convert brew custom-external-command test to spec.
This commit is contained in:
parent
c7121f6be5
commit
dc417042d5
21
Library/Homebrew/test/cmd/custom-external-command_spec.rb
Normal file
21
Library/Homebrew/test/cmd/custom-external-command_spec.rb
Normal file
@ -0,0 +1,21 @@
|
||||
describe "brew custom-external-command", :integration_test do
|
||||
it "is supported" do
|
||||
Dir.mktmpdir do |path|
|
||||
path = Pathname.new(path)
|
||||
|
||||
cmd = "custom-external-command-#{rand}"
|
||||
file = path/"brew-#{cmd}"
|
||||
|
||||
file.write <<-EOS.undent
|
||||
#!/bin/sh
|
||||
echo 'I am #{cmd}.'
|
||||
EOS
|
||||
FileUtils.chmod "+x", file
|
||||
|
||||
expect { brew cmd, "PATH" => "#{path}#{File::PATH_SEPARATOR}#{ENV["PATH"]}" }
|
||||
.to output("I am #{cmd}.\n").to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
.and be_a_success
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1,18 +0,0 @@
|
||||
require "testing_env"
|
||||
|
||||
class IntegrationCommandTestCustomCommand < IntegrationCommandTestCase
|
||||
def test_custom_command
|
||||
mktmpdir do |path|
|
||||
cmd = "int-test-#{rand}"
|
||||
file = "#{path}/brew-#{cmd}"
|
||||
|
||||
File.open(file, "w") do |f|
|
||||
f.write "#!/bin/sh\necho 'I am #{cmd}'\n"
|
||||
end
|
||||
FileUtils.chmod 0777, file
|
||||
|
||||
assert_match "I am #{cmd}",
|
||||
cmd(cmd, "PATH" => "#{path}#{File::PATH_SEPARATOR}#{ENV["PATH"]}")
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user