Skip to content

Commit

Permalink
Use RuboCop RSpec 2.13
Browse files Browse the repository at this point in the history
This commit uses RuboCop RSpec 2.13.
https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md#2130-2022-09-12

And it suppresses new warnings of `RSpec/NoExpectationExample` cop.
  • Loading branch information
richardstewart0213 committed Sep 14, 2022
1 parent 12dc9e7 commit 64c8880
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ Performance/CollectionLiteralInLoop:
Exclude:
- 'spec/**/*.rb'

RSpec:
Language:
Expectations:
- expect_correction
- expect_no_offenses
- expect_offense

# This disabling is a workaround for https://github.com/rubocop-hq/rubocop-rails/issues/374.
RSpec/FactoryBot/CreateList:
Enabled: false
Expand Down
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.9.0'
gem 'rubocop-rspec', '~> 2.13.0'
gem 'simplecov'
gem 'test-queue'
gem 'yard', '~> 0.9'
Expand Down
4 changes: 4 additions & 0 deletions spec/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
end
end

# rubocop:disable RSpec/NoExpectationExample
it 'has a SupportedStyles for all EnforcedStyle and EnforcedStyle is valid' do
errors = []
cop_names.each do |name|
Expand All @@ -81,14 +82,17 @@

raise errors.join("\n") unless errors.empty?
end
# rubocop:enable RSpec/NoExpectationExample

# rubocop:disable RSpec/NoExpectationExample
it 'does not have any duplication' do
fname = File.expand_path('../config/default.yml', __dir__)
content = File.read(fname)
RuboCop::YAMLDuplicationChecker.check(content, fname) do |key1, key2|
raise "#{fname} has duplication of #{key1.value} on line #{key1.start_line} and line #{key2.start_line}"
end
end
# rubocop:enable RSpec/NoExpectationExample

it 'does not include `Safe: true`' do
cop_names.each do |name|
Expand Down

0 comments on commit 64c8880

Please sign in to comment.