diff --git a/CHANGELOG.md b/CHANGELOG.md index eb717c54e..68270448f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ - Fix a false positive for `RSpec/ContextWording` when context is interpolated string literal or execute string. ([@ydah]) - Fix a false positive for `RSpec/DescribeMethod` when multi-line describe without `#` and `.` at the beginning. ([@ydah], [@pirj]) +- Fix a false positive for `RSpec/VariableName` when inside non-spec code. ([@ydah]) +- Fix a false positive for `RSpec/VariableDefinition` when inside non-spec code. ([@ydah]) - Add new `RSpec/PendingBlockInsideExample` cop. ([@ydah]) ## 2.18.1 (2023-01-19) diff --git a/lib/rubocop/cop/rspec/variable_definition.rb b/lib/rubocop/cop/rspec/variable_definition.rb index 089c87ddc..60656eb76 100644 --- a/lib/rubocop/cop/rspec/variable_definition.rb +++ b/lib/rubocop/cop/rspec/variable_definition.rb @@ -27,10 +27,13 @@ class VariableDefinition < Base extend AutoCorrector include ConfigurableEnforcedStyle include Variable + include InsideExampleGroup MSG = 'Use %