Skip to content

Commit

Permalink
Update more routing and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kosiakkatrina committed Feb 24, 2025
1 parent 3314ad0 commit ea3c35d
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 12 deletions.
9 changes: 6 additions & 3 deletions app/models/form/lettings/pages/no_address_found.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ def initialize(id, hsh, subsection)
"arguments" => [],
}
@depends_on = [
{ "is_supported_housing?" => false, "uprn_known" => nil, "address_options_present?" => false, "is_new_build?" => false },
{ "is_supported_housing?" => false, "uprn_known" => 0, "address_options_present?" => false, "is_new_build?" => false },
{ "is_supported_housing?" => false, "uprn_confirmed" => 0, "address_options_present?" => false, "is_new_build?" => false },
{ "is_supported_housing?" => false, "uprn_known" => nil, "address_options_present?" => false, "is_new_build?" => false, "form.start_year_2025_or_later?" => true },
{ "is_supported_housing?" => false, "uprn_known" => 0, "address_options_present?" => false, "is_new_build?" => false, "form.start_year_2025_or_later?" => true },
{ "is_supported_housing?" => false, "uprn_confirmed" => 0, "address_options_present?" => false, "is_new_build?" => false, "form.start_year_2025_or_later?" => true },
{ "is_supported_housing?" => false, "uprn_known" => nil, "address_options_present?" => false, "form.start_year_2025_or_later?" => false },
{ "is_supported_housing?" => false, "uprn_known" => 0, "address_options_present?" => false, "form.start_year_2025_or_later?" => false },
{ "is_supported_housing?" => false, "uprn_confirmed" => 0, "address_options_present?" => false, "form.start_year_2025_or_later?" => false },
]
end

Expand Down
9 changes: 8 additions & 1 deletion app/models/form/lettings/pages/uprn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ def initialize(id, hsh, subsection)
super
@id = "uprn"
@copy_key = "lettings.property_information.uprn"
@depends_on = [{ "is_supported_housing?" => false, "is_new_build?" => false }]
end

def questions
Expand All @@ -30,4 +29,12 @@ def skip_href(log = nil)
"address"
end
end

def routed_to?(log, _)
return false unless super
return false if log.is_supported_housing?
return false if log.is_new_build? && log.form.start_year_2025_or_later?

true
end
end
21 changes: 18 additions & 3 deletions spec/models/form/lettings/pages/no_address_found_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,30 @@
expect(page.depends_on).to eq([{ "address_options_present?" => false,
"is_supported_housing?" => false,
"uprn_known" => nil,
"is_new_build?" => false },
"is_new_build?" => false,
"form.start_year_2025_or_later?" => true },
{ "address_options_present?" => false,
"is_supported_housing?" => false,
"uprn_known" => 0,
"is_new_build?" => false },
"is_new_build?" => false,
"form.start_year_2025_or_later?" => true },
{ "address_options_present?" => false,
"is_supported_housing?" => false,
"uprn_confirmed" => 0,
"is_new_build?" => false }])
"is_new_build?" => false,
"form.start_year_2025_or_later?" => true },
{ "address_options_present?" => false,
"is_supported_housing?" => false,
"uprn_known" => nil,
"form.start_year_2025_or_later?" => false },
{ "address_options_present?" => false,
"is_supported_housing?" => false,
"uprn_known" => 0,
"form.start_year_2025_or_later?" => false },
{ "address_options_present?" => false,
"is_supported_housing?" => false,
"uprn_confirmed" => 0,
"form.start_year_2025_or_later?" => false }])
end

it "is interruption screen page" do
Expand Down
4 changes: 0 additions & 4 deletions spec/models/form/lettings/pages/uprn_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
expect(page.description).to be_nil
end

it "has correct depends_on" do
expect(page.depends_on).to eq([{ "is_supported_housing?" => false, "is_new_build?" => false }])
end

describe "has correct skip_href" do
context "when log is nil" do
it "is nil" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@

field_89: "2",

field_100: "5",
field_100: "6",
field_101: "2",
field_102: "31",
field_104: "3",
Expand Down

0 comments on commit ea3c35d

Please sign in to comment.