Browse Source
* Update the folder structure
* Add specs
* testy 💁♀️
* Update names in tests 🫠
pull/903/head
kosiakkatrina
2 years ago
committed by
GitHub
13 changed files with 132 additions and 20 deletions
@ -1,10 +0,0 @@
|
||||
class Form::Sales::Property::Sections::PropertyInformation < ::Form::Section |
||||
def initialize(id, hsh, form) |
||||
super |
||||
@id = "property_information" |
||||
@label = "Property information" |
||||
@description = "" |
||||
@form = form |
||||
@subsections = [Form::Sales::Property::Subsections::PropertyInformation.new(nil, nil, self)] || [] |
||||
end |
||||
end |
@ -1,4 +1,4 @@
|
||||
class Form::Sales::Property::Questions::PropertyNumberOfBedrooms < ::Form::Question |
||||
class Form::Sales::Questions::PropertyNumberOfBedrooms < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "beds" |
@ -0,0 +1,10 @@
|
||||
class Form::Sales::Sections::PropertyInformation < ::Form::Section |
||||
def initialize(id, hsh, form) |
||||
super |
||||
@id = "property_information" |
||||
@label = "Property information" |
||||
@description = "" |
||||
@form = form |
||||
@subsections = [Form::Sales::Subsections::PropertyInformation.new(nil, nil, self)] || [] |
||||
end |
||||
end |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Property::Pages::PropertyNumberOfBedrooms, type: :model do |
||||
RSpec.describe Form::Sales::Pages::PropertyNumberOfBedrooms, type: :model do |
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Property::Questions::PropertyNumberOfBedrooms, type: :model do |
||||
RSpec.describe Form::Sales::Questions::PropertyNumberOfBedrooms, type: :model do |
||||
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||
|
||||
let(:question_id) { nil } |
@ -0,0 +1,29 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Sections::Household, type: :model do |
||||
subject(:household) { 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(household.form).to eq(form) |
||||
end |
||||
|
||||
it "has correct subsections" do |
||||
expect(household.subsections.map(&:id)).to eq(%w[household_characteristics]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(household.id).to eq("household") |
||||
end |
||||
|
||||
it "has the correct label" do |
||||
expect(household.label).to eq("About the household") |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(household.description).to eq("") |
||||
end |
||||
end |
@ -0,0 +1,29 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Sections::PropertyInformation, type: :model do |
||||
subject(:property_information) { 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(property_information.form).to eq(form) |
||||
end |
||||
|
||||
it "has correct subsections" do |
||||
expect(property_information.subsections.map(&:id)).to eq(%w[property_information]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(property_information.id).to eq("property_information") |
||||
end |
||||
|
||||
it "has the correct label" do |
||||
expect(property_information.label).to eq("Property information") |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(property_information.description).to eq("") |
||||
end |
||||
end |
@ -0,0 +1,27 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Subsections::HouseholdCharacteristics, 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[buyer_1_age], |
||||
) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(household_characteristics.id).to eq("household_characteristics") |
||||
end |
||||
|
||||
it "has the correct label" do |
||||
expect(household_characteristics.label).to eq("Household characteristics") |
||||
end |
||||
end |
@ -0,0 +1,27 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Subsections::PropertyInformation, type: :model do |
||||
subject(:property_information) { 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(property_information.section).to eq(section) |
||||
end |
||||
|
||||
it "has correct pages" do |
||||
expect(property_information.pages.map(&:id)).to eq( |
||||
%w[property_number_of_bedrooms], |
||||
) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(property_information.id).to eq("property_information") |
||||
end |
||||
|
||||
it "has the correct label" do |
||||
expect(property_information.label).to eq("Property information") |
||||
end |
||||
end |
Loading…
Reference in new issue