diff options
| author | Baptiste Fontaine | 2016-01-05 15:45:45 +0100 |
|---|---|---|
| committer | Baptiste Fontaine | 2016-01-06 12:22:58 +0100 |
| commit | c8401b8243ee5fba55cc9ca507dd57347c3480aa (patch) | |
| tree | 68a2f327193d1025b8cf7b34b74c61c19845861f | |
| parent | d6c6f003935dc3d41e794cdcd17642604b295544 (diff) | |
| download | brew-c8401b8243ee5fba55cc9ca507dd57347c3480aa.tar.bz2 | |
a few more integration tests
Closes Homebrew/homebrew#47714.
Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
| -rw-r--r-- | Library/Homebrew/test/lib/integration_mocks.rb | 9 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_integration_cmds.rb | 33 |
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 |
