diff options
| author | Markus Reiter | 2017-02-25 03:18:42 +0100 |
|---|---|---|
| committer | GitHub | 2017-02-25 03:18:42 +0100 |
| commit | d8e4255f2d2177edd1530fac7fda731016a541ba (patch) | |
| tree | 4624587eda95e8707f8dcffc2ff92e0cd20c51c7 | |
| parent | 7077717af9cc9b40c8bb61cf3cb15e3b5fe5d209 (diff) | |
| parent | dc417042d50fca1305317375a58f4942cde73f6e (diff) | |
| download | brew-d8e4255f2d2177edd1530fac7fda731016a541ba.tar.bz2 | |
Merge pull request #2147 from reitermarkus/spec-custom-external-command
Convert `brew custom-external-command` test to spec.
| -rw-r--r-- | Library/Homebrew/test/cmd/custom-external-command_spec.rb | 21 | ||||
| -rw-r--r-- | Library/Homebrew/test/custom_command_test.rb | 18 |
2 files changed, 21 insertions, 18 deletions
diff --git a/Library/Homebrew/test/cmd/custom-external-command_spec.rb b/Library/Homebrew/test/cmd/custom-external-command_spec.rb new file mode 100644 index 000000000..8ccc21fa7 --- /dev/null +++ b/Library/Homebrew/test/cmd/custom-external-command_spec.rb @@ -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 diff --git a/Library/Homebrew/test/custom_command_test.rb b/Library/Homebrew/test/custom_command_test.rb deleted file mode 100644 index 8d05bc6c7..000000000 --- a/Library/Homebrew/test/custom_command_test.rb +++ /dev/null @@ -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 |
