diff options
| author | Gautham Goli | 2017-08-14 02:14:20 +0530 |
|---|---|---|
| committer | Gautham Goli | 2017-08-14 02:14:20 +0530 |
| commit | e14fedd1b35480ea3707689db044140d18662b9c (patch) | |
| tree | 7f50c9888792b9d2cbd00e137d489004e47e08d1 /Library/Homebrew/test | |
| parent | ec2b0df10e62152529386cf2a696f9aaece405ea (diff) | |
| download | brew-e14fedd1b35480ea3707689db044140d18662b9c.tar.bz2 | |
Add test for negated build.with?
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/rubocops/lines_cop_spec.rb | 24 |
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 dda1b96e6..8e3f42adf 100644 --- a/Library/Homebrew/test/rubocops/lines_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/lines_cop_spec.rb @@ -667,6 +667,30 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do expect_offense(expected, actual) end end + + it "with negated build.with?" do + source = <<-EOS.undent + class Foo < Formula + desc "foo" + url 'http://example.com/foo-1.0.tgz' + def post_install + return if !build.with? "bar" + end + end + EOS + + expected_offenses = [{ message: "Don't negate 'build.with?': use 'build.without?'", + 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]) |
