scope_signed_in? helpers now simply delegate to current_scope to improve performance.
This commit is contained in:
parent
a36cb6e758
commit
fefbf51c79
|
@ -42,7 +42,7 @@ module Devise
|
|||
end
|
||||
|
||||
def #{mapping}_signed_in?
|
||||
warden.authenticate?(:scope => :#{mapping})
|
||||
!!current_#{mapping}
|
||||
end
|
||||
|
||||
def current_#{mapping}
|
||||
|
|
|
@ -46,13 +46,13 @@ class ControllerAuthenticableTest < ActionController::TestCase
|
|||
end
|
||||
|
||||
test 'proxy user_signed_in? to authenticate? with user scope' do
|
||||
@mock_warden.expects(:authenticate?).with(:scope => :user)
|
||||
@controller.user_signed_in?
|
||||
@mock_warden.expects(:authenticate).with(:scope => :user).returns("user")
|
||||
assert @controller.user_signed_in?
|
||||
end
|
||||
|
||||
test 'proxy admin_signed_in? to authenticate? with admin scope' do
|
||||
@mock_warden.expects(:authenticate?).with(:scope => :admin)
|
||||
@controller.admin_signed_in?
|
||||
@mock_warden.expects(:authenticate).with(:scope => :admin)
|
||||
assert_not @controller.admin_signed_in?
|
||||
end
|
||||
|
||||
test 'proxy user_session to session scope in warden' do
|
||||
|
|
Loading…
Reference in New Issue