Sha256: c531880f17b431b0858e8126ced7df7ae4cacfd0277e97e68aef69e1a1ab7ffd
Contents?: true
Size: 739 Bytes
Versions: 12
Compression:
Stored size: 739 Bytes
Contents
module Sorcery module TestHelpers module Rails module Request # Accepts arguments for user to login, the password, route to use and HTTP method # Defaults - @user, 'secret', 'user_sessions_url' and http_method: POST def login_user(user = nil, password = 'secret', route = nil, http_method = :post) user ||= @user route ||= user_sessions_url username_attr = user.sorcery_config.username_attribute_names.first username = user.send(username_attr) password_attr = user.sorcery_config.password_attribute_name send(http_method, route, params: { "#{username_attr}": username, "#{password_attr}": password }) end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems