-
-
Notifications
You must be signed in to change notification settings - Fork 289
Open
Labels
Description
On RSpec one can do:
expect { ... }.to change { ... }
.and change { ... }But it is not possible to do
expect { ... }.not_to change { ... }
.and_not change { ... }A common solution for this is defining a negated matcher for change:
RSpec::Matchers.define_negated_matcher :not_change, :change
...
expect { ... }.to not_change { ... }
.and not_change { ... }On doing this however, we lose the ExpectChange cop usefulness. I thought of creating a custom cop for it for my needs, as not_change is not standard. However, being it a common practice, I think that it would be nice for the ExpectChange cop to have an option where you'd explicit the negated matcher method.
e.g.:
RSpec/ExpectChange:
NegatedMatcher: not_changeWhat do you think?
Reactions are currently unavailable