From b86eeb60fb6a514ab1e19f677273996cd5705ce0 Mon Sep 17 00:00:00 2001 From: Kat Date: Fri, 13 Jan 2023 13:10:52 +0000 Subject: [PATCH] Only display local authority question if the la is not inferred --- app/models/form/sales/pages/property_local_authority.rb | 3 +++ .../form/sales/pages/property_local_authority_spec.rb | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/app/models/form/sales/pages/property_local_authority.rb b/app/models/form/sales/pages/property_local_authority.rb index 0fc05b6d7..7e63b2f6c 100644 --- a/app/models/form/sales/pages/property_local_authority.rb +++ b/app/models/form/sales/pages/property_local_authority.rb @@ -2,6 +2,9 @@ class Form::Sales::Pages::PropertyLocalAuthority < ::Form::Page def initialize(id, hsh, subsection) super @id = "property_local_authority" + @depends_on = [{ + "is_la_inferred" => false, + }] end def questions diff --git a/spec/models/form/sales/pages/property_local_authority_spec.rb b/spec/models/form/sales/pages/property_local_authority_spec.rb index 0cf653a80..3c88a0cd6 100644 --- a/spec/models/form/sales/pages/property_local_authority_spec.rb +++ b/spec/models/form/sales/pages/property_local_authority_spec.rb @@ -31,4 +31,10 @@ RSpec.describe Form::Sales::Pages::PropertyLocalAuthority, type: :model do it "has the correct description" do expect(page.description).to be_nil end + + it "has the correct depends_on" do + expect(page.depends_on).to eq([{ + "is_la_inferred" => false, + }]) + end end