Skip to content

Commit

Permalink
remove unused FSM step url from back button view
Browse files Browse the repository at this point in the history
  • Loading branch information
jennyverdeyen committed Dec 3, 2024
1 parent 328ead7 commit f9d621b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 76 deletions.
3 changes: 1 addition & 2 deletions app/views/idv/shared/_back.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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] %>
Expand Down
74 changes: 0 additions & 74 deletions spec/views/idv/shared/_back.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
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 }
let(:fallback_path) { nil }

subject do
render 'idv/shared/back', {
step_url: step_url,
action: action,
step: step,
class: classes,
Expand All @@ -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')
Expand Down

0 comments on commit f9d621b

Please sign in to comment.