You can add your own support for the absent not_change matcher.

by John Norris

You can test that mutliple attributes of an object have changed like this:

expect do
  req
  sku.reload
end.to change(sku, :code)
  .and change(sku, :price)

But you can’t do the opposite:

expect do
  req
  sku.reload
end.to not_change(sku, :code)
  .and not_change(sku, :price)

What you can do is define not_change to support this:

RSpec::Matchers.define_negated_matcher :not_change, :change