more flexible login in spec helper

This commit is contained in:
wvengen 2013-07-24 01:11:36 +02:00
parent d58ce31b7f
commit a858ceedea
2 changed files with 4 additions and 6 deletions

View file

@ -1,12 +1,10 @@
module SessionHelper
def login(nick=nil, password=nil)
def login(user=nil, password=nil)
visit login_path
if nick.nil?
user = FactoryGirl.create :user
nick, password = user.nick, user.password
end
user = FactoryGirl.create :user if user.nil?
nick, password = user.nick, user.password if user.instance_of? ::User
fill_in 'nick', :with => nick
fill_in 'password', :with => password
find('input[type=submit]').click