Browse Source
* Change about_price_social_housing to about_price_shared_ownership and display it in all shared ownership cases * Change about_price to purchase_price and display it for outright sale * lintpull/1143/head
11 changed files with 93 additions and 42 deletions
@ -1,18 +0,0 @@ |
|||||||
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 |
|
||||||
@ -1,13 +1,10 @@ |
|||||||
class Form::Sales::Pages::AboutPriceSocialHousing < ::Form::Page |
class Form::Sales::Pages::AboutPriceSharedOwnership < ::Form::Page |
||||||
def initialize(id, hsh, subsection) |
def initialize(id, hsh, subsection) |
||||||
super |
super |
||||||
@id = "about_price_social_housing" |
@id = "about_price_shared_ownership" |
||||||
@header = "About the price of the property" |
@header = "About the price of the property" |
||||||
@description = "" |
@description = "" |
||||||
@subsection = subsection |
@subsection = subsection |
||||||
@depends_on = [{ |
|
||||||
"soctenant" => 1, |
|
||||||
}] |
|
||||||
end |
end |
||||||
|
|
||||||
def questions |
def questions |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
class Form::Sales::Pages::PurchasePrice < ::Form::Page |
||||||
|
def initialize(id, hsh, subsection) |
||||||
|
super |
||||||
|
@id = "purchase_price" |
||||||
|
@header = "" |
||||||
|
@description = "" |
||||||
|
@subsection = subsection |
||||||
|
end |
||||||
|
|
||||||
|
def questions |
||||||
|
@questions ||= [ |
||||||
|
Form::Sales::Questions::PurchasePrice.new(nil, nil, self), |
||||||
|
] |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,14 @@ |
|||||||
|
class Form::Sales::Questions::PurchasePrice < ::Form::Question |
||||||
|
def initialize(id, hsh, page) |
||||||
|
super |
||||||
|
@id = "value" |
||||||
|
@check_answer_label = "Purchase price" |
||||||
|
@header = "What is the full purchase price?" |
||||||
|
@type = "numeric" |
||||||
|
@page = page |
||||||
|
@min = 0 |
||||||
|
@width = 5 |
||||||
|
@prefix = "£" |
||||||
|
@hint_text = "" |
||||||
|
end |
||||||
|
end |
||||||
@ -0,0 +1,49 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe Form::Sales::Questions::PurchasePrice, type: :model do |
||||||
|
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||||
|
|
||||||
|
let(:question_id) { nil } |
||||||
|
let(:question_definition) { nil } |
||||||
|
let(:page) { instance_double(Form::Page) } |
||||||
|
|
||||||
|
it "has correct page" do |
||||||
|
expect(question.page).to eq(page) |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct id" do |
||||||
|
expect(question.id).to eq("value") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct header" do |
||||||
|
expect(question.header).to eq("What is the full purchase price?") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct check_answer_label" do |
||||||
|
expect(question.check_answer_label).to eq("Purchase price") |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct type" do |
||||||
|
expect(question.type).to eq("numeric") |
||||||
|
end |
||||||
|
|
||||||
|
it "is not marked as derived" do |
||||||
|
expect(question.derived?).to be false |
||||||
|
end |
||||||
|
|
||||||
|
it "has the correct hint" do |
||||||
|
expect(question.hint_text).to eq("") |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct width" do |
||||||
|
expect(question.width).to eq(5) |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct prefix" do |
||||||
|
expect(question.prefix).to eq("£") |
||||||
|
end |
||||||
|
|
||||||
|
it "has correct min" do |
||||||
|
expect(question.min).to eq(0) |
||||||
|
end |
||||||
|
end |
||||||
Loading…
Reference in new issue