Skip to content

Commit

Permalink
removing unnecessary session[:salt]
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Croak committed Feb 9, 2009
1 parent 831a144 commit 9655ff4
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 11 deletions.
Expand Up @@ -28,17 +28,14 @@

Then /^I should be signed in$/ do
assert_not_nil request.session[:user_id]
assert_not_nil request.session[:salt]
end

Then /^I should not be signed in$/ do
assert_nil request.session[:user_id]
assert_nil request.session[:salt]
end

When /^session is cleared$/ do
request.session[:user_id] = nil
request.session[:salt] = nil
end

# Emails
Expand Down
5 changes: 2 additions & 3 deletions lib/clearance/app/controllers/application_controller.rb
Expand Up @@ -26,8 +26,8 @@ def authenticate
end

def user_from_session
if session[:user_id] && session[:salt]
user = User.find_by_id_and_salt(session[:user_id], session[:salt])
if session[:user_id]
user = User.find_by_id(session[:user_id])
user && user.email_confirmed? ? user : nil
end
end
Expand All @@ -47,7 +47,6 @@ def sign_user_in(user)
def sign_in(user)
if user
session[:user_id] = user.id
session[:salt] = user.salt
end
end

Expand Down
2 changes: 0 additions & 2 deletions lib/clearance/test/test_helper.rb
Expand Up @@ -11,13 +11,11 @@ def sign_in_as(user = nil)
user.confirm_email!
end
@request.session[:user_id] = user.id
@request.session[:salt] = user.salt
return user
end

def sign_out
@request.session[:user_id] = nil
@request.session[:salt] = nil
end

end
Expand Down
3 changes: 0 additions & 3 deletions shoulda_macros/clearance.rb
Expand Up @@ -10,8 +10,6 @@ def should_be_signed_in_as(&block)
"please pass a User. try: should_be_signed_in_as { @user }"
assert_equal user.id, session[:user_id],
"session[:user_id] is not set to User's id"
assert_equal user.salt, session[:salt],
"session[:salt] is not set to User's salt"
end
end

Expand All @@ -30,7 +28,6 @@ def should_be_signed_in_and_email_confirmed_as(&block)
def should_not_be_signed_in
should "not be signed in" do
assert_nil session[:user_id]
assert_nil session[:salt]
end
end

Expand Down

0 comments on commit 9655ff4

Please sign in to comment.