From 7109fe723cc9fa6cb8a5b85fb4c53f9a0672b1b0 Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 20 Mar 2023 12:40:29 +0000 Subject: [PATCH] Add hidden don't know options to soctenant and fromprop --- app/models/form/sales/questions/buyer_previous.rb | 8 ++++++++ app/models/form/sales/questions/fromprop.rb | 11 +++++++++++ .../form/sales/questions/buyer_previous_spec.rb | 8 ++++++++ spec/models/form/sales/questions/fromprop_spec.rb | 11 +++++++++++ 4 files changed, 38 insertions(+) diff --git a/app/models/form/sales/questions/buyer_previous.rb b/app/models/form/sales/questions/buyer_previous.rb index 4a851a487..aaea81cfc 100644 --- a/app/models/form/sales/questions/buyer_previous.rb +++ b/app/models/form/sales/questions/buyer_previous.rb @@ -12,5 +12,13 @@ class Form::Sales::Questions::BuyerPrevious < ::Form::Question ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "2" => { "value" => "No" }, + "0" => { "value" => "Don’t know" }, }.freeze + + def displayed_answer_options(_log, _user = nil) + { + "1" => { "value" => "Yes" }, + "2" => { "value" => "No" }, + } + end end diff --git a/app/models/form/sales/questions/fromprop.rb b/app/models/form/sales/questions/fromprop.rb index 88abc6b1b..9d35a4ae3 100644 --- a/app/models/form/sales/questions/fromprop.rb +++ b/app/models/form/sales/questions/fromprop.rb @@ -17,5 +17,16 @@ class Form::Sales::Questions::Fromprop < ::Form::Question "3" => { "value" => "House" }, "4" => { "value" => "Bungalow" }, "9" => { "value" => "Other" }, + "0" => { "value" => "Don’t know" }, }.freeze + + def displayed_answer_options(_log, _user = nil) + { + "1" => { "value" => "Flat or maisonette" }, + "2" => { "value" => "Bedsit" }, + "3" => { "value" => "House" }, + "4" => { "value" => "Bungalow" }, + "9" => { "value" => "Other" }, + } + end end diff --git a/spec/models/form/sales/questions/buyer_previous_spec.rb b/spec/models/form/sales/questions/buyer_previous_spec.rb index a1348f17b..06aaca38f 100644 --- a/spec/models/form/sales/questions/buyer_previous_spec.rb +++ b/spec/models/form/sales/questions/buyer_previous_spec.rb @@ -46,10 +46,18 @@ RSpec.describe Form::Sales::Questions::BuyerPrevious, type: :model do expect(question.derived?).to be false end + it "has the correct displayed_answer_options" do + expect(question.displayed_answer_options(nil)).to eq({ + "1" => { "value" => "Yes" }, + "2" => { "value" => "No" }, + }) + end + it "has the correct answer_options" do expect(question.answer_options).to eq({ "1" => { "value" => "Yes" }, "2" => { "value" => "No" }, + "0" => { "value" => "Don’t know" }, }) end diff --git a/spec/models/form/sales/questions/fromprop_spec.rb b/spec/models/form/sales/questions/fromprop_spec.rb index ebfa218c5..c9aaa60b9 100644 --- a/spec/models/form/sales/questions/fromprop_spec.rb +++ b/spec/models/form/sales/questions/fromprop_spec.rb @@ -35,6 +35,16 @@ RSpec.describe Form::Sales::Questions::Fromprop, type: :model do expect(question.hint_text).to eq("") end + it "has the correct displayed_answer_options" do + expect(question.displayed_answer_options(nil)).to eq({ + "1" => { "value" => "Flat or maisonette" }, + "2" => { "value" => "Bedsit" }, + "3" => { "value" => "House" }, + "4" => { "value" => "Bungalow" }, + "9" => { "value" => "Other" }, + }) + end + it "has the correct answer_options" do expect(question.answer_options).to eq({ "1" => { "value" => "Flat or maisonette" }, @@ -42,6 +52,7 @@ RSpec.describe Form::Sales::Questions::Fromprop, type: :model do "3" => { "value" => "House" }, "4" => { "value" => "Bungalow" }, "9" => { "value" => "Other" }, + "0" => { "value" => "Don’t know" }, }) end end