Sha256: d0d9447f8a8fefed083a42dddba260a3cf75d6c23eb07b231bd2574403f012f5
Contents?: true
Size: 839 Bytes
Versions: 17
Compression:
Stored size: 839 Bytes
Contents
module Sorcery module TestHelpers module Rails module Integration # Accepts arguments for user to login, route to use and HTTP method # Defaults - @user, 'sessions_url' and POST def login_user(user = nil, route = nil, http_method = :post) user ||= @user route ||= sessions_url username_attr = user.sorcery_config.username_attribute_names.first username = user.send(username_attr) page.driver.send(http_method, route, :"#{username_attr}" => username, :password => 'secret') end # Accepts route and HTTP method arguments # Default - 'logout_url' and GET def logout_user(route = nil, http_method = :get) route ||= logout_url page.driver.send(http_method, route) end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems