The following is not valid. Because Rspec thinks that it is not really clear what it means (there is actually a special warning if you do that). Do you mean that both should not change? Or only the second, but the first should not?
.not_to change(..).and change(..)
The better approach is to use the following:
.to not_change(..).and not_change(..)
Now the meaning is clear. Both should not change.
To define the matcher, add the following to your test setup (e.g. spec/rails_helper.rb
):
RSpec::Matchers.define_negated_matcher :not_change, :change