mirror of
https://github.com/heartcombo/devise.git
synced 2026-04-28 03:00:29 -04:00
Keep modules definition in a different file.
This commit is contained in:
@@ -25,7 +25,7 @@ class DeviseTest < ActiveSupport::TestCase
|
||||
Devise.configure_warden(config)
|
||||
|
||||
assert_equal Devise::FailureApp, config.failure_app
|
||||
assert_equal [:rememberable, :http_authenticatable, :token_authenticatable, :authenticatable], config.default_strategies
|
||||
assert_equal [:rememberable, :token_authenticatable, :http_authenticatable, :authenticatable], config.default_strategies
|
||||
assert_equal :user, config.default_scope
|
||||
assert config.silence_missing_strategies?
|
||||
end
|
||||
@@ -58,10 +58,9 @@ class DeviseTest < ActiveSupport::TestCase
|
||||
Devise::STRATEGIES.delete(:banana)
|
||||
|
||||
assert_nothing_raised(Exception) { Devise.add_module(:kivi, :controller => :fruits) }
|
||||
assert_not_nil Devise::CONTROLLERS[:fruits]
|
||||
assert_equal 1, Devise::CONTROLLERS[:fruits].select { |v| v == :kivi }.size
|
||||
assert_equal :fruits, Devise::CONTROLLERS[:kivi]
|
||||
Devise::ALL.delete(:kivi)
|
||||
Devise::CONTROLLERS.delete(:fruits)
|
||||
Devise::CONTROLLERS.delete(:kivi)
|
||||
|
||||
assert_nothing_raised(Exception) { Devise.add_module(:authenticatable_again, :model => 'devise/model/authenticatable') }
|
||||
assert defined?(Devise::Models::AuthenticatableAgain)
|
||||
|
||||
@@ -5,7 +5,7 @@ class MappingTest < ActiveSupport::TestCase
|
||||
test 'store options' do
|
||||
mapping = Devise.mappings[:user]
|
||||
assert_equal User, mapping.to
|
||||
assert_equal User.devise_modules, mapping.for
|
||||
assert_equal User.devise_modules, mapping.modules
|
||||
assert_equal :users, mapping.as
|
||||
end
|
||||
|
||||
@@ -18,15 +18,15 @@ class MappingTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test 'allows a controller depending on the mapping' do
|
||||
mapping = Devise.mappings[:user]
|
||||
assert mapping.allows?(:sessions)
|
||||
assert mapping.allows?(:confirmations)
|
||||
assert mapping.allows?(:passwords)
|
||||
allowed = Devise.mappings[:user].allowed_controllers
|
||||
assert allowed.include?("devise/sessions")
|
||||
assert allowed.include?("devise/confirmations")
|
||||
assert allowed.include?("devise/passwords")
|
||||
|
||||
mapping = Devise.mappings[:admin]
|
||||
assert mapping.allows?(:sessions)
|
||||
assert_not mapping.allows?(:confirmations)
|
||||
assert_not mapping.allows?(:passwords)
|
||||
allowed = Devise.mappings[:admin].allowed_controllers
|
||||
assert allowed.include?("sessions")
|
||||
assert_not allowed.include?("devise/confirmations")
|
||||
assert_not allowed.include?("devise/passwords")
|
||||
end
|
||||
|
||||
test 'find mapping by path' do
|
||||
|
||||
Reference in New Issue
Block a user