From da41dd64970accbf4b2213bd18eac8e51cfba3bf Mon Sep 17 00:00:00 2001 From: Graeme Porteous Date: Wed, 3 Jan 2024 11:37:12 +0000 Subject: [PATCH] Update spec login helper Allow specs to specify params for the signin path. EG. `r: '/help'` will redirect to the help pages instead of the homepage after login. This is useful in theme specs. For example with WDTK theme the homepage might attempt to load remote content which isn't stubbed. --- spec/integration/alaveteli_dsl.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/integration/alaveteli_dsl.rb b/spec/integration/alaveteli_dsl.rb index 4314d3f9f3..4db60f8cd4 100644 --- a/spec/integration/alaveteli_dsl.rb +++ b/spec/integration/alaveteli_dsl.rb @@ -106,10 +106,10 @@ def using_pro_session(session_id) end end -def login(user) +def login(user, **params) u = user.is_a?(User) ? user : users(user) alaveteli_session(u.id) do - visit 'en/profile/sign_in' + visit signin_path(locale: 'en', **params) within '#signin_form' do fill_in "Your e-mail:", with: u.email fill_in "Password:", with: "jonespassword"