diff --git a/app/views/idv/shared/_back.html.erb b/app/views/idv/shared/_back.html.erb index 88f45338b35..c022091574a 100644 --- a/app/views/idv/shared/_back.html.erb +++ b/app/views/idv/shared/_back.html.erb @@ -11,9 +11,8 @@ locals: * fallback_path: (Optional) Path to redirect absent action, step, and HTTP referer. %> <% text = '‹ ' + t('forms.buttons.back') - step_url = local_assigns[:step_url] || @step_url step = local_assigns[:action] || local_assigns[:step] - path = (step_url && step) ? send(step_url, step: step) : go_back_path + path = go_back_path path ||= local_assigns[:fallback_path] classes = [] classes << local_assigns[:class] if local_assigns[:class] %> diff --git a/spec/views/idv/shared/_back.html.erb_spec.rb b/spec/views/idv/shared/_back.html.erb_spec.rb index 2741c0da966..bd7e24cab3e 100644 --- a/spec/views/idv/shared/_back.html.erb_spec.rb +++ b/spec/views/idv/shared/_back.html.erb_spec.rb @@ -1,7 +1,6 @@ require 'rails_helper' RSpec.describe 'idv/doc_auth/_back.html.erb' do - let(:step_url) { nil } let(:action) { nil } let(:step) { nil } let(:classes) { nil } @@ -9,7 +8,6 @@ subject do render 'idv/shared/back', { - step_url: step_url, action: action, step: step, class: classes, @@ -25,78 +23,6 @@ end end - context 'with step URL in locals' do - let(:step_url) { :idv_in_person_step_url } - - context 'with action' do - let(:action) { 'redo_ssn' } - - it 'renders' do - expect(subject).to have_selector( - "form[action='#{send(:idv_in_person_step_url, step: 'redo_ssn')}']", - ) - expect(subject).to have_selector('input[name="_method"][value="put"]', visible: false) - expect(subject).to have_selector("[type='submit']") - expect(subject).to have_selector('button', text: '‹ ' + t('forms.buttons.back')) - end - - it_behaves_like 'back link with class' - end - - context 'with step' do - let(:step) { 'verify' } - - it 'renders' do - expect(subject).to have_selector( - "a[href='#{send( - :idv_in_person_step_url, - step: 'verify', - )}']", - ) - expect(subject).to have_content('‹ ' + t('forms.buttons.back')) - end - - it_behaves_like 'back link with class' - end - end - - context 'with step URL in instance variable' do - before do - assign(:step_url, :idv_in_person_step_url) - end - - context 'with action' do - let(:action) { 'redo_ssn' } - - it 'renders' do - expect(subject).to have_selector( - "form[action='#{send(:idv_in_person_step_url, step: 'redo_ssn')}']", - ) - expect(subject).to have_selector('input[name="_method"][value="put"]', visible: false) - expect(subject).to have_selector("[type='submit']") - expect(subject).to have_selector('button', text: '‹ ' + t('forms.buttons.back')) - end - - it_behaves_like 'back link with class' - end - - context 'with step' do - let(:step) { 'verify' } - - it 'renders' do - expect(subject).to have_selector( - "a[href='#{send( - :idv_in_person_step_url, - step: 'verify', - )}']", - ) - expect(subject).to have_content('‹ ' + t('forms.buttons.back')) - end - - it_behaves_like 'back link with class' - end - end - context 'with back path' do before do allow(view).to receive(:go_back_path).and_return('/example')