foodsoft/spec/support/session_helper.rb

16 lines
369 B
Ruby
Raw 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
user = FactoryBot.create(:user) if user.nil?
if user.instance_of? ::User
nick = user.nick
password = user.password
else
nick = user
end
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