aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorGautham Goli2017-08-14 00:02:44 +0530
committerGautham Goli2017-08-14 00:02:44 +0530
commita73c29fef21ccb7f45243500f04f1ed9965fdf38 (patch)
treebf9e910a427cb874cb8a242ed98798030a106780 /Library/Homebrew/test
parent77105b809a83583e3da5726105dc9cd913112913 (diff)
downloadbrew-a73c29fef21ccb7f45243500f04f1ed9965fdf38.tar.bz2
add tests for non glob dirs audit
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/rubocops/lines_cop_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/Library/Homebrew/test/rubocops/lines_cop_spec.rb b/Library/Homebrew/test/rubocops/lines_cop_spec.rb
index 69caee80c..203f8a7d9 100644
--- a/Library/Homebrew/test/rubocops/lines_cop_spec.rb
+++ b/Library/Homebrew/test/rubocops/lines_cop_spec.rb
@@ -552,6 +552,29 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
expect_offense(expected, actual)
end
end
+
+ it "with non glob DIR" do
+ source = <<-EOS.undent
+ class Foo < Formula
+ desc "foo"
+ url 'http://example.com/foo-1.0.tgz'
+ rm_rf Dir["src/{llvm,test,librustdoc,etc/snapshot.pyc}"]
+ rm_rf Dir["src/snapshot.pyc"]
+ end
+ EOS
+
+ expected_offenses = [{ message: "Dir([\"src/snapshot.pyc\"]) is unnecessary; just use \"src/snapshot.pyc\"",
+ severity: :convention,
+ line: 5,
+ column: 13,
+ 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])