Added a missing test and asserting same content for 1.8 compatibility
This commit is contained in:
parent
2ab1086b80
commit
d7337c5b26
|
@ -330,7 +330,7 @@ class ReconfirmableTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'required_fields should contain the fields that Devise uses' do
|
test 'required_fields should contain the fields that Devise uses' do
|
||||||
assert_equal Devise::Models::Confirmable.required_fields(User).sort, [
|
assert_same_content Devise::Models::Confirmable.required_fields(User).sort, [
|
||||||
:confirmation_sent_at,
|
:confirmation_sent_at,
|
||||||
:confirmation_token,
|
:confirmation_token,
|
||||||
:confirmed_at
|
:confirmed_at
|
||||||
|
|
|
@ -172,7 +172,7 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'required_fiels should be encryptable_password and the email field by default' do
|
test 'required_fiels should be encryptable_password and the email field by default' do
|
||||||
assert_equal Devise::Models::DatabaseAuthenticatable.required_fields(User).sort, [
|
assert_same_content Devise::Models::DatabaseAuthenticatable.required_fields(User).sort, [
|
||||||
:email,
|
:email,
|
||||||
:encrypted_password
|
:encrypted_password
|
||||||
]
|
]
|
||||||
|
@ -180,7 +180,7 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
test 'required_fields should be encryptable_password and the login when the login is on authentication_keys' do
|
test 'required_fields should be encryptable_password and the login when the login is on authentication_keys' do
|
||||||
swap Devise, :authentication_keys => [:login] do
|
swap Devise, :authentication_keys => [:login] do
|
||||||
assert_equal Devise::Models::DatabaseAuthenticatable.required_fields(User).sort, [
|
assert_same_content Devise::Models::DatabaseAuthenticatable.required_fields(User).sort, [
|
||||||
:encrypted_password,
|
:encrypted_password,
|
||||||
:login
|
:login
|
||||||
]
|
]
|
||||||
|
|
|
@ -66,7 +66,7 @@ class EncryptableTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'required_fields should contain the fields that Devise uses' do
|
test 'required_fields should contain the fields that Devise uses' do
|
||||||
assert_equal Devise::Models::Encryptable.required_fields(User), [
|
assert_same_content Devise::Models::Encryptable.required_fields(User), [
|
||||||
:password_salt
|
:password_salt
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
|
@ -237,7 +237,7 @@ class LockableTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'required_fields should contain the fields that Devise uses' do
|
test 'required_fields should contain the fields that Devise uses' do
|
||||||
assert_equal Devise::Models::Lockable.required_fields(User).sort, [
|
assert_same_content Devise::Models::Lockable.required_fields(User).sort, [
|
||||||
:failed_attempts,
|
:failed_attempts,
|
||||||
:unlock_at,
|
:unlock_at,
|
||||||
:unlock_token
|
:unlock_token
|
||||||
|
|
|
@ -197,7 +197,7 @@ class RecoverableTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'required_fields should contain the fields that Devise uses' do
|
test 'required_fields should contain the fields that Devise uses' do
|
||||||
assert_equal Devise::Models::Recoverable.required_fields(User), [
|
assert_same_content Devise::Models::Recoverable.required_fields(User), [
|
||||||
:reset_password_sent_at,
|
:reset_password_sent_at,
|
||||||
:reset_password_token
|
:reset_password_token
|
||||||
]
|
]
|
||||||
|
|
|
@ -54,7 +54,7 @@ class RememberableTest < ActiveSupport::TestCase
|
||||||
resource.forget_me!
|
resource.forget_me!
|
||||||
assert resource.remember_created_at.nil?
|
assert resource.remember_created_at.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'forget_me should not try to update resource if it has been destroyed' do
|
test 'forget_me should not try to update resource if it has been destroyed' do
|
||||||
resource = create_resource
|
resource = create_resource
|
||||||
resource.destroy
|
resource.destroy
|
||||||
|
@ -165,4 +165,12 @@ class RememberableTest < ActiveSupport::TestCase
|
||||||
assert_not_equal old, resource.remember_created_at
|
assert_not_equal old, resource.remember_created_at
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'should have the required_fiels array' do
|
||||||
|
assert_same_content Devise::Models::Rememberable.required_fields(User), [
|
||||||
|
:unlock_token,
|
||||||
|
:locked_at,
|
||||||
|
:failed_attempts
|
||||||
|
]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -48,7 +48,7 @@ class TokenAuthenticatableTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'required_fields should contain the fields that Devise uses' do
|
test 'required_fields should contain the fields that Devise uses' do
|
||||||
assert_equal Devise::Models::TokenAuthenticatable.required_fields(User).sort, [
|
assert_same_content Devise::Models::TokenAuthenticatable.required_fields(User).sort, [
|
||||||
:authentication_token
|
:authentication_token
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'test_helper'
|
||||||
|
|
||||||
class TrackableTest < ActiveSupport::TestCase
|
class TrackableTest < ActiveSupport::TestCase
|
||||||
test 'required_fields should contain the fields that Devise uses' do
|
test 'required_fields should contain the fields that Devise uses' do
|
||||||
assert_equal Devise::Models::Trackable.required_fields(User).sort, [
|
assert_same_content Devise::Models::Trackable.required_fields(User).sort, [
|
||||||
:current_sign_in_at,
|
:current_sign_in_at,
|
||||||
:current_sign_in_ip,
|
:current_sign_in_ip,
|
||||||
:last_sign_in_at,
|
:last_sign_in_at,
|
||||||
|
|
|
@ -24,4 +24,12 @@ class ActiveSupport::TestCase
|
||||||
def assert_email_not_sent(&block)
|
def assert_email_not_sent(&block)
|
||||||
assert_no_difference('ActionMailer::Base.deliveries.size') { yield }
|
assert_no_difference('ActionMailer::Base.deliveries.size') { yield }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def assert_same_content(expected, result)
|
||||||
|
assert expected.size == result.size
|
||||||
|
expected.each do |element|
|
||||||
|
result.index(element)
|
||||||
|
assert !element.nil?
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue