Class: Clearance::BackDoor

Inherits:
Object
  • Object
show all
Defined in:
lib/clearance/back_door.rb

Overview

Middleware which allows signing in by passing as=USER_ID in a query parameter.

Designed to eliminate time in integration tests wasted by visiting and submitting the sign in form.

Configuration:

# config/environments/test.rb MyRailsApp::Application.configure do # ... config.middleware.use Clearance::BackDoor # ... end

Usage:

visit new_feedback_path(as: user)

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ BackDoor

Returns a new instance of BackDoor


21
22
23
# File 'lib/clearance/back_door.rb', line 21

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object


25
26
27
28
# File 'lib/clearance/back_door.rb', line 25

def call(env)
  (env)
  @app.call(env)
end