views:

90

answers:

2

Using shoulda, any ideas how to allow blank when having this test:

should validate_uniqueness_of(:email)

Thanks.

A: 
should allow_value(" ").for(:email)
should allow_value(nil).for(:email)
Subba Rao
I still get "Expected errors to include "has already been taken" when email is set to nil, got no errors" when running should validate_uniqueness_of(:email).
J. Pablo Fernández
A: 

maybe

should validate_uniqueness_of(:email, :allow_blank => true)
Bill Brasky
Nope, that doesn't work.
J. Pablo Fernández