diff --git a/spec/integration/session_spec.rb b/spec/integration/session_spec.rb index 81eb65d9..f86c2e59 100644 --- a/spec/integration/session_spec.rb +++ b/spec/integration/session_spec.rb @@ -9,7 +9,7 @@ describe 'the session', :type => :feature do expect(response).to be_success end it 'logs me in' do - login user.nick, user.password + login user expect(page).to_not have_selector('.alert-error') end it 'does not log me in with wrong password' do diff --git a/spec/support/session_helper.rb b/spec/support/session_helper.rb index c54d3362..66f7f19f 100644 --- a/spec/support/session_helper.rb +++ b/spec/support/session_helper.rb @@ -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