Module: RailsJwtAuth::Spec::Helpers
- Defined in:
- lib/rails_jwt_auth/spec/helpers.rb
Instance Method Summary collapse
Instance Method Details
#sign_in(user) ⇒ Object
10 11 12 13 14 |
# File 'lib/rails_jwt_auth/spec/helpers.rb', line 10 def sign_in(user) manager = Warden::Manager.new(nil, &Rails.application.config.middleware.detect{|m| m.name == 'Warden::Manager'}.block) request.env['warden'] = Warden::Proxy.new(request.env, manager) request.env['warden'].set_user(user, store: false) end |
#sign_out ⇒ Object
6 7 8 |
# File 'lib/rails_jwt_auth/spec/helpers.rb', line 6 def sign_out allow(controller).to receive(:authenticate!).and_raise(RailsJwtAuth::Spec::NotAuthorized) end |