foodsoft/spec/support/session_helper.rb

15 lines
368 B
Ruby
Raw Permalink Normal View History

2013-07-24 01:05:01 +02:00
module SessionHelper
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?
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