aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/test/lib/integration_mocks.rb9
-rw-r--r--Library/Homebrew/test/test_integration_cmds.rb33
2 files changed, 26 insertions, 16 deletions
diff --git a/Library/Homebrew/test/lib/integration_mocks.rb b/Library/Homebrew/test/lib/integration_mocks.rb
new file mode 100644
index 000000000..322163a8e
--- /dev/null
+++ b/Library/Homebrew/test/lib/integration_mocks.rb
@@ -0,0 +1,9 @@
+module Homebrew
+ module Diagnostic
+ class Checks
+ def check_integration_test
+ "This is an integration test" if ENV["HOMEBREW_INTEGRATION_TEST"]
+ end
+ end
+ end
+end
diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb
index 64ce9f76a..da34f4927 100644
--- a/Library/Homebrew/test/test_integration_cmds.rb
+++ b/Library/Homebrew/test/test_integration_cmds.rb
@@ -11,6 +11,7 @@ class IntegrationCommandTests < Homebrew::TestCase
-W0
-I#{HOMEBREW_LIBRARY_PATH}/test/lib
-rconfig
+ -rintegration_mocks
]
cmd_args << "-rsimplecov" if ENV["HOMEBREW_TESTS_COVERAGE"]
cmd_args << (HOMEBREW_LIBRARY_PATH/"../brew.rb").resolved_path.to_s
@@ -100,6 +101,11 @@ class IntegrationCommandTests < Homebrew::TestCase
cmd("--repository")
end
+ def test_help
+ assert_match "Example usage:",
+ cmd("help")
+ end
+
def test_install
assert_match "#{HOMEBREW_CELLAR}/testball/0.1", cmd("install", testball)
ensure
@@ -214,26 +220,21 @@ class IntegrationCommandTests < Homebrew::TestCase
bar_file.unlink unless bar_file.nil?
end
- def test_doctor_check_path_for_trailing_slashes
- assert_match "Some directories in your path end in a slash",
- cmd_fail("doctor", "check_path_for_trailing_slashes",
- {"PATH" => ENV["PATH"] + File::PATH_SEPARATOR + "/foo/bar/"})
+ def test_doctor
+ assert_match "This is an integration test",
+ cmd_fail("doctor", "check_integration_test")
end
- def test_doctor_check_for_anaconda
+ def test_custom_command
mktmpdir do |path|
- anaconda = "#{path}/anaconda"
- python = "#{path}/python"
- FileUtils.touch anaconda
- File.open(python, "w") do |file|
- file.write("#! #{`which bash`}\necho -n '#{python}'\n")
- end
- FileUtils.chmod 0777, anaconda
- FileUtils.chmod 0777, python
+ cmd = "int-test-#{rand}"
+ file = "#{path}/brew-#{cmd}"
+
+ File.open(file, "w") { |f| f.write "#!/bin/sh\necho 'I am #{cmd}'\n" }
+ FileUtils.chmod 0777, file
- assert_match "Anaconda",
- cmd_fail("doctor", "check_for_anaconda",
- {"PATH" => path + File::PATH_SEPARATOR + ENV["PATH"]})
+ assert_match "I am #{cmd}",
+ cmd(cmd, {"PATH" => "#{path}#{File::PATH_SEPARATOR}#{ENV["PATH"]}"})
end
end
end