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
|
||||
-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}"
|
||||
|
||||
assert_match "Anaconda",
|
||||
cmd_fail("doctor", "check_for_anaconda",
|
||||
{"PATH" => path + File::PATH_SEPARATOR + ENV["PATH"]})
|
||||
File.open(file, "w") { |f| f.write "#!/bin/sh\necho 'I am #{cmd}'\n" }
|
||||
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