a few more integration tests
Closes Homebrew/homebrew#47714. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
This commit is contained in:
parent
d6c6f00393
commit
c8401b8243
9
Library/Homebrew/test/lib/integration_mocks.rb
Normal file
9
Library/Homebrew/test/lib/integration_mocks.rb
Normal file
@ -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
|
||||||
@ -11,6 +11,7 @@ class IntegrationCommandTests < Homebrew::TestCase
|
|||||||
-W0
|
-W0
|
||||||
-I#{HOMEBREW_LIBRARY_PATH}/test/lib
|
-I#{HOMEBREW_LIBRARY_PATH}/test/lib
|
||||||
-rconfig
|
-rconfig
|
||||||
|
-rintegration_mocks
|
||||||
]
|
]
|
||||||
cmd_args << "-rsimplecov" if ENV["HOMEBREW_TESTS_COVERAGE"]
|
cmd_args << "-rsimplecov" if ENV["HOMEBREW_TESTS_COVERAGE"]
|
||||||
cmd_args << (HOMEBREW_LIBRARY_PATH/"../brew.rb").resolved_path.to_s
|
cmd_args << (HOMEBREW_LIBRARY_PATH/"../brew.rb").resolved_path.to_s
|
||||||
@ -100,6 +101,11 @@ class IntegrationCommandTests < Homebrew::TestCase
|
|||||||
cmd("--repository")
|
cmd("--repository")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_help
|
||||||
|
assert_match "Example usage:",
|
||||||
|
cmd("help")
|
||||||
|
end
|
||||||
|
|
||||||
def test_install
|
def test_install
|
||||||
assert_match "#{HOMEBREW_CELLAR}/testball/0.1", cmd("install", testball)
|
assert_match "#{HOMEBREW_CELLAR}/testball/0.1", cmd("install", testball)
|
||||||
ensure
|
ensure
|
||||||
@ -214,26 +220,21 @@ class IntegrationCommandTests < Homebrew::TestCase
|
|||||||
bar_file.unlink unless bar_file.nil?
|
bar_file.unlink unless bar_file.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_doctor_check_path_for_trailing_slashes
|
def test_doctor
|
||||||
assert_match "Some directories in your path end in a slash",
|
assert_match "This is an integration test",
|
||||||
cmd_fail("doctor", "check_path_for_trailing_slashes",
|
cmd_fail("doctor", "check_integration_test")
|
||||||
{"PATH" => ENV["PATH"] + File::PATH_SEPARATOR + "/foo/bar/"})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_doctor_check_for_anaconda
|
def test_custom_command
|
||||||
mktmpdir do |path|
|
mktmpdir do |path|
|
||||||
anaconda = "#{path}/anaconda"
|
cmd = "int-test-#{rand}"
|
||||||
python = "#{path}/python"
|
file = "#{path}/brew-#{cmd}"
|
||||||
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
|
|
||||||
|
|
||||||
assert_match "Anaconda",
|
File.open(file, "w") { |f| f.write "#!/bin/sh\necho 'I am #{cmd}'\n" }
|
||||||
cmd_fail("doctor", "check_for_anaconda",
|
FileUtils.chmod 0777, file
|
||||||
{"PATH" => path + File::PATH_SEPARATOR + ENV["PATH"]})
|
|
||||||
|
assert_match "I am #{cmd}",
|
||||||
|
cmd(cmd, {"PATH" => "#{path}#{File::PATH_SEPARATOR}#{ENV["PATH"]}"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user