Reduce `RSpec/MultipleExpectations` in captcha feature spec (#29226)

pull/2647/head
Matt Jankowski 2024-02-16 02:52:57 -05:00 committed by GitHub
parent 4b7f04e3ea
commit a9f9b0097b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 7 deletions

View File

@ -19,12 +19,10 @@ describe 'email confirmation flow when captcha is enabled' do
# It presents the user with a captcha form # It presents the user with a captcha form
expect(page).to have_title(I18n.t('auth.captcha_confirmation.title')) expect(page).to have_title(I18n.t('auth.captcha_confirmation.title'))
# It does not confirm the user just yet
expect(user.reload.confirmed?).to be false
# It redirects to app and confirms user # It redirects to app and confirms user
click_on I18n.t('challenge.confirm') expect { click_on I18n.t('challenge.confirm') }
expect(user.reload.confirmed?).to be true .to change { user.reload.confirmed? }.from(false).to(true)
expect(page).to have_current_path(/\A#{client_app.confirmation_redirect_uri}/, url: true) expect(page).to have_current_path(/\A#{client_app.confirmation_redirect_uri}/, url: true)
# Browsers will generally reload the original page upon redirection # Browsers will generally reload the original page upon redirection
@ -32,8 +30,9 @@ describe 'email confirmation flow when captcha is enabled' do
visit "/auth/confirmation?confirmation_token=#{user.confirmation_token}&redirect_to_app=true" visit "/auth/confirmation?confirmation_token=#{user.confirmation_token}&redirect_to_app=true"
# It presents a page with a link to the app callback # It presents a page with a link to the app callback
expect(page).to have_content(I18n.t('auth.confirmations.registration_complete', domain: 'cb6e6126.ngrok.io')) expect(page)
expect(page).to have_link(I18n.t('auth.confirmations.clicking_this_link'), href: client_app.confirmation_redirect_uri) .to have_content(I18n.t('auth.confirmations.registration_complete', domain: 'cb6e6126.ngrok.io'))
.and have_link(I18n.t('auth.confirmations.clicking_this_link'), href: client_app.confirmation_redirect_uri)
end end
end end