aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorGautham Goli2017-08-14 21:34:01 +0530
committerGautham Goli2017-08-14 21:45:01 +0530
commit9c9c280c8aeb97a6ec8956242727208d80247826 (patch)
treed491280f749e0924db7355d82854941c3a56359a /Library/Homebrew/test
parent65ae6bacd8c92d718b259f7efd50fc3fe9f0838b (diff)
downloadbrew-9c9c280c8aeb97a6ec8956242727208d80247826.tar.bz2
add tests for formula path string 1
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 afe65e9ac..63ae88dd9 100644
--- a/Library/Homebrew/test/rubocops/lines_cop_spec.rb
+++ b/Library/Homebrew/test/rubocops/lines_cop_spec.rb
@@ -955,6 +955,30 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
expect_offense(expected, actual)
end
end
+
+ it "with formula path shortcut long form" do
+ source = <<-EOS.undent
+ class Foo < Formula
+ desc "foo"
+ url 'http://example.com/foo-1.0.tgz'
+ def install
+ mv "\#{share}/man", share
+ end
+ end
+ EOS
+
+ expected_offenses = [{ message: "\"\#\{share}/man\" should be \"\#{man}\"",
+ severity: :convention,
+ line: 5,
+ column: 17,
+ 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])