From 0fb9c123c971d95035f40849df9a4db0d3180bd6 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 6 Nov 2018 17:06:45 +0100 Subject: [PATCH] invite: mutualize feature helper for signing in --- spec/features/new_user/invite_spec.rb | 10 ++-------- spec/support/feature_helpers.rb | 6 ++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/features/new_user/invite_spec.rb b/spec/features/new_user/invite_spec.rb index 31e876e1e..e92f1ba3e 100644 --- a/spec/features/new_user/invite_spec.rb +++ b/spec/features/new_user/invite_spec.rb @@ -102,16 +102,10 @@ feature 'Invitations' do def log_in(user) visit '/' click_on 'Connexion' - submit_login_form(user.email, user.password) + sign_in_with(user.email, user.password) expect(page).to have_current_path(dossiers_path) end - def submit_login_form(email, password) - fill_in 'user_email', with: email - fill_in 'user_password', with: password - click_on 'Se connecter' - end - def navigate_to_brouillon(dossier) expect(page).to have_current_path(dossiers_path) click_on(dossier.id) @@ -127,7 +121,7 @@ feature 'Invitations' do def navigate_to_invited_dossier(invite) visit users_dossiers_invite_path(invite) expect(page).to have_current_path(new_user_session_path) - submit_login_form(invited_user.email, invited_user.password) + sign_in_with(invited_user.email, invited_user.password) end def send_invite_to(invited_email) diff --git a/spec/support/feature_helpers.rb b/spec/support/feature_helpers.rb index 2e59ec736..9ef96c624 100644 --- a/spec/support/feature_helpers.rb +++ b/spec/support/feature_helpers.rb @@ -14,6 +14,12 @@ module FeatureHelpers dossier = FactoryBot.create(:dossier) dossier end + + def sign_in_with(email, password) + fill_in :user_email, with: email + fill_in :user_password, with: password + click_on 'Se connecter' + end end RSpec.configure do |config|