Browse Source
* CLDC-1849 Add hint to discounted ownership purchase price * Use PurchasePriceDiscountedOwnership in rtb page * show question with updated hint to certain types of answers * rubocop * Only display shared ownership hint in some occationspull/1270/head
Jack
2 years ago
committed by
GitHub
15 changed files with 98 additions and 12 deletions
@ -0,0 +1,14 @@
|
||||
class Form::Sales::Pages::PurchasePriceOutrightOwnership < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@depends_on = [ |
||||
{ "outright_sale_or_discounted_with_full_ownership?" => true }, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::PurchasePriceOutrightOwnership.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,12 @@
|
||||
class Form::Sales::Questions::PurchasePriceOutrightOwnership < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "value" |
||||
@check_answer_label = "Purchase price" |
||||
@header = "What is the full purchase price?" |
||||
@type = "numeric" |
||||
@min = 0 |
||||
@width = 5 |
||||
@prefix = "£" |
||||
end |
||||
end |
@ -0,0 +1,35 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::PurchasePriceOutrightOwnership, type: :model do |
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { "purchase_price" } |
||||
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("purchase_price") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to be_nil |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to be_nil |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq([ |
||||
{ "outright_sale_or_discounted_with_full_ownership?" => true }, |
||||
]) |
||||
end |
||||
end |
Loading…
Reference in new issue