make assertions conditional on ARGV.verbose?

This commit is contained in:
Bruce Steedman 2016-10-01 09:26:25 +01:00
parent d843f70a35
commit df7246fdea

View File

@ -22,16 +22,22 @@ class AbstractDownloadStrategyTests < Homebrew::TestCase
def test_expand_safe_system_args_with_explicit_quiet_flag def test_expand_safe_system_args_with_explicit_quiet_flag
@args << { quiet_flag: "--flag" } @args << { quiet_flag: "--flag" }
ARGV.stubs(verbose?: false)
expanded_args = @strategy.expand_safe_system_args(@args) expanded_args = @strategy.expand_safe_system_args(@args)
if ARGV.verbose?
assert_equal %w[foo bar baz], expanded_args
else
assert_equal %w[foo bar baz --flag], expanded_args assert_equal %w[foo bar baz --flag], expanded_args
end end
end
def test_expand_safe_system_args_with_implicit_quiet_flag def test_expand_safe_system_args_with_implicit_quiet_flag
ARGV.stubs(verbose?: false)
expanded_args = @strategy.expand_safe_system_args(@args) expanded_args = @strategy.expand_safe_system_args(@args)
if ARGV.verbose?
assert_equal %w[foo bar baz], expanded_args
else
assert_equal %w[foo bar -q baz], expanded_args assert_equal %w[foo bar -q baz], expanded_args
end end
end
def test_expand_safe_system_args_does_not_mutate_argument def test_expand_safe_system_args_does_not_mutate_argument
result = @strategy.expand_safe_system_args(@args) result = @strategy.expand_safe_system_args(@args)