Skip to content

Commit

Permalink
Use RuboCop RSpec 2.18
Browse files Browse the repository at this point in the history
This commit makes this repo to use RuboCop RSpec 2.18 and suppress the following new offenses:

```console
% bundle exec rake
(snip)

Offenses:

spec/project_spec.rb:20:9: C: [Correctable] RSpec/PredicateMatcher: Prefer using include? over include matcher.
        expect(description).not_to include("\n")
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/rubocop/cop/performance/times_map_spec.rb:5:13: C: [Correctable] RSpec/ContextMethod: Use describe for testing methods.
    context ".times.#{method}" do
            ^^^^^^^^^^^^^^^^^^

115 files inspected, 2 offenses detected, 2 offenses autocorrectable
RuboCop failed!
```
  • Loading branch information
koic committed Jan 29, 2023
1 parent 3cdb861 commit 8fafbe4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ gem 'bump', require: false
gem 'rake'
gem 'rspec'
gem 'rubocop', github: 'rubocop/rubocop'
gem 'rubocop-rspec', '~> 2.16.0'
gem 'rubocop-rspec', '~> 2.18.0'
gem 'simplecov'
gem 'test-queue'
gem 'yard', '~> 0.9'
Expand Down
2 changes: 1 addition & 1 deletion spec/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
cop_names.each do |name|
description = config[name]['Description']
expect(description.nil?).to be(false)
expect(description).not_to include("\n")
expect(description.include?("\n")).to be(false)

start_with_subject = description.match(/\AThis cop (?<verb>.+?) .*/)
suggestion = start_with_subject[:verb]&.capitalize if start_with_subject
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/performance/times_map_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

RSpec.describe RuboCop::Cop::Performance::TimesMap, :config do
shared_examples 'map_or_collect' do |method|
context ".times.#{method}" do
describe ".times.#{method}" do
context 'with a block' do
it 'registers an offense and corrects' do
expect_offense(<<~RUBY, method: method)
Expand Down

0 comments on commit 8fafbe4

Please sign in to comment.