Skip to content

Instantly share code, notes, and snippets.

@vovka
Last active August 29, 2015 13:55
Show Gist options
  • Save vovka/8693002 to your computer and use it in GitHub Desktop.
Save vovka/8693002 to your computer and use it in GitHub Desktop.
# Rack env specification:
# http://rack.rubyforge.org/doc/SPEC.html
# https://github.com/rack/rack/blob/master/SPEC
# How to get fake env hash:
# http://rack.rubyforge.org/doc/Rack/MockRequest.html#env_for-method
env = Rack::MockRequest.env_for('/test')
# Devise with Warden
warden_manager = Warden::Manager.new({})
warden_proxy = Warden::Proxy.new(app = {}, warden_manager)
# Simulate controller#action call:
SomeController.action('some_action').call(env.merge({ 'warden' => warden_proxy }))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment