title: How to test dependent: :destroy with RSpec?
body: <p>I'd like to test my <code>User</code> models association <code>has_many :projects, dependent: :destroy</code> and have gone this far for now:</p>
  
  <pre><code>it "destroys dependent projects" do
    user = FactoryGirl.build(:user)
    project = FactoryGirl.build(:project)
  
    user.projects &lt;&lt; project
    user.destroy
  
    expect(Project.count).to change(-1)
  end
  </code></pre>
  
  <p>but this gives out an error:</p>
  
  <pre><code>Failure/Error: expect(Project.count).to change(-1)
       ArgumentError:
         `change` requires either an object and message (`change(obj, :msg)`) or a block (`change { }`). You passed an object but no message.
  </code></pre>
  
  <p>so I presume that <code>change</code> isn't the right matcher, is it? Can you please tell me how I could write this test without getting that error?</p>