Skip to content

Commit

Permalink
Use env[:clearance] instead of env[:session]
Browse files Browse the repository at this point in the history
  • Loading branch information
calebhearth committed Feb 27, 2013
1 parent a49a345 commit 7589b60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/clearance/back_door.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def sign_in_through_the_back_door(env)


if user_id.present? if user_id.present?
user = ::User.find(user_id) user = ::User.find(user_id)
env[:session].sign_in(user) env[:clearance].sign_in(user)
end end
end end
end end
Expand Down
8 changes: 4 additions & 4 deletions spec/clearance/back_door_spec.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


result = back_door.call(env) result = back_door.call(env)


env[:session].should have_received(:sign_in).with(user) env[:clearance].should have_received(:sign_in).with(user)
result.should eq mock_app.call(env) result.should eq mock_app.call(env)
end end


Expand All @@ -20,7 +20,7 @@


result = back_door.call(env) result = back_door.call(env)


env[:session].should have_received(:sign_in).never env[:clearance].should have_received(:sign_in).never
result.should eq mock_app.call(env) result.should eq mock_app.call(env)
end end


Expand All @@ -29,8 +29,8 @@ def env_without_user_id
end end


def env_for_user_id(user_id) def env_for_user_id(user_id)
session = stub('session', sign_in: true) clearance = stub('clearance', sign_in: true)
Rack::MockRequest.env_for("/?as=#{user_id}").merge(session: session) Rack::MockRequest.env_for("/?as=#{user_id}").merge(clearance: clearance)
end end


def mock_app def mock_app
Expand Down

0 comments on commit 7589b60

Please sign in to comment.