Class: Rack::BackDoor
- Inherits:
-
Object
- Object
- Rack::BackDoor
- Defined in:
- lib/rack/back_door.rb
Overview
Force a User to be authenticated ala robots.thoughtbot.com/post/37907699673/faster-tests-sign-in-through-the-back-door
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}, &block) ⇒ BackDoor
constructor
A new instance of BackDoor.
Constructor Details
#initialize(app, options = {}, &block) ⇒ BackDoor
Returns a new instance of BackDoor.
6 7 8 9 10 11 12 13 14 |
# File 'lib/rack/back_door.rb', line 6 def initialize(app, = {}, &block) @app = app @url_parameter = .fetch(:url_parameter, "as") @session_key = .fetch(:session_key, "user_id") if block @sign_in = Proc.new(&block) end end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/rack/back_door.rb', line 16 def call(env) @env = env sign_in_through_the_back_door app.call(env) end |