diff --git a/app/models/form/lettings/pages/property_wheelchair_accessible.rb b/app/models/form/lettings/pages/property_wheelchair_accessible.rb index 5f12fb06c..e5d673ef0 100644 --- a/app/models/form/lettings/pages/property_wheelchair_accessible.rb +++ b/app/models/form/lettings/pages/property_wheelchair_accessible.rb @@ -2,10 +2,10 @@ class Form::Lettings::Pages::PropertyWheelchairAccessible < ::Form::Page def initialize(id, hsh, subsection) super @id = "property_wheelchair_accessible" - @depends_on = [{ "needstype" => 1 }] + @depends_on = [{ "is_supported_housing?" => false }] end def questions - @questions ||= [Form::Lettings::Questions::Wchair.new(nil, nil, self)] + @questions ||= [Form::Lettings::Questions::Wheelchair.new(nil, nil, self)] end end diff --git a/app/models/form/lettings/questions/voiddate.rb b/app/models/form/lettings/questions/voiddate.rb index 843191660..78e57c1ee 100644 --- a/app/models/form/lettings/questions/voiddate.rb +++ b/app/models/form/lettings/questions/voiddate.rb @@ -6,6 +6,5 @@ class Form::Lettings::Questions::Voiddate < ::Form::Question @header = "What is the void or renewal date?" @type = "date" @check_answers_card_number = 0 - @hint_text = "For example, 27 3 2021." end end diff --git a/app/models/form/lettings/questions/wchair.rb b/app/models/form/lettings/questions/wheelchair.rb similarity index 68% rename from app/models/form/lettings/questions/wchair.rb rename to app/models/form/lettings/questions/wheelchair.rb index 1acf2705d..a841c9b66 100644 --- a/app/models/form/lettings/questions/wchair.rb +++ b/app/models/form/lettings/questions/wheelchair.rb @@ -1,4 +1,4 @@ -class Form::Lettings::Questions::Wchair < ::Form::Question +class Form::Lettings::Questions::Wheelchair < ::Form::Question def initialize(id, hsh, page) super @id = "wchair" @@ -10,5 +10,8 @@ class Form::Lettings::Questions::Wchair < ::Form::Question @answer_options = ANSWER_OPTIONS end - ANSWER_OPTIONS = { "1" => { "value" => "Yes" }, "2" => { "value" => "No" } }.freeze + ANSWER_OPTIONS = { + "1" => { "value" => "Yes" }, + "2" => { "value" => "No" }, + }.freeze end diff --git a/db/schema.rb b/db/schema.rb index 2880ecd2d..afa0b6b74 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -490,7 +490,6 @@ ActiveRecord::Schema[7.0].define(version: 2023_03_01_144555) do t.integer "prevten" t.integer "mortgageused" t.integer "wchair" - t.integer "income2_value_check" t.integer "armedforcesspouse" t.datetime "hodate", precision: nil t.integer "hoday" @@ -515,13 +514,14 @@ ActiveRecord::Schema[7.0].define(version: 2023_03_01_144555) do t.integer "retirement_value_check" t.integer "hodate_check" t.integer "extrabor_value_check" + t.integer "grant_value_check" + t.integer "staircase_bought_value_check" t.integer "deposit_and_mortgage_value_check" t.integer "shared_ownership_deposit_value_check" - t.integer "grant_value_check" - t.integer "value_value_check" t.integer "old_persons_shared_ownership_value_check" - t.integer "staircase_bought_value_check" + t.integer "income2_value_check" t.integer "monthly_charges_value_check" + t.integer "value_value_check" t.integer "details_known_5" t.integer "details_known_6" t.integer "saledate_check" diff --git a/spec/models/form/lettings/pages/property_wheelchair_accessible_spec.rb b/spec/models/form/lettings/pages/property_wheelchair_accessible_spec.rb new file mode 100644 index 000000000..4e487e239 --- /dev/null +++ b/spec/models/form/lettings/pages/property_wheelchair_accessible_spec.rb @@ -0,0 +1,31 @@ +require "rails_helper" + +RSpec.describe Form::Lettings::Pages::PropertyWheelchairAccessible, type: :model do + subject(:page) { described_class.new(nil, nil, subsection) } + + let(:subsection) { instance_double(Form::Subsection) } + + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[wchair]) + end + + it "has the correct id" do + expect(page.id).to eq("property_wheelchair_accessible") + end + + it "has the correct header" do + expect(page.header).to be_nil + end + + it "has the correct description" do + expect(page.description).to be_nil + end + + it "has the correct depends_on" do + expect(page.depends_on).to eq([{ "is_supported_housing?" => false }]) + end +end diff --git a/spec/models/form/lettings/questions/wheelchair_spec.rb b/spec/models/form/lettings/questions/wheelchair_spec.rb new file mode 100644 index 000000000..ac0241674 --- /dev/null +++ b/spec/models/form/lettings/questions/wheelchair_spec.rb @@ -0,0 +1,42 @@ +require "rails_helper" + +RSpec.describe Form::Lettings::Questions::Wheelchair, 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("wchair") + end + + it "has the correct header" do + expect(question.header).to eq("Is the property built or adapted to wheelchair-user standards?") + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq("Property built or adapted to wheelchair-user standards") + 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 "has the correct answer_options" do + expect(question.answer_options).to eq({ + "1" => { "value" => "Yes" }, + "2" => { "value" => "No" }, + }) + end + + it "is not marked as derived" do + expect(question.derived?).to be false + end +end