Sha256: 99ccf5a72ca965c6b941ccb5a126517faf8628db6f129d5b96ee088bdc1f09f7
Contents?: true
Size: 791 Bytes
Versions: 17
Compression:
Stored size: 791 Bytes
Contents
require 'active_support/concern' module Authentication extend ActiveSupport::Concern def login(role = nil) logout user(role) visit new_user_session_path(lang: :de) fill_in 'E-Mail', with: user.email fill_in 'Passwort', with: user.password click_button 'Anmelden' end def logout visit dashboard_path(lang: :de) click_link_or_button 'Abmelden' if page.has_link?('Abmelden') @user.try(:destroy) @user = nil end def user(role = nil) @user ||= User.find_or_create_by(email: 'testuser@iqvoc.local') do |u| u.forename = 'Test' u.surname = 'User' u.password = 'omgomgomg' u.password_confirmation = 'omgomgomg' u.role = 'reader' u.active = true u.role = role || User.default_role end end end
Version data entries
17 entries across 17 versions & 1 rubygems