summaryrefslogtreecommitdiffstats
path: root/test/unit/user_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-03 12:37:57 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-03 12:37:57 +0000
commitf2af44b6feb9266c675427cd7390bb447dc9564b (patch)
tree420870cd77356fffbe8185ba10e322d260d6eea4 /test/unit/user_test.rb
parent37aba18c8f1e7af58aaaf0a95a61e55bb9f2bbb5 (diff)
downloadredmine-f2af44b6feb9266c675427cd7390bb447dc9564b.tar.gz
redmine-f2af44b6feb9266c675427cd7390bb447dc9564b.zip
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
Diffstat (limited to 'test/unit/user_test.rb')
-rw-r--r--test/unit/user_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb
index 3848eab0f..0fbb7d0c9 100644
--- a/test/unit/user_test.rb
+++ b/test/unit/user_test.rb
@@ -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")