2013-07-24 01:05:01 +02:00
|
|
|
module SessionHelper
|
2021-03-01 15:27:26 +01:00
|
|
|
def login(user = nil, password = nil)
|
2013-07-24 01:05:01 +02:00
|
|
|
visit login_path
|
2023-05-12 13:01:12 +02:00
|
|
|
user = FactoryBot.create(:user) if user.nil?
|
2013-07-24 02:57:45 +02:00
|
|
|
if user.instance_of? ::User
|
2023-05-12 13:01:12 +02:00
|
|
|
nick = user.nick
|
|
|
|
password = user.password
|
2013-07-24 02:57:45 +02:00
|
|
|
else
|
|
|
|
nick = user
|
|
|
|
end
|
2023-05-12 13:01:12 +02:00
|
|
|
fill_in 'nick', with: nick
|
|
|
|
fill_in 'password', with: password
|
2013-07-24 01:05:01 +02:00
|
|
|
find('input[type=submit]').click
|
|
|
|
end
|
|
|
|
end
|