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
|
2017-10-27 23:21:31 +02:00
|
|
|
user = FactoryBot.create :user if user.nil?
|
2013-07-24 02:57:45 +02:00
|
|
|
if user.instance_of? ::User
|
|
|
|
nick, password = user.nick, user.password
|
|
|
|
else
|
|
|
|
nick = user
|
|
|
|
end
|
2013-07-24 01:05:01 +02:00
|
|
|
fill_in 'nick', :with => nick
|
|
|
|
fill_in 'password', :with => password
|
|
|
|
find('input[type=submit]').click
|
|
|
|
end
|
|
|
|
end
|