Project

General

Profile

« Previous | Next » 

Revision 564b322f

Added by Tom Caspy almost 9 years ago

fixes #5897 - when user doesn't have an email, email isn't required

View differences:

test/unit/user_test.rb
assert_valid FactoryGirl.build(:user, :mail => nil)
end
test "should have mail when updating" do
test "mail is optional if mail is currently nil" do
u = FactoryGirl.create(:user, :mail => nil)
u.firstname = 'Bob'
assert_valid u
end
test "mail is require when mail isn't currently nil" do
u = FactoryGirl.create(:user, :mail => "foo@bar.com")
u.mail = nil
refute_valid u, :mail
end

Also available in: Unified diff