title: Rails Rspec Model Spec User :email ActiveRecord::RecordInvalid
body: <p>Trying to figure out why my rspec test is failing. Most notable is the Failure message that seems contradictory. Stating I have an ActiveRecord::RecordInvalid error and that is exactly what I'm asserting should happen.</p>
  
  <p>Here is my user.rb</p>
  
  <pre><code>...
  validates_presence_of :email
  ...
  </code></pre>
  
  <p>Here is my users_spec.rb</p>
  
  <pre><code>...
  it "is invalid without email" do 
    Factory(:user, email: nil).should raise_error(ActiveRecord::RecordInvalid)
  end
  ...
  </code></pre>
  
  <p>here is the output:</p>
  
  <pre><code>Failures:
  
    1) User a user (in general) is invalid without email
       Failure/Error: Factory(:user, email: nil).should raise_error(ActiveRecord::RecordInvalid)
       ActiveRecord::RecordInvalid:
         Validation failed: Email is invalid, Email can't be blank
       # ./spec/models/user_spec.rb:34:in `block (3 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p>Originally I was testing it this way but it kept failing, so I decided to specify on what error I was expecting.</p>
  
  <pre><code>it "is invalid without email" do 
    Factory(:user, email: nil).should_not be_valid
  end
  </code></pre>