aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorGautham Goli2017-08-15 00:36:37 +0530
committerGautham Goli2017-08-15 00:36:37 +0530
commit2f94d5f499bca6bbab238bb6536f05195b358159 (patch)
tree1d13315409edb02a7327096410bb3f04e0aad6f4 /Library/Homebrew/test
parent3fc6cc1a3a4b8f1b7ca42dc0a7dd7cf8fad91b18 (diff)
downloadbrew-2f94d5f499bca6bbab238bb6536f05195b358159.tar.bz2
add test for ARGV.include?
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/rubocops/lines_cop_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/Library/Homebrew/test/rubocops/lines_cop_spec.rb b/Library/Homebrew/test/rubocops/lines_cop_spec.rb
index 1b23cca83..44f22df62 100644
--- a/Library/Homebrew/test/rubocops/lines_cop_spec.rb
+++ b/Library/Homebrew/test/rubocops/lines_cop_spec.rb
@@ -1165,6 +1165,30 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
end
end
+ it "with ARGV.include? (--HEAD)" do
+ source = <<-EOS.undent
+ class Foo < Formula
+ desc "foo"
+ url 'http://example.com/foo-1.0.tgz'
+ test do
+ head = ARGV.include? "--HEAD"
+ end
+ end
+ EOS
+
+ expected_offenses = [{ message: "Use \"if build.head?\" instead",
+ severity: :convention,
+ line: 5,
+ column: 26,
+ source: source }]
+
+ inspect_source(cop, source)
+
+ expected_offenses.zip(cop.offenses).each do |expected, actual|
+ expect_offense(expected, actual)
+ end
+ end
+
end
def expect_offense(expected, actual)
expect(actual.message).to eq(expected[:message])