aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorGautham Goli2017-08-14 02:47:29 +0530
committerGautham Goli2017-08-14 02:47:29 +0530
commit3ff8be1216388817dda2b4bb95aeaa5c3d3d5a6b (patch)
treec65538be7f4472a4a0cf5f75eff65dcf98bf6346 /Library/Homebrew/test
parent5a7cbb762f1a9e715ae03e82eb6cb8ef4ac4a0bb (diff)
downloadbrew-3ff8be1216388817dda2b4bb95aeaa5c3d3d5a6b.tar.bz2
add test for build.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 273014cf1..36c6272b3 100644
--- a/Library/Homebrew/test/rubocops/lines_cop_spec.rb
+++ b/Library/Homebrew/test/rubocops/lines_cop_spec.rb
@@ -763,6 +763,30 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
expect_offense(expected, actual)
end
end
+
+ it "with build.include?" do
+ source = <<-EOS.undent
+ class Foo < Formula
+ desc "foo"
+ url 'http://example.com/foo-1.0.tgz'
+ def post_install
+ return if build.include? "without-bar"
+ end
+ end
+ EOS
+
+ expected_offenses = [{ message: "Use build.without? \"bar\" instead of build.include? 'without-bar'",
+ severity: :convention,
+ line: 5,
+ column: 30,
+ 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])