module MinimalistAuthentication::TestHelper

Constants

PASSWORD
PASSWORD_DIGEST

Public Instance Methods

current_user() click to toggle source
# File lib/minimalist_authentication/test_helper.rb, line 12
def current_user
  @current_user ||= load_user_from_session
end
login_as(user_fixture_name, password = PASSWORD) click to toggle source
# File lib/minimalist_authentication/test_helper.rb, line 8
def login_as(user_fixture_name, password = PASSWORD)
  post session_path, params: { user: { email: users(user_fixture_name).email, password: } }
end

Private Instance Methods

load_user_from_session() click to toggle source
# File lib/minimalist_authentication/test_helper.rb, line 18
def load_user_from_session
  MinimalistAuthentication.configuration.user_model.find(session_user_id) if session_user_id
end
session_user_id() click to toggle source
# File lib/minimalist_authentication/test_helper.rb, line 22
def session_user_id
  @request.session[MinimalistAuthentication.configuration.session_key]
end