mirror of
https://github.com/heartcombo/devise.git
synced 2026-04-28 03:00:29 -04:00
Some refactor
This commit is contained in:
@@ -330,7 +330,7 @@ class ReconfirmableTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test 'required_fields should contain the fields that Devise uses' do
|
||||
assert_equal Devise::Models::Confirmable::ModuleMethods.required_fields.sort, [
|
||||
assert_equal Devise::Models::Confirmable.required_fields(User).sort, [
|
||||
:confirmation_sent_at,
|
||||
:confirmation_token,
|
||||
:confirmed_at
|
||||
|
||||
@@ -172,18 +172,18 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test 'required_fiels should be encryptable_password and the email field by default' do
|
||||
assert_equal Devise::Models::DatabaseAuthenticatable::ModuleMethods.required_fields.sort, [
|
||||
assert_equal Devise::Models::DatabaseAuthenticatable.required_fields(User).sort, [
|
||||
:email,
|
||||
:encrypted_password
|
||||
]
|
||||
end
|
||||
|
||||
test 'required_fields should be encryptable_password and the login when the login is on authentication_keys' do
|
||||
swap Devise, :authentication_keys => [:login] do
|
||||
assert_equal Devise::Models::DatabaseAuthenticatable::ModuleMethods.required_fields.sort, [
|
||||
swap User, :authentication_keys => [:login] do
|
||||
assert_equal Devise::Models::DatabaseAuthenticatable.required_fields(User).sort, [
|
||||
:encrypted_password,
|
||||
:login
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -66,7 +66,7 @@ class EncryptableTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test 'required_fields should contain the fields that Devise uses' do
|
||||
assert_equal Devise::Models::Encryptable::ModuleMethods.required_fields, [
|
||||
assert_equal Devise::Models::Encryptable.required_fields(User), [
|
||||
:password_salt
|
||||
]
|
||||
end
|
||||
|
||||
@@ -48,7 +48,7 @@ class TokenAuthenticatableTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test 'required_fields should contain the fields that Devise uses' do
|
||||
assert_equal Devise::Models::TokenAuthenticatable::ModuleMethods.required_fields.sort, [
|
||||
assert_equal Devise::Models::TokenAuthenticatable.required_fields(User).sort, [
|
||||
:authentication_token
|
||||
]
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@ require 'test_helper'
|
||||
|
||||
class TrackableTest < ActiveSupport::TestCase
|
||||
test 'required_fields should contain the fields that Devise uses' do
|
||||
assert_equal Devise::Models::Trackable::ModuleMethods.required_fields.sort, [
|
||||
assert_equal Devise::Models::Trackable.required_fields(User).sort, [
|
||||
:current_sign_in_at,
|
||||
:current_sign_in_ip,
|
||||
:last_sign_in_at,
|
||||
|
||||
@@ -110,4 +110,4 @@ class ValidatableTest < ActiveSupport::TestCase
|
||||
Class.new.send :include, Devise::Models::Validatable
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -113,7 +113,7 @@ class CheckFieldsTest < ActiveSupport::TestCase
|
||||
Player = Class.new do
|
||||
extend Devise::Models
|
||||
|
||||
def self.before_validation(x)
|
||||
def self.before_validation(instance)
|
||||
end
|
||||
|
||||
devise :database_authenticatable
|
||||
|
||||
Reference in New Issue
Block a user