From 27f3046c4f508086a8d573d98e9448bc78f7c713 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire <94526761+natdeanlewissoftwire@users.noreply.github.com> Date: Mon, 10 Oct 2022 09:24:51 +0100 Subject: [PATCH] feat: update linking behaviour (#938) * feat: update linking behaviour * feat: update linking behaviour for jointpur * refactor: improve spacing --- app/models/form/sales/pages/buyer_company.rb | 3 +++ app/models/form/sales/pages/joint_purchase.rb | 5 +++++ spec/models/form/sales/pages/buyer_company_spec.rb | 6 ++++++ spec/models/form/sales/pages/joint_purchase_spec.rb | 8 ++++++++ 4 files changed, 22 insertions(+) diff --git a/app/models/form/sales/pages/buyer_company.rb b/app/models/form/sales/pages/buyer_company.rb index 6985a3908..dae1fecb9 100644 --- a/app/models/form/sales/pages/buyer_company.rb +++ b/app/models/form/sales/pages/buyer_company.rb @@ -5,6 +5,9 @@ class Form::Sales::Pages::BuyerCompany < ::Form::Page @header = "" @description = "" @subsection = subsection + @depends_on = [{ + "ownershipsch" => 3, + }] end def questions diff --git a/app/models/form/sales/pages/joint_purchase.rb b/app/models/form/sales/pages/joint_purchase.rb index fecbff757..d863531ea 100644 --- a/app/models/form/sales/pages/joint_purchase.rb +++ b/app/models/form/sales/pages/joint_purchase.rb @@ -5,6 +5,11 @@ class Form::Sales::Pages::JointPurchase < ::Form::Page @header = "" @description = "" @subsection = subsection + @depends_on = [ + { "ownershipsch" => 1 }, + { "ownershipsch" => 2 }, + { "companybuy" => 2 }, + ] end def questions diff --git a/spec/models/form/sales/pages/buyer_company_spec.rb b/spec/models/form/sales/pages/buyer_company_spec.rb index 94b42c28b..7f7683e02 100644 --- a/spec/models/form/sales/pages/buyer_company_spec.rb +++ b/spec/models/form/sales/pages/buyer_company_spec.rb @@ -26,4 +26,10 @@ RSpec.describe Form::Sales::Pages::BuyerCompany, type: :model do it "has the correct description" do expect(page.description).to eq("") end + + it "has correct depends_on" do + expect(page.depends_on).to eq([{ + "ownershipsch" => 3, + }]) + end end diff --git a/spec/models/form/sales/pages/joint_purchase_spec.rb b/spec/models/form/sales/pages/joint_purchase_spec.rb index eb106e9de..9140b19de 100644 --- a/spec/models/form/sales/pages/joint_purchase_spec.rb +++ b/spec/models/form/sales/pages/joint_purchase_spec.rb @@ -26,4 +26,12 @@ RSpec.describe Form::Sales::Pages::JointPurchase, type: :model do it "has the correct description" do expect(page.description).to eq("") end + + it "has correct depends_on" do + expect(page.depends_on).to eq([ + { "ownershipsch" => 1 }, + { "ownershipsch" => 2 }, + { "companybuy" => 2 }, + ]) + end end