Skip to content

Commit 068c8ab

Browse files
authored
Prevent hub/documents confirm page from crashing if there is no tax return (#6167)
1 parent 8131834 commit 068c8ab

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

app/views/hub/documents/confirm.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<%= t("hub.documents.confirm.text_html",
1010
document_type: @document.document_type,
1111
client_name: @document.client.legal_name,
12-
filing_year: @document.tax_return.year
12+
filing_year: @document.tax_return&.year
1313
)
1414
%>
1515
</p>

spec/controllers/hub/documents_controller_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,21 @@
488488
end
489489
end
490490

491+
describe "#confirm" do
492+
context "with an authenticated user" do
493+
before { sign_in(user) }
494+
let!(:document) { create :document, client: client, tax_return_id: nil }
495+
496+
context "with no tax return" do
497+
it "returns 200 OK" do
498+
get :confirm, params: { client_id: client.id, id: document.id }
499+
500+
expect(response).to be_ok
501+
end
502+
end
503+
end
504+
end
505+
491506
describe "#rerun_screener" do
492507
let!(:document) { create :document, intake: client.intake }
493508
let(:params) do

0 commit comments

Comments
 (0)