diff options
| author | Gautham Goli | 2017-08-14 01:52:48 +0530 |
|---|---|---|
| committer | Gautham Goli | 2017-08-14 01:52:48 +0530 |
| commit | f968776e8460d7b6a0a3199d9c92c945cda0738d (patch) | |
| tree | 38ca0836fefe2d87f23b4cb379dca1d141d28f97 /Library/Homebrew/test | |
| parent | 6dad9d8b44e22f2729a2db95a1c2d14b3e84d477 (diff) | |
| download | brew-f968776e8460d7b6a0a3199d9c92c945cda0738d.tar.bz2 | |
Add tests for unless 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 00543f545..352dc8219 100644 --- a/Library/Homebrew/test/rubocops/lines_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/lines_cop_spec.rb @@ -619,6 +619,30 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do expect_offense(expected, actual) end end + + it "with unless build.without?" do + source = <<-EOS.undent + class Foo < Formula + desc "foo" + url 'http://example.com/foo-1.0.tgz' + def post_install + return unless build.without? "bar" + end + end + EOS + + expected_offenses = [{ message: 'Use if build.with? "bar" instead of unless build.without? "bar"', + severity: :convention, + line: 5, + column: 18, + 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]) |
