title: How to test with RSpec if an email is delivered
body: <p>I'd like to test if an email is delivered if I call a controller method with :post. I'll use email_spec so I tried this snipped here: <a href="http://rubydoc.info/gems/email_spec/1.2.1/file/README.rdoc#Testing_In_Isolation" rel="noreferrer">http://rubydoc.info/gems/email_spec/1.2.1/file/README.rdoc#Testing_In_Isolation</a></p>
  
  <p>But it doesn't work, because I pass an instance of the model-object to the delivery-method and the instance is saved before the delivery.</p>
  
  <p>I tried to create an other instance of the model-object, but then the id isn't the same.</p>
  
  <p>My controller-method looks like this:</p>
  
  <pre><code>def create
  
     @params = params[:reservation]
  
     @reservation = Reservation.new(@params)
     if @reservation.save
        ReservationMailer.confirm_email(@reservation).deliver
        redirect_to success_path
     else
        @title = "Reservation"
        render 'new'
     end
  
  end
  </code></pre>
  
  <p>Do you have any idea to solve this?</p>