Module: RuboCop::Cop::RSpec::AggregateExamples::MatchersWithSideEffects
- Extended by:
- NodePattern::Macros
- Includes:
- Language
- Included in:
- RuboCop::Cop::RSpec::AggregateExamples
- Defined in:
- lib/rubocop/cop/rspec/aggregate_examples/matchers_with_side_effects.rb
Overview
When aggregated, the expectations will fail when not supposed to or have a risk of not failing when expected to. One example is ‘validate_presence_of :comment` as it leaves an empty comment after itself on the subject making it invalid and the subsequent expectation to fail. Examples with those matchers are not supposed to be aggregated.
Constant Summary collapse
- MSG_FOR_EXPECTATIONS_WITH_SIDE_EFFECTS =
'Aggregate with the example at line %d. IMPORTANT! Pay attention ' \ 'to the expectation order, some of the matchers have side effects.'