Class: Rack::Pubcookie::Fake

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/pubcookie/fake.rb

Overview

This Rack interface is meant to be used in development. It mocks out pubcookie authentication by always setting the REMOTE_USER variable to a specific username given to the constructor.

This is not meant to be used in production obviously…

Instance Method Summary collapse

Constructor Details

#initialize(app, username) ⇒ Fake

Returns a new instance of Fake.



11
12
13
# File 'lib/rack/pubcookie/fake.rb', line 11

def initialize app, username
  @app, @username = app, username
end

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
# File 'lib/rack/pubcookie/fake.rb', line 15

def call env
  env['REMOTE_USER'] = @username
  @app.call env
end