From fa415916ef099e202d49d315dbf6120b1a38d308 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Mon, 9 Jan 2023 08:54:28 +0000 Subject: [PATCH] Conditionally display mortgage amount (#1158) --- app/models/form/sales/pages/mortgage_amount.rb | 3 +++ spec/models/form/sales/pages/mortgage_amount_spec.rb | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/form/sales/pages/mortgage_amount.rb b/app/models/form/sales/pages/mortgage_amount.rb index 1c80b2f52..88f642042 100644 --- a/app/models/form/sales/pages/mortgage_amount.rb +++ b/app/models/form/sales/pages/mortgage_amount.rb @@ -4,6 +4,9 @@ class Form::Sales::Pages::MortgageAmount < ::Form::Page @header = "Mortgage Amount" @description = "" @subsection = subsection + @depends_on = [{ + "mortgageused" => 1, + }] end def questions diff --git a/spec/models/form/sales/pages/mortgage_amount_spec.rb b/spec/models/form/sales/pages/mortgage_amount_spec.rb index 28c37908b..4df02d1af 100644 --- a/spec/models/form/sales/pages/mortgage_amount_spec.rb +++ b/spec/models/form/sales/pages/mortgage_amount_spec.rb @@ -28,6 +28,8 @@ RSpec.describe Form::Sales::Pages::MortgageAmount, type: :model do end it "has correct depends_on" do - expect(page.depends_on).to be_nil + expect(page.depends_on).to eq([{ + "mortgageused" => 1, + }]) end end