Class: Monban::BackDoor
- Inherits:
-
Object
- Object
- Monban::BackDoor
- Defined in:
- lib/monban/back_door.rb
Overview
Note:
This should only be used for testing purposes
Middleware used in tests to allow users to be signed in directly, without having to load and submit the sign in form. The user should be provided by using the key :as in a hash passed to the path.
Instance Method Summary collapse
-
#call(env) ⇒ Object
Execute the BackDoor middleware signing in the user specified with :as.
-
#initialize(app, &block) ⇒ BackDoor
constructor
Create the a new BackDoor middleware for test purposes.
Constructor Details
#initialize(app, &block) ⇒ BackDoor
Create the a new BackDoor middleware for test purposes
19 20 21 22 23 24 25 |
# File 'lib/monban/back_door.rb', line 19 def initialize(app, &block) @app = app if block @sign_in_block = block end end |
Instance Method Details
#call(env) ⇒ Object
Execute the BackDoor middleware signing in the user specified with :as
28 29 30 31 |
# File 'lib/monban/back_door.rb', line 28 def call(env) sign_in_through_the_back_door(env) @app.call(env) end |