1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

sign_in should return true in case user is already signed in and assert that.

This commit is contained in:
Aditya Sanghi 2011-08-02 14:35:46 +05:30
parent 0f8f786f9f
commit 873e49ab66
2 changed files with 2 additions and 1 deletions

View file

@ -106,6 +106,7 @@ module Devise
warden.session_serializer.store(resource, scope)
elsif warden.user(scope) == resource && !options.delete(:force)
# Do nothing. User already signed in and we are not forcing it.
true
else
warden.set_user(resource, options.merge!(:scope => scope))
end

View file

@ -106,7 +106,7 @@ class ControllerAuthenticatableTest < ActionController::TestCase
user = User.new
@mock_warden.expects(:user).returns(user)
@mock_warden.expects(:set_user).never
@controller.sign_in(user)
assert @controller.sign_in(user)
end
test 'sign in again when the user is already in only if force is given' do