diff options
| author | Gautham Goli | 2017-08-14 15:22:44 +0530 |
|---|---|---|
| committer | Gautham Goli | 2017-08-14 15:22:44 +0530 |
| commit | 76f4eccdceb5b3fb4e88b56e077234a6a3e56b08 (patch) | |
| tree | 0ee69fa055f76003099739d448028d4048deee69 /Library/Homebrew/test/rubocops | |
| parent | dc4d10ff6a59ce0da1bfc7bc06dd819c442813ab (diff) | |
| download | brew-76f4eccdceb5b3fb4e88b56e077234a6a3e56b08.tar.bz2 | |
add test for using ARGV to check options
Diffstat (limited to 'Library/Homebrew/test/rubocops')
| -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 288ca8f8f..b5ff3d1f4 100644 --- a/Library/Homebrew/test/rubocops/lines_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/lines_cop_spec.rb @@ -811,6 +811,30 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do expect_offense(expected, actual) end end + + it "with using ARGV to check options" do + source = <<-EOS.undent + class Foo < Formula + desc "foo" + url 'http://example.com/foo-1.0.tgz' + def test + verbose = ARGV.verbose? + end + end + EOS + + expected_offenses = [{ message: "Use build instead of ARGV to check options", + 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]) |
