diff --git a/CHANGELOG.md b/CHANGELOG.md index 158aebdbd..573e2b182 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## Master (Unreleased) * Fix `HooksBeforeExamples`, `LeadingSubject`, `LetBeforeExamples` and `ScatteredLet` autocorrection to take into account inline comments and comments immediately before the moved node. ([@Darhazer][]) -* Improve rubocop-rspec performance. ([@Darhazer][]) +* Improve rubocop-rspec performance. ([@Darhazer][], [@bquorning][]) * Include `Enabled: true` to prevent a mismatched configuration parameter warning when `RSpec` cops are explicitly enabled in the user configuration. ([@pirj][]) ## 2.1.0 (2020-12-17) diff --git a/lib/rubocop/cop/rspec/expect_change.rb b/lib/rubocop/cop/rspec/expect_change.rb index 7b2c6b3df..2a7765f18 100644 --- a/lib/rubocop/cop/rspec/expect_change.rb +++ b/lib/rubocop/cop/rspec/expect_change.rb @@ -35,6 +35,7 @@ class ExpectChange < Base MSG_BLOCK = 'Prefer `change(%s, :%s)`.' MSG_CALL = 'Prefer `change { %s.%s }`.' + RESTRICT_ON_SEND = %i[change].freeze def_node_matcher :expect_change_with_arguments, <<-PATTERN (send nil? :change ({const send} nil? $_) (sym $_)) diff --git a/lib/rubocop/cop/rspec/factory_bot/create_list.rb b/lib/rubocop/cop/rspec/factory_bot/create_list.rb index 4a71a767e..a25c9dd70 100644 --- a/lib/rubocop/cop/rspec/factory_bot/create_list.rb +++ b/lib/rubocop/cop/rspec/factory_bot/create_list.rb @@ -30,6 +30,7 @@ class CreateList < Base MSG_CREATE_LIST = 'Prefer create_list.' MSG_N_TIMES = 'Prefer %s.times.' + RESTRICT_ON_SEND = %i[create_list].freeze def_node_matcher :n_times_block_without_arg?, <<-PATTERN (block diff --git a/lib/rubocop/cop/rspec/message_expectation.rb b/lib/rubocop/cop/rspec/message_expectation.rb index ff0f93b8b..051bf6fdc 100644 --- a/lib/rubocop/cop/rspec/message_expectation.rb +++ b/lib/rubocop/cop/rspec/message_expectation.rb @@ -30,6 +30,7 @@ class MessageExpectation < Base MSG = 'Prefer `%