Skip to content

Instantly share code, notes, and snippets.

@zavan
Created March 31, 2017 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zavan/f4d34dd86bf825db549a0ac28c7e10d5 to your computer and use it in GitHub Desktop.
Save zavan/f4d34dd86bf825db549a0ac28c7e10d5 to your computer and use it in GitHub Desktop.
Clarance auth strategy for derailed_benchmarks
# See: https://github.com/thoughtbot/clearance/blob/3e9529a643cff20beb9bb49eacedb90dee49d465/lib/clearance/testing/controller_helpers.rb
class ClearanceAuth < DerailedBenchmarks::AuthHelper
def setup
require 'clearance/session'
@user = User.first # Change to fit your needs
end
def call(env)
env[:clearance] = Clearance::Session.new(env)
env[:clearance].sign_in(@user)
app.call(env)
end
end
DerailedBenchmarks.auth = ClearanceAuth.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment