aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/rubocops
diff options
context:
space:
mode:
authorGautham Goli2017-08-15 00:42:56 +0530
committerGautham Goli2017-08-15 00:42:56 +0530
commitefabd4b5c2beadecf3282dbe730b1b6f779571e0 (patch)
treea4382522dfe5c1055b68fd536f337020785911b0 /Library/Homebrew/test/rubocops
parent2f94d5f499bca6bbab238bb6536f05195b358159 (diff)
downloadbrew-efabd4b5c2beadecf3282dbe730b1b6f779571e0.tar.bz2
Add tests for MACOS version consts usage
Diffstat (limited to 'Library/Homebrew/test/rubocops')
-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 44f22df62..b069148f9 100644
--- a/Library/Homebrew/test/rubocops/lines_cop_spec.rb
+++ b/Library/Homebrew/test/rubocops/lines_cop_spec.rb
@@ -1189,6 +1189,30 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
end
end
+ it "with MACOS_VERSION const" do
+ source = <<-EOS.undent
+ class Foo < Formula
+ desc "foo"
+ url 'http://example.com/foo-1.0.tgz'
+ test do
+ version = MACOS_VERSION
+ end
+ end
+ EOS
+
+ expected_offenses = [{ message: "Use MacOS.version instead of MACOS_VERSION",
+ severity: :convention,
+ line: 5,
+ column: 14,
+ 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])