Do not show 2 validation errors when user mail is blank.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6168 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2011-07-03 12:37:57 +00:00
parent 37aba18c8f
commit f2af44b6fe
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -41,6 +41,13 @@ class UserTest < ActiveSupport::TestCase
u.mail = " foo@bar.com "
assert_equal "foo@bar.com", u.mail
end
def test_mail_validation
u = User.new
u.mail = ''
assert !u.valid?
assert_equal I18n.translate('activerecord.errors.messages.blank'), u.errors.on(:mail)
end
def test_create
user = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo")