mirror of
https://github.com/heartcombo/devise.git
synced 2026-04-28 03:00:29 -04:00
There is a delegator to get failure app, introduced in4629beeand tuned in24b26026. The latter commit introduced a bit of logic, however, no tests are included into commit. Needless to say this resulted in a broken code. The point is that `env["warden.options"][:scope]` returns a string. However, `Devise.mappings` is a hash with symbol keys. Adding tests and converting scope to symbol here.
20 lines
633 B
Ruby
20 lines
633 B
Ruby
require 'test_helper'
|
|
|
|
class DelegatorTest < ActiveSupport::TestCase
|
|
def delegator
|
|
Devise::Delegator.new
|
|
end
|
|
|
|
test 'failure_app returns default failure app if no warden options in env' do
|
|
assert_equal Devise::FailureApp, delegator.failure_app({})
|
|
end
|
|
|
|
test 'failure_app returns default failure app if no scope in warden options' do
|
|
assert_equal Devise::FailureApp, delegator.failure_app({"warden.options" => {}})
|
|
end
|
|
|
|
test 'failure_app returns associated failure app by scope in the given environment' do
|
|
assert_kind_of Proc, delegator.failure_app({"warden.options" => {:scope => "manager"}})
|
|
end
|
|
end
|