Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed sign_in and sign_out not setting current_user

  • Loading branch information...
commit b13f373df807344ff93eff2cd975afefa1e6bc97 1 parent a088ce8
@jferris jferris authored
View
4 lib/clearance/authentication.rb
@@ -66,7 +66,7 @@ def sign_in(user)
:value => user.remember_token,
:expires => 1.year.from_now.utc
}
- current_user = user
+ self.current_user = user
end
end
@@ -77,7 +77,7 @@ def sign_in(user)
def sign_out
current_user.reset_remember_token! if current_user
cookies.delete(:remember_token)
- current_user = nil
+ self.current_user = nil
end
# Store the current location and redirect to sign in.
View
4 test/controllers/confirmations_controller_test.rb
@@ -23,6 +23,10 @@ class ConfirmationsControllerTest < ActionController::TestCase
should_set_the_flash_to /confirmed email/i
should_set_the_flash_to /signed in/i
should_redirect_to_url_after_create
+
+ should "set the current user" do
+ assert_equal @user, @controller.current_user
+ end
end
context "with an incorrect token" do
View
4 test/controllers/sessions_controller_test.rb
@@ -137,6 +137,10 @@ class SessionsControllerTest < ActionController::TestCase
should "reset the remember token" do
assert_not_equal "old-token", @user.reload.remember_token
end
+
+ should "unset the current user" do
+ assert_nil @controller.current_user
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.