Browse Source

Split about_price_not_rtb

pull/2547/head
Kat 2 years ago
parent
commit
fd5be3c6ef
  1. 5
      app/models/form/sales/pages/grant.rb
  2. 6
      app/models/form/sales/pages/purchase_price.rb
  3. 2
      app/models/form/sales/subsections/discounted_ownership_scheme.rb
  4. 6
      spec/models/form/sales/pages/grant_spec.rb
  5. 5
      spec/models/form/sales/pages/purchase_price_spec.rb
  6. 2
      spec/models/form/sales/subsections/discounted_ownership_scheme_spec.rb

5
app/models/form/sales/pages/about_price_not_rtb.rb → app/models/form/sales/pages/grant.rb

@ -1,7 +1,7 @@
class Form::Sales::Pages::AboutPriceNotRtb < ::Form::Page class Form::Sales::Pages::Grant < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "about_price_not_rtb" @id = "grant"
@header = "About the price of the property" @header = "About the price of the property"
@depends_on = [{ @depends_on = [{
"right_to_buy?" => false, "right_to_buy?" => false,
@ -11,7 +11,6 @@ class Form::Sales::Pages::AboutPriceNotRtb < ::Form::Page
def questions def questions
@questions ||= [ @questions ||= [
Form::Sales::Questions::PurchasePrice.new(nil, nil, self, ownershipsch: 2),
Form::Sales::Questions::Grant.new(nil, nil, self), Form::Sales::Questions::Grant.new(nil, nil, self),
] ]
end end

6
app/models/form/sales/pages/purchase_price.rb

@ -3,8 +3,10 @@ class Form::Sales::Pages::PurchasePrice < ::Form::Page
super super
@id = "purchase_price" @id = "purchase_price"
@header = "About the price of the property" @header = "About the price of the property"
@depends_on = [{ @depends_on = [{ "right_to_buy?" => true },
"right_to_buy?" => true, {
"right_to_buy?" => false,
"rent_to_buy_full_ownership?" => false,
}] }]
end end

2
app/models/form/sales/subsections/discounted_ownership_scheme.rb

@ -14,7 +14,7 @@ class Form::Sales::Subsections::DiscountedOwnershipScheme < ::Form::Subsection
Form::Sales::Pages::Discount.new(nil, nil, self), Form::Sales::Pages::Discount.new(nil, nil, self),
Form::Sales::Pages::ExtraBorrowingValueCheck.new("extra_borrowing_price_value_check", nil, self), Form::Sales::Pages::ExtraBorrowingValueCheck.new("extra_borrowing_price_value_check", nil, self),
Form::Sales::Pages::PercentageDiscountValueCheck.new("percentage_discount_value_check", nil, self), Form::Sales::Pages::PercentageDiscountValueCheck.new("percentage_discount_value_check", nil, self),
Form::Sales::Pages::AboutPriceNotRtb.new(nil, nil, self), Form::Sales::Pages::Grant.new(nil, nil, self),
Form::Sales::Pages::GrantValueCheck.new(nil, nil, self), Form::Sales::Pages::GrantValueCheck.new(nil, nil, self),
Form::Sales::Pages::PurchasePriceOutrightOwnership.new("purchase_price_discounted_ownership", nil, self, ownershipsch: 2), Form::Sales::Pages::PurchasePriceOutrightOwnership.new("purchase_price_discounted_ownership", nil, self, ownershipsch: 2),
Form::Sales::Pages::DiscountedSaleValueCheck.new("discounted_sale_grant_value_check", nil, self), Form::Sales::Pages::DiscountedSaleValueCheck.new("discounted_sale_grant_value_check", nil, self),

6
spec/models/form/sales/pages/about_price_not_rtb_spec.rb → spec/models/form/sales/pages/grant_spec.rb

@ -1,6 +1,6 @@
require "rails_helper" require "rails_helper"
RSpec.describe Form::Sales::Pages::AboutPriceNotRtb, type: :model do RSpec.describe Form::Sales::Pages::Grant, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) } subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil } let(:page_id) { nil }
@ -12,11 +12,11 @@ RSpec.describe Form::Sales::Pages::AboutPriceNotRtb, type: :model do
end end
it "has correct questions" do it "has correct questions" do
expect(page.questions.map(&:id)).to eq(%w[value grant]) expect(page.questions.map(&:id)).to eq(%w[grant])
end end
it "has the correct id" do it "has the correct id" do
expect(page.id).to eq("about_price_not_rtb") expect(page.id).to eq("grant")
end end
it "has the correct header" do it "has the correct header" do

5
spec/models/form/sales/pages/purchase_price_spec.rb

@ -32,8 +32,7 @@ RSpec.describe Form::Sales::Pages::PurchasePrice, type: :model do
end end
it "has correct depends_on" do it "has correct depends_on" do
expect(page.depends_on).to eq([{ expect(page.depends_on).to eq([{ "right_to_buy?" => true },
"right_to_buy?" => true, { "rent_to_buy_full_ownership?" => false, "right_to_buy?" => false }])
}])
end end
end end

2
spec/models/form/sales/subsections/discounted_ownership_scheme_spec.rb

@ -20,7 +20,7 @@ RSpec.describe Form::Sales::Subsections::DiscountedOwnershipScheme, type: :model
discount discount
extra_borrowing_price_value_check extra_borrowing_price_value_check
percentage_discount_value_check percentage_discount_value_check
about_price_not_rtb grant
grant_value_check grant_value_check
purchase_price_discounted_ownership purchase_price_discounted_ownership
discounted_sale_grant_value_check discounted_sale_grant_value_check

Loading…
Cancel
Save