2011-12-07 05:01:16 -05:00
|
|
|
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
|
2014-02-25 11:42:55 -05:00
|
|
|
assert_kind_of Proc, delegator.failure_app({"warden.options" => {scope: "manager"}})
|
2011-12-07 05:01:16 -05:00
|
|
|
end
|
|
|
|
end
|