Skip to content

Commit

Permalink
Update spec login helper
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gbp committed Jan 3, 2024
1 parent e15d9bc commit da41dd6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spec/integration/alaveteli_dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit da41dd6

Please sign in to comment.