From a4d6d164623e6c30196ab64e6efe2fa9641196f4 Mon Sep 17 00:00:00 2001 From: Arthur Campbell <51094020+arfacamble@users.noreply.github.com> Date: Thu, 9 Mar 2023 16:12:22 +0000 Subject: [PATCH] CLDC-1823 change options for unitletas (#1373) * update question options for 23_24, create test file for question that didn't have one * corretc minor linting complaints --- .../form/lettings/pages/property_let_type.rb | 2 +- .../{unitletas.rb => previous_let_type.rb} | 7 ++- .../questions/previous_let_type_spec.rb | 48 +++++++++++++++++++ 3 files changed, 54 insertions(+), 3 deletions(-) rename app/models/form/lettings/questions/{unitletas.rb => previous_let_type.rb} (63%) create mode 100644 spec/models/form/lettings/questions/previous_let_type_spec.rb diff --git a/app/models/form/lettings/pages/property_let_type.rb b/app/models/form/lettings/pages/property_let_type.rb index 1f31af370..f4d629b9e 100644 --- a/app/models/form/lettings/pages/property_let_type.rb +++ b/app/models/form/lettings/pages/property_let_type.rb @@ -6,6 +6,6 @@ class Form::Lettings::Pages::PropertyLetType < ::Form::Page end def questions - @questions ||= [Form::Lettings::Questions::Unitletas.new(nil, nil, self)] + @questions ||= [Form::Lettings::Questions::PreviousLetType.new(nil, nil, self)] end end diff --git a/app/models/form/lettings/questions/unitletas.rb b/app/models/form/lettings/questions/previous_let_type.rb similarity index 63% rename from app/models/form/lettings/questions/unitletas.rb rename to app/models/form/lettings/questions/previous_let_type.rb index e37a07b34..c685140e6 100644 --- a/app/models/form/lettings/questions/unitletas.rb +++ b/app/models/form/lettings/questions/previous_let_type.rb @@ -1,4 +1,4 @@ -class Form::Lettings::Questions::Unitletas < ::Form::Question +class Form::Lettings::Questions::PreviousLetType < ::Form::Question def initialize(id, hsh, page) super @id = "unitletas" @@ -13,7 +13,10 @@ class Form::Lettings::Questions::Unitletas < ::Form::Question ANSWER_OPTIONS = { "1" => { "value" => "Social rent basis" }, "2" => { "value" => "Affordable rent basis" }, - "4" => { "value" => "Intermediate rent basis" }, + "5" => { "value" => "A London Affordable Rent basis" }, + "6" => { "value" => "A Rent to Buy basis" }, + "7" => { "value" => "A London Living Rent basis" }, + "8" => { "value" => "Another Intermediate Rent basis" }, "divider" => { "value" => true }, "3" => { "value" => "Don’t know" }, }.freeze diff --git a/spec/models/form/lettings/questions/previous_let_type_spec.rb b/spec/models/form/lettings/questions/previous_let_type_spec.rb new file mode 100644 index 000000000..b18bbc88a --- /dev/null +++ b/spec/models/form/lettings/questions/previous_let_type_spec.rb @@ -0,0 +1,48 @@ +require "rails_helper" + +RSpec.describe Form::Lettings::Questions::PreviousLetType, type: :model do + subject(:question) { described_class.new(nil, nil, page) } + + let(:page) { instance_double(Form::Page) } + + it "has correct page" do + expect(question.page).to eq page + end + + it "has the correct id" do + expect(question.id).to eq "unitletas" + end + + it "has the correct header" do + expect(question.header).to eq "What type was the property most recently let as?" + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq "Most recent let type" + end + + it "has the correct type" do + expect(question.type).to eq "radio" + end + + it "has the correct hint_text" do + expect(question.hint_text).to eq "" + end + + it "is not marked as derived" do + expect(question.derived?).to be false + end + + it "has the correct answer options" do + expect(question.answer_options).to eq({ + "1" => { "value" => "Social rent basis" }, + "2" => { "value" => "Affordable rent basis" }, + "5" => { "value" => "A London Affordable Rent basis" }, + "6" => { "value" => "A Rent to Buy basis" }, + "7" => { "value" => "A London Living Rent basis" }, + "8" => { "value" => "Another Intermediate Rent basis" }, + "divider" => { "value" => true }, + "3" => { "value" => "Don’t know" }, + }) + end +end