module AuthRequestHelper
Helpers for Auth0 with request specs
Public Class Methods
included(base)
click to toggle source
# File lib/generators/rockstart/authorization/auth0/templates/spec/support/auth_request_helper.rb, line 5 def self.included(base) base.before(:all) do OmniAuth.config.test_mode = true end base.after(:each) do OmniAuth.config.mock_auth[:auth0] = nil end end
Public Instance Methods
sign_in(resource)
click to toggle source
# File lib/generators/rockstart/authorization/auth0/templates/spec/support/auth_request_helper.rb, line 14 def sign_in(resource) OmniAuth.config.mock_auth[:auth0] = OmniAuth::AuthHash.new(resource.to_h) post "/auth/auth0" follow_redirect! # call the callback endpoint end
sign_out(_resource)
click to toggle source
# File lib/generators/rockstart/authorization/auth0/templates/spec/support/auth_request_helper.rb, line 20 def sign_out(_resource) delete auth_sign_out_path end