I'm (mostly) following a tutorial everydayrails.com trying to write a test that shows that my user model requires an email:
17 it "requires an email" do
18 user = FactoryGirl.create(:user, email: nil)
19 expect( user ).to_not be_valid
20 end
But this fails... because my user model requires an email?
Failures:
1) User requires an email
Failure/Error: user = FactoryGirl.create(:user, email: nil)
ActiveRecord::RecordInvalid:
Validation failed: Email can't be blank
# ./spec/models/user_spec.rb:18:in `block (2 levels) in <top (required)>'
What am I doing wrong here?
Aucun commentaire:
Enregistrer un commentaire