rails rspec testing updating attribute on model
<p>I have a very simple model called <code>Reminder</code> with a boolean attribute of <code>verified</code> and I want to test my method <code>update_verified</code> which simply sets the attribute <code>verified</code> to <code>true</code>. I'm using rspec and factory girl.</p>

<pre><code># reminder.rb
  def update_verified
    self.update(verified: true)
  end 

# reminder_spec.rb
  describe "#update_verified" do
    it "should mark the reminder.verified to true" do
      reminder = build(:reminder, verified: false)
      reminder.update_verified

      expect(reminder.verified).to eq(true)
    end
  end
</code></pre>

<p>For some reason, when I run the test, the new value of <code>true</code> for the attribute <code>verified</code> is not being persisted. However, when I run the method in console, it works fine. Thoughts?</p>

<pre><code>  1) Reminder#update_verified should mark the reminder.verified to true
     Failure/Error: expect(reminder.verified).to eq(true)

       expected: true
            got: false

       (compared using ==)
     # ./spec/models/reminder_spec.rb:46:in `block (3 levels) in &lt;top (required)&gt;'

Finished in 0.19193 seconds (files took 7.07 seconds to load)
</code></pre>