Skip to content

Commit

Permalink
Pass data_request_area in test
Browse files Browse the repository at this point in the history
  • Loading branch information
vertism committed Dec 13, 2024
1 parent a7eb17e commit 1dc0b66
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/models/commissioning_document_template/prison.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def context
aliases: kase.subject_aliases,
date_range: data_request_area.request_dates,
deadline:,
data_required: data_request_area.data_requests.first.decorate.data_required || default_data_required,
data_required: data_request_area.data_requests.first&.decorate&.data_required || default_data_required,
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/commissioning_document_template/probation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def context
crn: kase.case_reference_number,
date_range: data_request_area.request_dates,
deadline:,
data_required: data_request_area.data_requests.first.decorate.data_required || default_data_required,
data_required: data_request_area.data_requests.first&.decorate&.data_required || default_data_required,
)
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/models/commissioning_document_template/prison_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "rails_helper"

RSpec.describe CommissioningDocumentTemplate::Prison do
subject(:template) { described_class.new(data_request_area: data_request) }
subject(:template) { described_class.new(data_request_area:) }

let(:kase) do
build_stubbed(:offender_sar_case,
Expand All @@ -11,7 +11,7 @@
subject_aliases: "Bad Bob",
prison_number: "AB12345")
end
let(:data_request) { build_stubbed(:data_request, offender_sar_case: kase) }
let(:data_request_area) { build_stubbed(:data_request_area, offender_sar_case: kase) }

describe "#path" do
it "matches to a file" do
Expand Down
4 changes: 2 additions & 2 deletions spec/models/commissioning_document_template/probation_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "rails_helper"

RSpec.describe CommissioningDocumentTemplate::Probation do
subject(:template) { described_class.new(data_request_area: data_request) }
subject(:template) { described_class.new(data_request_area:) }

let(:kase) do
build_stubbed(:offender_sar_case,
Expand All @@ -12,7 +12,7 @@
other_subject_ids: "CD98765",
case_reference_number: "EF45678")
end
let(:data_request) { build_stubbed(:data_request, offender_sar_case: kase) }
let(:data_request_area) { build_stubbed(:data_request_area, offender_sar_case: kase) }

describe "#path" do
it "matches to a file" do
Expand Down

0 comments on commit 1dc0b66

Please sign in to comment.