Browse Source

add about proce pages

pull/1121/head
Kat 4 years ago
parent
commit
747a78e3cf
  1. 18
      app/models/form/sales/pages/about_price.rb
  2. 19
      app/models/form/sales/pages/about_price_not_rtb.rb
  3. 19
      app/models/form/sales/pages/about_price_rtb.rb
  4. 19
      app/models/form/sales/pages/about_price_social_housing.rb
  5. 35
      spec/models/form/sales/pages/about_price_not_rtb_spec.rb
  6. 35
      spec/models/form/sales/pages/about_price_rtb_spec.rb
  7. 35
      spec/models/form/sales/pages/about_price_social_housing_spec.rb
  8. 35
      spec/models/form/sales/pages/about_price_spec.rb

18
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

19
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

19
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

19
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

35
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

35
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

35
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

35
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
Loading…
Cancel
Save