mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Adding required_fields to all modules
This commit is contained in:
parent
6d5bccc050
commit
5ef35ee1bd
8 changed files with 41 additions and 0 deletions
|
@ -64,6 +64,10 @@ module Devise
|
|||
before_validation :strip_whitespace
|
||||
end
|
||||
|
||||
def self.required_fields(klass)
|
||||
[]
|
||||
end
|
||||
|
||||
# Check if the current object is valid for authentication. This method and
|
||||
# find_for_authentication are the methods used in a Warden::Strategy to check
|
||||
# if a model should be signed in or not.
|
||||
|
|
|
@ -15,6 +15,10 @@ module Devise
|
|||
module Omniauthable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def self.required_fields(klass)
|
||||
[]
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
Devise::Models.config(self, :omniauth_providers)
|
||||
end
|
||||
|
|
|
@ -5,6 +5,10 @@ module Devise
|
|||
module Registerable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def self.required_fields(klass)
|
||||
[]
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
# A convenience method that receives both parameters and session to
|
||||
# initialize a user. This can be used by OAuth, for example, to send
|
||||
|
|
|
@ -20,6 +20,10 @@ module Devise
|
|||
module Timeoutable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def self.required_fields(klass)
|
||||
[]
|
||||
end
|
||||
|
||||
# Checks whether the user session has expired based on configured time.
|
||||
def timedout?(last_access)
|
||||
return false if remember_exists_and_not_expired?
|
||||
|
|
7
test/models/authenticatable_test.rb
Normal file
7
test/models/authenticatable_test.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class AuthenticatableTest < ActiveSupport::TestCase
|
||||
test 'required_fields should be an empty array' do
|
||||
assert_equal Devise::Models::Validatable.required_fields(User), []
|
||||
end
|
||||
end
|
7
test/models/omniauthable_test.rb
Normal file
7
test/models/omniauthable_test.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class OmniauthableTest < ActiveSupport::TestCase
|
||||
test 'required_fields should contain the fields that Devise uses' do
|
||||
assert_same_content Devise::Models::Omniauthable.required_fields(User), []
|
||||
end
|
||||
end
|
7
test/models/registerable_test.rb
Normal file
7
test/models/registerable_test.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RegisterableTest < ActiveSupport::TestCase
|
||||
test 'required_fields should contain the fields that Devise uses' do
|
||||
assert_same_content Devise::Models::Registerable.required_fields(User), []
|
||||
end
|
||||
end
|
|
@ -39,4 +39,8 @@ class TimeoutableTest < ActiveSupport::TestCase
|
|||
assert user.timedout?(6.minutes.ago)
|
||||
end
|
||||
end
|
||||
|
||||
test 'required_fields should contain the fields that Devise uses' do
|
||||
assert_same_content Devise::Models::Timeoutable.required_fields(User), []
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue