Browse Source

update question options for 23_24, create test file for question that didn't have one

pull/1373/head
Arthur Campbell 3 years ago
parent
commit
89587002b0
  1. 2
      app/models/form/lettings/pages/property_let_type.rb
  2. 9
      app/models/form/lettings/questions/previous_let_type.rb
  3. 48
      spec/models/form/lettings/questions/previous_let_type_spec.rb

2
app/models/form/lettings/pages/property_let_type.rb

@ -6,6 +6,6 @@ class Form::Lettings::Pages::PropertyLetType < ::Form::Page
end end
def questions def questions
@questions ||= [Form::Lettings::Questions::Unitletas.new(nil, nil, self)] @questions ||= [Form::Lettings::Questions::PreviousLetType.new(nil, nil, self)]
end end
end end

9
app/models/form/lettings/questions/unitletas.rb → 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) def initialize(id, hsh, page)
super super
@id = "unitletas" @id = "unitletas"
@ -13,8 +13,11 @@ class Form::Lettings::Questions::Unitletas < ::Form::Question
ANSWER_OPTIONS = { ANSWER_OPTIONS = {
"1" => { "value" => "Social rent basis" }, "1" => { "value" => "Social rent basis" },
"2" => { "value" => "Affordable 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 }, "divider" => { "value" => true },
"3" => { "value" => "Don’t know" }, "3" => { "value" => "Don’t know" },
}.freeze }
end end

48
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
Loading…
Cancel
Save