test/models_test.rb in loyal_devise-2.1.2 vs test/models_test.rb in loyal_devise-2.1.3
- old
+ new
@@ -1,30 +1,8 @@
-# -*- encoding : utf-8 -*-
require 'test_helper'
+require 'test_models'
-class Configurable < User
- devise :database_authenticatable, :confirmable, :rememberable, :timeoutable, :lockable,
- :stretches => 15, :pepper => 'abcdef', :allow_unconfirmed_access_for => 5.days,
- :remember_for => 7.days, :timeout_in => 15.minutes, :unlock_in => 10.days
-end
-
-class WithValidation < Admin
- devise :database_authenticatable, :validatable, :password_length => 2..6
-end
-
-class UserWithValidation < User
- validates_presence_of :username
-end
-
-class Several < Admin
- devise :validatable
- devise :lockable
-end
-
-class Inheritable < Admin
-end
-
class ActiveRecordTest < ActiveSupport::TestCase
def include_module?(klass, mod)
klass.devise_modules.include?(mod) &&
klass.included_modules.include?(Devise::Models::const_get(mod.to_s.classify))
end
@@ -103,10 +81,15 @@
test 'set a default value for unlock_in' do
assert_equal 10.days, Configurable.unlock_in
end
test 'set null fields on migrations' do
- Admin.create!
+ # Ignore email sending since no email exists.
+ klass = Class.new(Admin) do
+ def send_devise_notification(*); end
+ end
+
+ klass.create!
end
end
class CheckFieldsTest < ActiveSupport::TestCase
test 'checks if the class respond_to the required fields' do