diff --git a/app/models/form/sales/pages/about_price.rb b/app/models/form/sales/pages/about_price.rb new file mode 100644 index 000000000..f5641791d --- /dev/null +++ b/app/models/form/sales/pages/about_price.rb @@ -0,0 +1,18 @@ +class Form::Sales::Pages::AboutPrice < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "about_price" + @header = "About the price of the property" + @description = "" + @subsection = subsection + @depends_on = [{ + "soctenant" => 2, + }] + end + + def questions + @questions ||= [ + Form::Sales::Questions::Value.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/about_price_not_rtb.rb b/app/models/form/sales/pages/about_price_not_rtb.rb new file mode 100644 index 000000000..795ed9226 --- /dev/null +++ b/app/models/form/sales/pages/about_price_not_rtb.rb @@ -0,0 +1,19 @@ +class Form::Sales::Pages::AboutPriceNotRtb < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "about_price_not_rtb" + @header = "About the price of the property" + @description = "" + @subsection = subsection + @depends_on = [{ + "right_to_buy?" => false, + }] + end + + def questions + @questions ||= [ + Form::Sales::Questions::Value.new(nil, nil, self), + Form::Sales::Questions::Grant.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/about_price_rtb.rb b/app/models/form/sales/pages/about_price_rtb.rb new file mode 100644 index 000000000..ec90afa01 --- /dev/null +++ b/app/models/form/sales/pages/about_price_rtb.rb @@ -0,0 +1,19 @@ +class Form::Sales::Pages::AboutPriceRtb < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "about_price_rtb" + @header = "About the price of the property" + @description = "" + @subsection = subsection + @depends_on = [{ + "right_to_buy?" => true, + }] + end + + def questions + @questions ||= [ + Form::Sales::Questions::Value.new(nil, nil, self), + Form::Sales::Questions::Discount.new(nil, nil, self), + ] + end +end diff --git a/app/models/form/sales/pages/about_price_social_housing.rb b/app/models/form/sales/pages/about_price_social_housing.rb new file mode 100644 index 000000000..bf8045f3d --- /dev/null +++ b/app/models/form/sales/pages/about_price_social_housing.rb @@ -0,0 +1,19 @@ +class Form::Sales::Pages::AboutPriceSocialHousing < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "about_price_social_housing" + @header = "About the price of the property" + @description = "" + @subsection = subsection + @depends_on = [{ + "soctenant" => 1, + }] + end + + def questions + @questions ||= [ + Form::Sales::Questions::Value.new(nil, nil, self), + Form::Sales::Questions::Equity.new(nil, nil, self), + ] + end +end diff --git a/spec/models/form/sales/pages/about_price_not_rtb_spec.rb b/spec/models/form/sales/pages/about_price_not_rtb_spec.rb new file mode 100644 index 000000000..584455d25 --- /dev/null +++ b/spec/models/form/sales/pages/about_price_not_rtb_spec.rb @@ -0,0 +1,35 @@ +require "rails_helper" + +RSpec.describe Form::Sales::Pages::AboutPriceNotRtb, type: :model do + subject(:page) { described_class.new(page_id, page_definition, subsection) } + + let(:page_id) { nil } + let(:page_definition) { nil } + 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[value grant]) + end + + it "has the correct id" do + expect(page.id).to eq("about_price_not_rtb") + end + + it "has the correct header" do + expect(page.header).to eq("About the price of the property") + end + + it "has the correct description" do + expect(page.description).to eq("") + end + + it "has correct depends_on" do + expect(page.depends_on).to eq([{ + "right_to_buy?" => false, + }]) + end +end diff --git a/spec/models/form/sales/pages/about_price_rtb_spec.rb b/spec/models/form/sales/pages/about_price_rtb_spec.rb new file mode 100644 index 000000000..29e59f52c --- /dev/null +++ b/spec/models/form/sales/pages/about_price_rtb_spec.rb @@ -0,0 +1,35 @@ +require "rails_helper" + +RSpec.describe Form::Sales::Pages::AboutPriceRtb, type: :model do + subject(:page) { described_class.new(page_id, page_definition, subsection) } + + let(:page_id) { nil } + let(:page_definition) { nil } + 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[value discount]) + end + + it "has the correct id" do + expect(page.id).to eq("about_price_rtb") + end + + it "has the correct header" do + expect(page.header).to eq("About the price of the property") + end + + it "has the correct description" do + expect(page.description).to eq("") + end + + it "has correct depends_on" do + expect(page.depends_on).to eq([{ + "right_to_buy?" => true, + }]) + end +end diff --git a/spec/models/form/sales/pages/about_price_social_housing_spec.rb b/spec/models/form/sales/pages/about_price_social_housing_spec.rb new file mode 100644 index 000000000..acdcd7dd3 --- /dev/null +++ b/spec/models/form/sales/pages/about_price_social_housing_spec.rb @@ -0,0 +1,35 @@ +require "rails_helper" + +RSpec.describe Form::Sales::Pages::AboutPriceSocialHousing, type: :model do + subject(:page) { described_class.new(page_id, page_definition, subsection) } + + let(:page_id) { nil } + let(:page_definition) { nil } + 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[value equity]) + end + + it "has the correct id" do + expect(page.id).to eq("about_price_social_housing") + end + + it "has the correct header" do + expect(page.header).to eq("About the price of the property") + end + + it "has the correct description" do + expect(page.description).to eq("") + end + + it "has correct depends_on" do + expect(page.depends_on).to eq([{ + "soctenant" => 1, + }]) + end +end diff --git a/spec/models/form/sales/pages/about_price_spec.rb b/spec/models/form/sales/pages/about_price_spec.rb new file mode 100644 index 000000000..d6c45cd4b --- /dev/null +++ b/spec/models/form/sales/pages/about_price_spec.rb @@ -0,0 +1,35 @@ +require "rails_helper" + +RSpec.describe Form::Sales::Pages::AboutPrice, type: :model do + subject(:page) { described_class.new(page_id, page_definition, subsection) } + + let(:page_id) { nil } + let(:page_definition) { nil } + 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[value]) + end + + it "has the correct id" do + expect(page.id).to eq("about_price") + end + + it "has the correct header" do + expect(page.header).to eq("About the price of the property") + end + + it "has the correct description" do + expect(page.description).to eq("") + end + + it "has correct depends_on" do + expect(page.depends_on).to eq([{ + "soctenant" => 2, + }]) + end +end