Expect multiple not_to change expectations in rspec
<p>I'm trying to make sure certain data has remain unchanged by a single action:</p>

<pre><code>expect {
  # running migration and user reload here
}.not_to change(user, :avatar_url).from(sample_avatar_url).and change(user, :old_avatar).from(nil)
</code></pre>

<p><code>sample_avatar_url</code> is a string defined in the beginning of the spec file.</p>

<p>Basically, I want to check whether the <code>avatar_url</code> and <code>old_avatar</code> remain untouched by what's happening in the <code>expect</code> block.</p>

<p>The output from the above code is:</p>

<blockquote>
  <p><code>expect(...).not_to matcher.and matcher</code> is not supported, since it creates a bit of an ambiguity. Instead, define negated versions of whatever matchers you wish to negate with <code>RSpec::Matchers.define_negated_matcher</code> and use <code>expect(...).to matcher.and matcher</code>.</p>
</blockquote>