diff options
| author | Gautham Goli | 2017-08-14 02:18:46 +0530 |
|---|---|---|
| committer | Gautham Goli | 2017-08-14 02:18:46 +0530 |
| commit | 3efba57cd936f1e53b72a9e66561d594fcf37d65 (patch) | |
| tree | 4aaecdf7dd83e96947c91099e7849f0018618828 /Library/Homebrew/test | |
| parent | e14fedd1b35480ea3707689db044140d18662b9c (diff) | |
| download | brew-3efba57cd936f1e53b72a9e66561d594fcf37d65.tar.bz2 | |
Add negated? method to formula cop and add tests for negated build.without?
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 8e3f42adf..e00834963 100644 --- a/Library/Homebrew/test/rubocops/lines_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/lines_cop_spec.rb @@ -691,6 +691,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.without? "bar" + end + end + EOS + + expected_offenses = [{ message: "Don't negate 'build.without?': use 'build.with?'", + 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]) |
