Rails3: test: replace deprecated Errors#on to Errors#[] and join with to_s at test/unit/user_test.rb
On Rails2, Errors#[] returns single error if one error raises. But, on Rails3, Errors#[] always returns the array. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8137 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
7aba81dbe7
commit
8e5242ef63
|
@ -54,7 +54,8 @@ class UserTest < ActiveSupport::TestCase
|
|||
u = User.new
|
||||
u.mail = ''
|
||||
assert !u.valid?
|
||||
assert_equal I18n.translate('activerecord.errors.messages.blank'), u.errors.on(:mail)
|
||||
assert_equal I18n.translate('activerecord.errors.messages.blank'),
|
||||
u.errors[:mail].to_s
|
||||
end
|
||||
|
||||
def test_create
|
||||
|
@ -99,7 +100,8 @@ class UserTest < ActiveSupport::TestCase
|
|||
u.login = 'NewUser'
|
||||
u.password, u.password_confirmation = "password", "password"
|
||||
assert !u.save
|
||||
assert_equal I18n.translate('activerecord.errors.messages.taken'), u.errors.on(:login)
|
||||
assert_equal I18n.translate('activerecord.errors.messages.taken'),
|
||||
u.errors[:login].to_s
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -113,7 +115,8 @@ class UserTest < ActiveSupport::TestCase
|
|||
u.login = 'newuser2'
|
||||
u.password, u.password_confirmation = "password", "password"
|
||||
assert !u.save
|
||||
assert_equal I18n.translate('activerecord.errors.messages.taken'), u.errors.on(:mail)
|
||||
assert_equal I18n.translate('activerecord.errors.messages.taken'),
|
||||
u.errors[:mail].to_s
|
||||
end
|
||||
|
||||
def test_update
|
||||
|
|
Loading…
Reference in New Issue