8 changed files with 215 additions and 0 deletions
@ -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 |
||||||
@ -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 |
||||||
@ -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 |
||||||
@ -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 |
||||||
@ -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 |
||||||
@ -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 |
||||||
@ -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 |
||||||
@ -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 |
||||||
Loading…
Reference in new issue