title: Rails: Rspec and console output differ
body: <p>I'm having an issue with my specs. I'm trying to run a spec that creates and destroys an associated object, but none of my specs are creating or destroying that object. The weird thing is, I can literally copy and paste every line of code (except for the <code>.should</code>) out of each test into the console and the console will run each expectation perfectly, creating and destroying those objects. Here's a sample:</p>
  
  <pre><code>it "should not destroy notification for like on comment" do
    comment = FactoryGirl.create(:comment)
    like = FactoryGirl.create_list(:like, 2, likable: comment)
    like.first.destroy
    note = comment.user.notifications.find_by(notifiable: comment, from_comment: false)
    note.should_not be_nil
  end
  </code></pre>
  
  <p>Only the first like on a specific comment will send a notification to that comment's author. And if a comment only has one like, and that like is destroyed, it will destroy the notification it had originally sent, but it won't destroy the notification if the comment has more than 0 likes at any time.</p>
  
  <p>Is the problem that I'm just not writing scalable code? I know my specs probably aren't perfect, but why is the console getting different results with identical input?</p>