title: RSpec: Expect to change multiple
body: <p>I want to check for many changes in a model when submitting a form in a feature spec. For example, I want to make sure that the user name was changed from X to Y, and that the encrypted password was changed by any value.</p>
  
  <p>I know there are some questions about that already, but I didn't find a fitting answer for me. The most accurate answer seems like the <code>ChangeMultiple</code> matcher by Michael Johnston here: <a href="https://stackoverflow.com/questions/13616631/is-it-possible-for-rspec-to-expect-change-in-two-tables">Is it possible for RSpec to expect change in two tables?</a>. Its downside is that one only check for explicit changes from known values to known values.</p>
  
  <p>I created some pseudo code on how I think a better matcher could look like:</p>
  
  <pre><code>expect {
    click_button 'Save'
  }.to change_multiple { @user.reload }.with_expectations(
    name:               {from: 'donald', to: 'gustav'},
    updated_at:         {by: 4},
    great_field:        {by_at_leaset: 23},
    encrypted_password: true,  # Must change
    created_at:         false, # Must not change
    some_other_field:   nil    # Doesn't matter, but want to denote here that this field exists
  )
  </code></pre>
  
  <p>I have also created the basic skeleton of the <code>ChangeMultiple</code> matcher like this:</p>
  
  <pre><code>module RSpec
    module Matchers
      def change_multiple(receiver=nil, message=nil, &amp;block)
        BuiltIn::ChangeMultiple.new(receiver, message, &amp;block)
      end
  
      module BuiltIn
        class ChangeMultiple &lt; Change
          def with_expectations(expectations)
            # What to do here? How do I add the expectations passed as argument?
          end
        end
      end
    end
  end
  </code></pre>
  
  <p>But now I'm already getting this error:</p>
  
  <pre><code> Failure/Error: expect {
     You must pass an argument rather than a block to use the provided matcher (nil), or the matcher must implement `supports_block_expectations?`.
   # ./spec/features/user/registration/edit_spec.rb:20:in `block (2 levels) in &lt;top (required)&gt;'
   # /Users/josh/.rvm/gems/ruby-2.1.0@base/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
   # /Users/josh/.rvm/gems/ruby-2.1.0@base/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
  </code></pre>
  
  <p>Any help in creating this custom matcher is highly appreciated.</p>