Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/views/idv/cancellations/destroy.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ ul class="list-reset #{@presenter.state_color}-dots"
- @presenter.cancellation_effects.each do |effect|
li = effect

.mt2 = link_to t('idv.cancel.return_to_account'), account_path
- if decorated_session.sp_name
.mt2 = link_to "‹ #{t('links.back_to_sp', sp: decorated_session.sp_name)}",
decorated_session.failure_to_proof_url
- else
.mt2 = link_to "‹ #{t('links.back_to_sp', sp: t('links.my_account'))}", account_url
1 change: 0 additions & 1 deletion config/locales/idv/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ en:
send_confirmation_code: Continue
cancel:
modal_header: Are you sure you want to cancel?
return_to_account: Return to account
warning_header: If you cancel now
warnings:
warning_1: We won't be able to verify your identity
Expand Down
1 change: 0 additions & 1 deletion config/locales/idv/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ es:
send_confirmation_code: NOT TRANSLATED YET
cancel:
modal_header: "¿Está seguro que desea cancelar?"
return_to_account: NOT TRANSLATED YET
warning_header: Si usted cancela ahora
warnings:
warning_1: NOT TRANSLATED YET
Expand Down
1 change: 0 additions & 1 deletion config/locales/idv/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ fr:
send_confirmation_code: NOT TRANSLATED YET
cancel:
modal_header: Souhaitez-vous vraiment annuler?
return_to_account: NOT TRANSLATED YET
warning_header: Si vous annulez maintenant
warnings:
warning_1: NOT TRANSLATED YET
Expand Down
1 change: 1 addition & 0 deletions config/locales/links/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ en:
create_account: Create account
go_back: Go back
help: Help
my_account: my account
next: Next
passwords:
forgot: Forgot your password?
Expand Down
1 change: 1 addition & 0 deletions config/locales/links/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ es:
create_account: Crear cuenta
go_back: Regresa
help: Ayuda
my_account: mi cuenta
next: Siguiente
passwords:
forgot: "¿Olvidó su contraseña?"
Expand Down
1 change: 1 addition & 0 deletions config/locales/links/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ fr:
create_account: Créer un compte
go_back: Retourner
help: Aide
my_account: mon compte
next: Suivant
passwords:
forgot: Vous avez oublié votre mot de passe?
Expand Down
55 changes: 44 additions & 11 deletions spec/support/idv_examples/cancel_at_idv_step.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,53 @@
expect(current_path).to eq(original_path)
end

it 'shows the user a cancellation message with the option to cancel and reset idv' do
click_link t('links.cancel')
context 'with an sp', if: sp do
it 'shows the user a cancellation message with the option to cancel and reset idv' do
failure_to_proof_url = 'https://www.example.com/failure'
sp_name = 'Test SP'
allow_any_instance_of(ServiceProviderSessionDecorator).to receive(:failure_to_proof_url).
and_return(failure_to_proof_url)
allow_any_instance_of(ServiceProviderSessionDecorator).to receive(:sp_name).
and_return(sp_name)

expect(page).to have_content(t('idv.cancel.modal_header'))
expect(current_path).to eq(idv_cancel_path)
click_link t('links.cancel')

click_on t('forms.buttons.cancel')
expect(page).to have_content(t('idv.cancel.modal_header'))
expect(current_path).to eq(idv_cancel_path)

expect(page).to have_content(t('headings.cancellations.confirmation'))
expect(current_path).to eq(idv_cancel_path)
click_on t('forms.buttons.cancel')

expect(page).to have_content(t('headings.cancellations.confirmation'))
expect(current_path).to eq(idv_cancel_path)

expect(page).to have_link("‹ #{t('links.back_to_sp', sp: sp_name)}",
href: failure_to_proof_url)

# After visiting /verify, expect to redirect to the jurisdiction step,
# the first step in the IdV flow
visit idv_path
expect(current_path).to eq(idv_jurisdiction_path)
end
end

context 'without an sp' do
it 'shows a cancellation message with option to cancel and reset idv', if: sp.nil? do
click_link t('links.cancel')

expect(page).to have_content(t('idv.cancel.modal_header'))
expect(current_path).to eq(idv_cancel_path)

click_on t('forms.buttons.cancel')

expect(page).to have_content(t('headings.cancellations.confirmation'))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we were going to provide a link to go back to the account page in this scenario.

Copy link
Copy Markdown
Contributor

@monfresh monfresh Sep 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we want to make sure that in this scenario, there aren't any links to go back to the SP, but because this is a shared example, this test will fail in some cases. The solution is to skip this test if there is an SP defined, by using RSpec's conditional filters:

context 'without an sp' do
  it 'shows the user a cancellation message', if: sp.nil? do
    ...
  end
end

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Was looking good and then all hell broke loose after rebasing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done done.

expect(current_path).to eq(idv_cancel_path)
expect(page).to have_link("‹ #{t('links.back_to_sp', sp: t('links.my_account'))}",
href: account_url)

# After visiting /verify, expect to redirect to the jurisdiction step,
# the first step in the IdV flow
visit idv_path
expect(current_path).to eq(idv_jurisdiction_path)
# After visiting /verify, expect to redirect to the jurisdiction step,
# the first step in the IdV flow
visit idv_path
expect(current_path).to eq(idv_jurisdiction_path)
end
end
end