Module: RailsJwtAuth::SpecHelpers
- Defined in:
- lib/rails_jwt_auth/spec_helpers.rb
Instance Method Summary collapse
Instance Method Details
#sign_in(user) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/rails_jwt_auth/spec_helpers.rb', line 3 def sign_in(user) allow_any_instance_of(RailsJwtAuth::AuthenticableHelper) .to receive(:authenticate!).and_return(true) allow_any_instance_of(RailsJwtAuth::AuthenticableHelper) .to receive(:current_user).and_return(user.class.find(user.id)) end |
#sign_out ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/rails_jwt_auth/spec_helpers.rb', line 11 def sign_out allow_any_instance_of(RailsJwtAuth::AuthenticableHelper) .to receive(:authenticate!).and_call_original allow_any_instance_of(RailsJwtAuth::AuthenticableHelper) .to receive(:current_user).and_call_original end |