From 7b43250c565618fe0dbf9e2c66cda7f14faf9d3e Mon Sep 17 00:00:00 2001 From: Arthur Campbell <51094020+arfacamble@users.noreply.github.com> Date: Fri, 3 Mar 2023 09:41:59 +0000 Subject: [PATCH] CLDC-1850 add don't know option to buyer 1 previous tenure (#1345) * add don't know option to buyer 1 previous tenure * some minor tidying and reformatiing --- .../sales/questions/buyer1_previous_tenure.rb | 25 +++++++++++-------- .../pages/buyer1_previous_tenure_spec.rb | 4 +-- .../questions/buyer1_previous_tenure_spec.rb | 5 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/models/form/sales/questions/buyer1_previous_tenure.rb b/app/models/form/sales/questions/buyer1_previous_tenure.rb index b41fbbabd..f3482a03f 100644 --- a/app/models/form/sales/questions/buyer1_previous_tenure.rb +++ b/app/models/form/sales/questions/buyer1_previous_tenure.rb @@ -5,17 +5,20 @@ class Form::Sales::Questions::Buyer1PreviousTenure < ::Form::Question @check_answer_label = "Buyer 1’s previous tenure" @header = "What was buyer 1’s previous tenure?" @type = "radio" - @answer_options = ANSWER_OPTIONS + @answer_options = answer_options end - ANSWER_OPTIONS = { - "1" => { "value" => "Local Authority" }, - "2" => { "value" => "Private registered provider or housing association tenant" }, - "3" => { "value" => "Private tenant" }, - "5" => { "value" => "Owner occupier" }, - "4" => { "value" => "Tied home or renting with job" }, - "6" => { "value" => "Living with family or friends" }, - "7" => { "value" => "Temporary accomodation" }, - "9" => { "value" => "Other" }, - }.freeze + def answer_options + { + "1" => { "value" => "Local Authority" }, + "2" => { "value" => "Private registered provider or housing association tenant" }, + "3" => { "value" => "Private tenant" }, + "5" => { "value" => "Owner occupier" }, + "4" => { "value" => "Tied home or renting with job" }, + "6" => { "value" => "Living with family or friends" }, + "7" => { "value" => "Temporary accomodation" }, + "9" => { "value" => "Other" }, + "0" => { "value" => "Don’t know" }, + } + end end diff --git a/spec/models/form/sales/pages/buyer1_previous_tenure_spec.rb b/spec/models/form/sales/pages/buyer1_previous_tenure_spec.rb index e38f287f5..a67fa3e16 100644 --- a/spec/models/form/sales/pages/buyer1_previous_tenure_spec.rb +++ b/spec/models/form/sales/pages/buyer1_previous_tenure_spec.rb @@ -1,10 +1,8 @@ require "rails_helper" RSpec.describe Form::Sales::Pages::Buyer1PreviousTenure, type: :model do - subject(:page) { described_class.new(page_id, page_definition, subsection) } + subject(:page) { described_class.new(nil, nil, subsection) } - let(:page_id) { nil } - let(:page_definition) { nil } let(:subsection) { instance_double(Form::Subsection) } it "has correct subsection" do diff --git a/spec/models/form/sales/questions/buyer1_previous_tenure_spec.rb b/spec/models/form/sales/questions/buyer1_previous_tenure_spec.rb index a63b695a5..4321700b4 100644 --- a/spec/models/form/sales/questions/buyer1_previous_tenure_spec.rb +++ b/spec/models/form/sales/questions/buyer1_previous_tenure_spec.rb @@ -1,10 +1,8 @@ require "rails_helper" RSpec.describe Form::Sales::Questions::Buyer1PreviousTenure, type: :model do - subject(:question) { described_class.new(question_id, question_definition, page) } + subject(:question) { described_class.new(nil, nil, page) } - let(:question_id) { nil } - let(:question_definition) { nil } let(:page) { instance_double(Form::Page) } let(:log) { create(:sales_log) } @@ -42,6 +40,7 @@ RSpec.describe Form::Sales::Questions::Buyer1PreviousTenure, type: :model do "6" => { "value" => "Living with family or friends" }, "7" => { "value" => "Temporary accomodation" }, "9" => { "value" => "Other" }, + "0" => { "value" => "Don’t know" }, }) end end