Browse Source

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
CLDC-1917-allow-23-24-form^2
Arthur Campbell 2 years ago committed by GitHub
parent
commit
a4d6d16462
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/models/form/lettings/pages/property_let_type.rb
  2. 7
      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
def questions
@questions ||= [Form::Lettings::Questions::Unitletas.new(nil, nil, self)]
@questions ||= [Form::Lettings::Questions::PreviousLetType.new(nil, nil, self)]
end
end

7
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)
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

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