diff options
| author | Mike McQuaid | 2017-07-14 15:32:52 +0100 |
|---|---|---|
| committer | GitHub | 2017-07-14 15:32:52 +0100 |
| commit | 20db5470e3325d3a64e16c785c22c25581e03b52 (patch) | |
| tree | b7132a4f6180538060f50d941d3998028c20dd9f /Library/Homebrew/test | |
| parent | 4ca2efb12dd1399526e0aa845b56ede58daecddd (diff) | |
| parent | 222af824014f99be7da24f6aa8980eaf28548cb9 (diff) | |
| download | brew-20db5470e3325d3a64e16c785c22c25581e03b52.tar.bz2 | |
Merge pull request #2879 from GauthamGoli/audit_option_rubocop_1
audit: Port audit_options non-strict rules to rubocop and add tests
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/rubocops/conflicts_cop_spec.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/test/rubocops/options_cop_spec.rb | 31 |
3 files changed, 33 insertions, 6 deletions
diff --git a/Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb b/Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb index a775b0b17..563f7ad4b 100644 --- a/Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/bottle_block_cop_spec.rb @@ -18,7 +18,7 @@ describe RuboCop::Cop::FormulaAuditStrict::BottleBlock do end EOS - expected_offenses = [{ message: "Use rebuild instead of revision in bottle block", + expected_offenses = [{ message: described_class::MSG, severity: :convention, line: 5, column: 4, diff --git a/Library/Homebrew/test/rubocops/conflicts_cop_spec.rb b/Library/Homebrew/test/rubocops/conflicts_cop_spec.rb index c3175509a..4fbab6c9e 100644 --- a/Library/Homebrew/test/rubocops/conflicts_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/conflicts_cop_spec.rb @@ -16,11 +16,7 @@ describe RuboCop::Cop::FormulaAudit::Conflicts do end EOS - msg = <<-EOS.undent - Versioned formulae should not use `conflicts_with`. - Use `keg_only :versioned_formula` instead. - EOS - expected_offenses = [{ message: msg, + expected_offenses = [{ message: described_class::MSG, severity: :convention, line: 3, column: 2, diff --git a/Library/Homebrew/test/rubocops/options_cop_spec.rb b/Library/Homebrew/test/rubocops/options_cop_spec.rb new file mode 100644 index 000000000..0ed3a9741 --- /dev/null +++ b/Library/Homebrew/test/rubocops/options_cop_spec.rb @@ -0,0 +1,31 @@ +require "rubocop" +require "rubocop/rspec/support" +require_relative "../../extend/string" +require_relative "../../rubocops/options_cop" + +describe RuboCop::Cop::FormulaAudit::Options do + subject(:cop) { described_class.new } + + context "When auditing options" do + it "32-bit" do + source = <<-EOS.undent + class Foo < Formula + url 'http://example.com/foo-1.0.tgz' + option "32-bit", "with 32-bit" + end + EOS + + expected_offenses = [{ message: described_class::DEPRECATION_MSG, + severity: :convention, + line: 3, + column: 10, + source: source }] + + inspect_source(cop, source) + + expected_offenses.zip(cop.offenses).each do |expected, actual| + expect_offense(expected, actual) + end + end + end +end |
