From fc099b7030e0b92f1861d8d390efb72dc366b43a Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 26 Sep 2022 15:41:27 +0100 Subject: [PATCH] Add specs --- .../form/sales/sections/household_spec.rb | 29 +++++++++++++++++++ .../sections/property_information_spec.rb | 29 +++++++++++++++++++ .../household_characteristics_spec.rb | 27 +++++++++++++++++ .../subsections/property_information_spec.rb | 27 +++++++++++++++++ 4 files changed, 112 insertions(+) create mode 100644 spec/models/form/sales/sections/household_spec.rb create mode 100644 spec/models/form/sales/sections/property_information_spec.rb create mode 100644 spec/models/form/sales/subsections/household_characteristics_spec.rb create mode 100644 spec/models/form/sales/subsections/property_information_spec.rb diff --git a/spec/models/form/sales/sections/household_spec.rb b/spec/models/form/sales/sections/household_spec.rb new file mode 100644 index 000000000..2830cfea5 --- /dev/null +++ b/spec/models/form/sales/sections/household_spec.rb @@ -0,0 +1,29 @@ +require "rails_helper" + +RSpec.describe Form::Sales::Sections::Household, type: :model do + subject(:setup) { described_class.new(section_id, section_definition, form) } + + let(:section_id) { nil } + let(:section_definition) { nil } + let(:form) { instance_double(Form) } + + it "has correct form" do + expect(setup.form).to eq(form) + end + + it "has correct subsections" do + expect(setup.subsections.map(&:id)).to eq(%w[household_characteristics]) + end + + it "has the correct id" do + expect(setup.id).to eq("household") + end + + it "has the correct label" do + expect(setup.label).to eq("About the household") + end + + it "has the correct description" do + expect(setup.description).to eq("") + end +end diff --git a/spec/models/form/sales/sections/property_information_spec.rb b/spec/models/form/sales/sections/property_information_spec.rb new file mode 100644 index 000000000..1759b3dad --- /dev/null +++ b/spec/models/form/sales/sections/property_information_spec.rb @@ -0,0 +1,29 @@ +require "rails_helper" + +RSpec.describe Form::Sales::Sections::PropertyInformation, type: :model do + subject(:setup) { described_class.new(section_id, section_definition, form) } + + let(:section_id) { nil } + let(:section_definition) { nil } + let(:form) { instance_double(Form) } + + it "has correct form" do + expect(setup.form).to eq(form) + end + + it "has correct subsections" do + expect(setup.subsections.map(&:id)).to eq(%w[property_information]) + end + + it "has the correct id" do + expect(setup.id).to eq("property_information") + end + + it "has the correct label" do + expect(setup.label).to eq("Property information") + end + + it "has the correct description" do + expect(setup.description).to eq("") + end +end diff --git a/spec/models/form/sales/subsections/household_characteristics_spec.rb b/spec/models/form/sales/subsections/household_characteristics_spec.rb new file mode 100644 index 000000000..05a9993fe --- /dev/null +++ b/spec/models/form/sales/subsections/household_characteristics_spec.rb @@ -0,0 +1,27 @@ +require "rails_helper" + +RSpec.describe Form::Sales::Subsections::HouseholdCharacteristics, type: :model do + subject(:setup) { described_class.new(subsection_id, subsection_definition, section) } + + let(:subsection_id) { nil } + let(:subsection_definition) { nil } + let(:section) { instance_double(Form::Sales::Sections::Setup) } + + it "has correct section" do + expect(setup.section).to eq(section) + end + + it "has correct pages" do + expect(setup.pages.map(&:id)).to eq( + %w[buyer_1_age], + ) + end + + it "has the correct id" do + expect(setup.id).to eq("household_characteristics") + end + + it "has the correct label" do + expect(setup.label).to eq("Household characteristics") + end +end diff --git a/spec/models/form/sales/subsections/property_information_spec.rb b/spec/models/form/sales/subsections/property_information_spec.rb new file mode 100644 index 000000000..46176f688 --- /dev/null +++ b/spec/models/form/sales/subsections/property_information_spec.rb @@ -0,0 +1,27 @@ +require "rails_helper" + +RSpec.describe Form::Sales::Subsections::PropertyInformation, type: :model do + subject(:setup) { described_class.new(subsection_id, subsection_definition, section) } + + let(:subsection_id) { nil } + let(:subsection_definition) { nil } + let(:section) { instance_double(Form::Sales::Sections::PropertyInformation) } + + it "has correct section" do + expect(setup.section).to eq(section) + end + + it "has correct pages" do + expect(setup.pages.map(&:id)).to eq( + %w[property_number_of_bedrooms], + ) + end + + it "has the correct id" do + expect(setup.id).to eq("property_information") + end + + it "has the correct label" do + expect(setup.label).to eq("Property information") + end +end