diff options
| author | Gautham Goli | 2017-08-14 02:32:29 +0530 |
|---|---|---|
| committer | Gautham Goli | 2017-08-14 02:32:29 +0530 |
| commit | 02a1406a2e4c2d0506861248eb767d99f5ce4515 (patch) | |
| tree | e7903984ef592cddca54ea33722181bfaef0cf3d /Library/Homebrew/test | |
| parent | 3efba57cd936f1e53b72a9e66561d594fcf37d65 (diff) | |
| download | brew-02a1406a2e4c2d0506861248eb767d99f5ce4515.tar.bz2 | |
add test for build.without --without-foo
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 e00834963..0c225a5b6 100644 --- a/Library/Homebrew/test/rubocops/lines_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/lines_cop_spec.rb @@ -715,6 +715,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? "--without-bar" + end + end + EOS + + expected_offenses = [{ message: "Don't duplicate 'without': Use `build.without? \"bar\"` to check for \"--without-bar\"", + severity: :convention, + line: 5, + column: 30, + 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]) |
