diff --git a/lib/devise/controllers/helpers.rb b/lib/devise/controllers/helpers.rb index 234ae6f0..8908696e 100644 --- a/lib/devise/controllers/helpers.rb +++ b/lib/devise/controllers/helpers.rb @@ -42,7 +42,7 @@ module Devise end def #{mapping}_signed_in? - warden.authenticate?(:scope => :#{mapping}) + !!current_#{mapping} end def current_#{mapping} diff --git a/test/controllers/helpers_test.rb b/test/controllers/helpers_test.rb index 6dfb2092..81523257 100644 --- a/test/controllers/helpers_test.rb +++ b/test/controllers/helpers_test.rb @@ -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