diff --git a/app/views/idv/session_errors/warning.html.erb b/app/views/idv/session_errors/warning.html.erb index 34a91cf6760..9ff34b5fadc 100644 --- a/app/views/idv/session_errors/warning.html.erb +++ b/app/views/idv/session_errors/warning.html.erb @@ -12,7 +12,7 @@ <% c.troubleshooting_options do |tc| %> <% tc.header { t('components.troubleshooting_options.default_heading') } %> - <% if user_session.dig(:'idv/doc_auth', :had_barcode_read_failure) %> + <% if user_session&.dig(:'idv/doc_auth', :had_barcode_read_failure) %> <% tc.option( url: idv_doc_auth_step_path(step: :redo_document_capture), action: FormLinkComponent.method(:new), diff --git a/spec/views/idv/session_errors/warning.html.erb_spec.rb b/spec/views/idv/session_errors/warning.html.erb_spec.rb index c567b408b2f..ec6fa5e6aaf 100644 --- a/spec/views/idv/session_errors/warning.html.erb_spec.rb +++ b/spec/views/idv/session_errors/warning.html.erb_spec.rb @@ -52,4 +52,17 @@ ) end end + + context 'with a nil user_session' do + let(:user_session) { nil } + + it 'does not render troubleshooting option to retake photos' do + expect(rendered).to have_link(t('idv.failure.button.warning'), href: try_again_path) + expect(rendered).to_not have_content(t('components.troubleshooting_options.default_heading')) + expect(rendered).to_not have_link( + t('idv.troubleshooting.options.add_new_photos'), + href: idv_doc_auth_step_path(step: :redo_document_capture), + ) + end + end end