diff --git a/app/models/form/sales/questions/buyers_organisations.rb b/app/models/form/sales/questions/buyers_organisations.rb index a30f27372..382571bc5 100644 --- a/app/models/form/sales/questions/buyers_organisations.rb +++ b/app/models/form/sales/questions/buyers_organisations.rb @@ -11,8 +11,8 @@ class Form::Sales::Questions::BuyersOrganisations < ::Form::Question end ANSWER_OPTIONS = { - "pregyrha" => { "value" => "Their private registered provider (PRP)- housing association" }, - "pregother" => { "value" => "Other private registered provider (PRP)- housing association" }, + "pregyrha" => { "value" => "Their private registered provider (PRP) - housing association" }, + "pregother" => { "value" => "Other private registered provider (PRP) - housing association" }, "pregla" => { "value" => "Local Authority" }, "pregghb" => { "value" => "Help to Buy Agent" }, }.freeze diff --git a/app/models/form/subsection.rb b/app/models/form/subsection.rb index 07e7fe65c..40eb73e87 100644 --- a/app/models/form/subsection.rb +++ b/app/models/form/subsection.rb @@ -30,8 +30,8 @@ class Form::Subsection qs = applicable_questions(log) qs_optional_removed = qs.reject { |q| log.optional_fields.include?(q.id) } - return :not_started if qs.count.positive? && qs.all? { |question| log[question.id].blank? || question.read_only? || question.derived? } return :completed if qs_optional_removed.all? { |question| question.completed?(log) } + return :not_started if qs.count.positive? && qs.all? { |question| log[question.id].blank? || question.read_only? || question.derived? } :in_progress end diff --git a/spec/models/form/sales/sections/household_spec.rb b/spec/models/form/sales/sections/household_spec.rb index e415e8f0c..cff166510 100644 --- a/spec/models/form/sales/sections/household_spec.rb +++ b/spec/models/form/sales/sections/household_spec.rb @@ -15,6 +15,7 @@ RSpec.describe Form::Sales::Sections::Household, type: :model do expect(household.subsections.map(&:id)).to eq( %w[ household_characteristics + household_situation household_needs ], ) diff --git a/spec/models/form/sales/subsections/household_needs_spec copy.rb b/spec/models/form/sales/subsections/household_needs_spec copy.rb new file mode 100644 index 000000000..f7b139ee5 --- /dev/null +++ b/spec/models/form/sales/subsections/household_needs_spec copy.rb @@ -0,0 +1,34 @@ +require "rails_helper" + +RSpec.describe Form::Sales::Subsections::HouseholdNeeds, type: :model do + subject(:household_characteristics) { described_class.new(subsection_id, subsection_definition, section) } + + let(:subsection_id) { nil } + let(:subsection_definition) { nil } + let(:section) { instance_double(Form::Sales::Sections::Household) } + + it "has correct section" do + expect(household_characteristics.section).to eq(section) + end + + it "has correct pages" do + expect(household_characteristics.pages.map(&:id)).to eq( + %w[ + household_wheelchair + household_disability + ], + ) + end + + it "has the correct id" do + expect(household_characteristics.id).to eq("household_needs") + end + + it "has the correct label" do + expect(household_characteristics.label).to eq("Household needs") + end + + it "has correct depends on" do + expect(household_characteristics.depends_on).to eq([{ "setup_completed?" => true }]) + end +end diff --git a/spec/models/form/sales/subsections/household_situation_spec.rb b/spec/models/form/sales/subsections/household_situation_spec.rb new file mode 100644 index 000000000..13fd18c23 --- /dev/null +++ b/spec/models/form/sales/subsections/household_situation_spec.rb @@ -0,0 +1,34 @@ +require "rails_helper" + +RSpec.describe Form::Sales::Subsections::HouseholdSituation, type: :model do + subject(:household_characteristics) { described_class.new(subsection_id, subsection_definition, section) } + + let(:subsection_id) { nil } + let(:subsection_definition) { nil } + let(:section) { instance_double(Form::Sales::Sections::Household) } + + it "has correct section" do + expect(household_characteristics.section).to eq(section) + end + + it "has correct pages" do + expect(household_characteristics.pages.map(&:id)).to eq( + %w[ + household_wheelchair + household_disability + ], + ) + end + + it "has the correct id" do + expect(household_characteristics.id).to eq("household_situation") + end + + it "has the correct label" do + expect(household_characteristics.label).to eq("Household situation") + end + + it "has correct depends on" do + expect(household_characteristics.depends_on).to eq([{ "setup_completed?" => true }]) + end +end