module RailsJwtAuth::SpecHelpers

Public Instance Methods

sign_in(user) click to toggle source
# 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() click to toggle source
# 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