Browse Source
* Mark subsection as completed if it is not displayed in the tasklist and hide it from the UI * Add sale_information section * add sales information subsections * Cldc 1531 staircasing (#1109) * Add staircase field to sales_logs table * Add staircase question and page * add staircase page to the shared ownership scheme subsection fix file name * Cldc 1539 previous bedrooms (#1108) * add frombeds field * Add previous_bedrooms page and question * add Previous Bedrooms page to the shared ownership subsection * Cldc 1532 about staircasing (#1110) * Add stairboughts and stairowned fields to the database * Add about staircasing page and questions * Add about staircasing page to the shared wnership scheme subsection * Add a space before percent * Cldc 1546 monthly rent (#1111) * Add monthly rent column to sales logs table * Add monthly rent question and page * Add monthly rent page to the shared ownership scheme subsection * Cldc 1535 exchange contracts (#1112) * Add exdate to sales logs table * Add exchange date page and question * Add exchange contracts page to the shared ownership subsection * derive exday, exmonth and exyear, tests and lint * rebase tests * Cldc 1538 la nominations (#1115) * Add la nominations column to sales logs table * Add La nominations page and questions * Add la nominations to the shared ownership subsection * Add accidentally removed files * Cldc 1545 about the deposit (#1113) * feat: add question(s) without depends_on behaviour * feat: separate ids for diff sections * test: update tests * test: add tests * tests: test tweaks * refactor: linting * Cldc 1538 la nominations (#1115) * Add la nominations column to sales logs table * Add La nominations page and questions * Add la nominations to the shared ownership subsection * Add accidentally removed files * feat: add question(s) without depends_on behaviour Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> * Cldc 1533 is resale (#1118) * feat: add resale question and page * tests: add new tests * test: update previous tests * refactor: linting * refactor: linting * Cldc 1576 buyer prp (#1117) * Add soctenant field to sales logs * Add buyer previous page and question * Add buyer previous page to shared ownership scheme subsection * rebase migrate * rebase too * Cldc 1540 about price (#1121) * add price fields to the sales logs table * Add about proce questions * add about proce pages * Add about price pages to sale information sections * rebase changes * happy new year * Switch the order of sales log sections * Cldc 1540 fixes (#1130) * Update order of pages and remove wrong id's * Add spacing to the hint text * Cldc 1521 living before purchase (#1129) * feat: add new page and question and update db * test: add and update tests * feat: reset db * Only display from beds for social housing (#1131) * Cldc 1544 mortgage amount (#1136) * feat: add sales log seeds * feat: add question and page and update db * tests: add and update tests * Cldc 1540 fixes part two (#1135) * 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 * lint * Move exchange contracts date page (#1143) * feat: PO fix and tests (#1144) * feat: PO fix and tests * feat: simmplification * refactor: linting * feat: copy tweak Co-authored-by: natdeanlewissoftwire <94526761+natdeanlewissoftwire@users.noreply.github.com> Co-authored-by: natdeanlewissoftwire <nat.dean-lewis@softwire.com>pull/1093/head
kosiakkatrina
2 years ago
committed by
GitHub
99 changed files with 2463 additions and 10 deletions
@ -1,5 +1,10 @@
|
||||
module DerivedVariables::SalesLogVariables |
||||
def set_derived_fields! |
||||
self.ethnic = 17 if ethnic_refused? |
||||
if exdate.present? |
||||
self.exday = exdate.day |
||||
self.exmonth = exdate.month |
||||
self.exyear = exdate.year |
||||
end |
||||
end |
||||
end |
||||
|
@ -0,0 +1,17 @@
|
||||
class Form::Sales::Pages::AboutDepositWithDiscount < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "about_deposit_with_discount" |
||||
@header = "About the deposit" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [{ "is_type_discount?" => true }] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::DepositAmount.new(nil, nil, self), |
||||
Form::Sales::Questions::DepositDiscount.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,15 @@
|
||||
class Form::Sales::Pages::AboutDepositWithoutDiscount < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@header = "About the deposit" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [{ "is_type_discount?" => false }] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::DepositAmount.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,16 @@
|
||||
class Form::Sales::Pages::AboutPriceSharedOwnership < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "about_price_shared_ownership" |
||||
@header = "About the price of the property" |
||||
@description = "" |
||||
@subsection = subsection |
||||
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,19 @@
|
||||
class Form::Sales::Pages::AboutStaircase < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "about_staircasing" |
||||
@header = "About the staircasing transaction" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [{ |
||||
"staircase" => 1, |
||||
}] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::StaircaseBought.new(nil, nil, self), |
||||
Form::Sales::Questions::StaircaseOwned.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,15 @@
|
||||
class Form::Sales::Pages::BuyerPrevious < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "buyer_previous" |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::BuyerPrevious.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,18 @@
|
||||
class Form::Sales::Pages::ExchangeDate < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "exchange_contracts" |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [{ |
||||
"resale" => 2, |
||||
}] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::ExchangeDate.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,15 @@
|
||||
class Form::Sales::Pages::LaNominations < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "la_nominations" |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::LaNominations.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,14 @@
|
||||
class Form::Sales::Pages::LivingBeforePurchase < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::LivingBeforePurchase.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,15 @@
|
||||
class Form::Sales::Pages::MonthlyRent < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "monthly_rent" |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::MonthlyRent.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,14 @@
|
||||
class Form::Sales::Pages::MortgageAmount < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@header = "Mortgage Amount" |
||||
@description = "" |
||||
@subsection = subsection |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::MortgageAmount.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,18 @@
|
||||
class Form::Sales::Pages::PreviousBedrooms < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "previous_bedrooms" |
||||
@header = "About the buyers’ previous property" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [{ |
||||
"soctenant" => 1, |
||||
}] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::PreviousBedrooms.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -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,23 @@
|
||||
class Form::Sales::Pages::Resale < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "resale" |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
@depends_on = [ |
||||
{ |
||||
"staircase" => 2, |
||||
}, |
||||
{ |
||||
"staircase" => 3, |
||||
}, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::Resale.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,15 @@
|
||||
class Form::Sales::Pages::Staircase < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "staircasing" |
||||
@header = "" |
||||
@description = "" |
||||
@subsection = subsection |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::Staircase.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,16 @@
|
||||
class Form::Sales::Questions::BuyerPrevious < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "soctenant" |
||||
@check_answer_label = "Buyer was a registered provider, housing association or local authority tenant immediately before this sale?" |
||||
@header = "Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?" |
||||
@type = "radio" |
||||
@answer_options = ANSWER_OPTIONS |
||||
@page = page |
||||
end |
||||
|
||||
ANSWER_OPTIONS = { |
||||
"1" => { "value" => "Yes" }, |
||||
"2" => { "value" => "No" }, |
||||
}.freeze |
||||
end |
@ -0,0 +1,14 @@
|
||||
class Form::Sales::Questions::DepositAmount < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "deposit" |
||||
@check_answer_label = "Cash deposit" |
||||
@header = "How much cash deposit was paid on the property?" |
||||
@type = "numeric" |
||||
@page = page |
||||
@min = 0 |
||||
@width = 5 |
||||
@prefix = "£" |
||||
@hint_text = "Enter the total cash sum paid by the buyer towards the property that was not funded by the mortgage" |
||||
end |
||||
end |
@ -0,0 +1,14 @@
|
||||
class Form::Sales::Questions::DepositDiscount < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "cashdis" |
||||
@check_answer_label = "Cash discount through SocialHomeBuy" |
||||
@header = "How much cash discount was given through Social HomeBuy?" |
||||
@type = "numeric" |
||||
@page = page |
||||
@min = 0 |
||||
@width = 5 |
||||
@prefix = "£" |
||||
@hint_text = "Enter the total cash discount given on the property being purchased through the Social HomeBuy scheme" |
||||
end |
||||
end |
@ -0,0 +1,17 @@
|
||||
class Form::Sales::Questions::Discount < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "discount" |
||||
@check_answer_label = "Percentage discount" |
||||
@header = "What was the percentage discount?" |
||||
@type = "numeric" |
||||
@page = page |
||||
@min = 0 |
||||
@max = 100 |
||||
@width = 5 |
||||
@suffix = "%" |
||||
@hint_text = "For Right to Buy (RTB), Preserved Right to Buy (PRTB), and Voluntary Right to Buy (VRTB)</br></br> |
||||
If discount capped, enter capped %</br></br> |
||||
If the property is being sold to an existing tenant under the RTB, PRTB, or VRTB schemes, enter the % discount from the full market value that is being given." |
||||
end |
||||
end |
@ -0,0 +1,15 @@
|
||||
class Form::Sales::Questions::Equity < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "equity" |
||||
@check_answer_label = "Initial percentage equity stake" |
||||
@header = "What was the initial percentage equity stake purchased?" |
||||
@type = "numeric" |
||||
@page = page |
||||
@min = 0 |
||||
@max = 100 |
||||
@width = 5 |
||||
@suffix = "%" |
||||
@hint_text = "Enter the amount of initial equity held by the purchaser (for example, 25% or 50%)" |
||||
end |
||||
end |
@ -0,0 +1,10 @@
|
||||
class Form::Sales::Questions::ExchangeDate < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "exdate" |
||||
@check_answer_label = "Exchange of contracts date" |
||||
@header = "What is the exchange of contracts date?" |
||||
@type = "date" |
||||
@page = page |
||||
end |
||||
end |
@ -0,0 +1,14 @@
|
||||
class Form::Sales::Questions::Grant < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "grant" |
||||
@check_answer_label = "Amount of any loan, grant or subsidy" |
||||
@header = "What was the amount of any loan, grant, discount or subsidy given?" |
||||
@type = "numeric" |
||||
@page = page |
||||
@min = 0 |
||||
@width = 5 |
||||
@prefix = "£" |
||||
@hint_text = "For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB), Voluntary Right to Buy (VRTB)" |
||||
end |
||||
end |
@ -0,0 +1,18 @@
|
||||
class Form::Sales::Questions::LaNominations < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "lanomagr" |
||||
@check_answer_label = "Household rehoused under a local authority nominations agreement?" |
||||
@header = "Was the household rehoused under a 'local authority nominations agreement'?" |
||||
@type = "radio" |
||||
@answer_options = ANSWER_OPTIONS |
||||
@page = page |
||||
@hint_text = "A local authority nominations agreement is a written agreement between a local authority and private registered provider (PRP) that some or all of its sales vacancies are offered to local authorities for rehousing" |
||||
end |
||||
|
||||
ANSWER_OPTIONS = { |
||||
"1" => { "value" => "Yes" }, |
||||
"2" => { "value" => "No" }, |
||||
"3" => { "value" => "Don’t know" }, |
||||
}.freeze |
||||
end |
@ -0,0 +1,16 @@
|
||||
class Form::Sales::Questions::LivingBeforePurchase < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "proplen" |
||||
@check_answer_label = "Number of years living in the property before purchase" |
||||
@header = "How long did the buyer(s) live in the property before purchase?" |
||||
@hint_text = "You should round this up to the nearest year. If the buyers haven't been living in the property, enter '0'" |
||||
@type = "numeric" |
||||
@page = page |
||||
@min = 0 |
||||
@max = 80 |
||||
@step = 1 |
||||
@width = 5 |
||||
@suffix = " years" |
||||
end |
||||
end |
@ -0,0 +1,14 @@
|
||||
class Form::Sales::Questions::MonthlyRent < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "mrent" |
||||
@check_answer_label = "Monthly rent" |
||||
@header = "What is the basic monthly rent?" |
||||
@type = "numeric" |
||||
@page = page |
||||
@min = 0 |
||||
@width = 5 |
||||
@prefix = "£" |
||||
@hint_text = "Amount paid before any charges" |
||||
end |
||||
end |
@ -0,0 +1,14 @@
|
||||
class Form::Sales::Questions::MortgageAmount < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "mortgage" |
||||
@check_answer_label = "Mortgage amount" |
||||
@header = "What is the mortgage amount?" |
||||
@type = "numeric" |
||||
@page = page |
||||
@min = 0 |
||||
@width = 5 |
||||
@prefix = "£" |
||||
@hint_text = "" |
||||
end |
||||
end |
@ -0,0 +1,13 @@
|
||||
class Form::Sales::Questions::PreviousBedrooms < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "frombeds" |
||||
@check_answer_label = "Number of bedrooms in previous property" |
||||
@header = "How many bedrooms did the property have?" |
||||
@type = "numeric" |
||||
@page = page |
||||
@width = 5 |
||||
@min = 0 |
||||
@hint_text = "For bedsits enter 1" |
||||
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,17 @@
|
||||
class Form::Sales::Questions::Resale < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "resale" |
||||
@check_answer_label = "Is this a resale?" |
||||
@header = "Is this a resale?" |
||||
@type = "radio" |
||||
@answer_options = ANSWER_OPTIONS |
||||
@page = page |
||||
@hint_text = "If the social landlord has previously sold the property to another buyer and is now reselling the property, select 'yes'. If this is the first time the property has been sold, select 'no'." |
||||
end |
||||
|
||||
ANSWER_OPTIONS = { |
||||
"1" => { "value" => "Yes" }, |
||||
"2" => { "value" => "No" }, |
||||
}.freeze |
||||
end |
@ -0,0 +1,18 @@
|
||||
class Form::Sales::Questions::Staircase < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "staircase" |
||||
@check_answer_label = "Staircasing transaction" |
||||
@header = "Is this a staircasing transaction?" |
||||
@type = "radio" |
||||
@answer_options = ANSWER_OPTIONS |
||||
@page = page |
||||
@hint_text = "A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property" |
||||
end |
||||
|
||||
ANSWER_OPTIONS = { |
||||
"1" => { "value" => "Yes" }, |
||||
"2" => { "value" => "No" }, |
||||
"3" => { "value" => "Don’t know" }, |
||||
}.freeze |
||||
end |
@ -0,0 +1,14 @@
|
||||
class Form::Sales::Questions::StaircaseBought < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "stairbought" |
||||
@check_answer_label = "Percentage bought in this staircasing transaction" |
||||
@header = "What percentage of the property has been bought in this staircasing transaction?" |
||||
@type = "numeric" |
||||
@page = page |
||||
@width = 5 |
||||
@min = 0 |
||||
@max = 100 |
||||
@suffix = " percent" |
||||
end |
||||
end |
@ -0,0 +1,14 @@
|
||||
class Form::Sales::Questions::StaircaseOwned < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "stairowned" |
||||
@check_answer_label = "Percentage the buyer now owns in total" |
||||
@header = "What percentage of the property does the buyer now own in total?" |
||||
@type = "numeric" |
||||
@page = page |
||||
@width = 5 |
||||
@min = 0 |
||||
@max = 100 |
||||
@suffix = " percent" |
||||
end |
||||
end |
@ -0,0 +1,14 @@
|
||||
class Form::Sales::Questions::Value < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "value" |
||||
@check_answer_label = "Full purchase price" |
||||
@header = "What was the full purchase price?" |
||||
@type = "numeric" |
||||
@page = page |
||||
@min = 0 |
||||
@width = 5 |
||||
@prefix = "£" |
||||
@hint_text = "Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser)" |
||||
end |
||||
end |
@ -0,0 +1,14 @@
|
||||
class Form::Sales::Sections::SaleInformation < ::Form::Section |
||||
def initialize(id, hsh, form) |
||||
super |
||||
@id = "sale_information" |
||||
@label = "Sale information" |
||||
@description = "" |
||||
@form = form |
||||
@subsections = [ |
||||
Form::Sales::Subsections::SharedOwnershipScheme.new(nil, nil, self), |
||||
Form::Sales::Subsections::DiscountedOwnershipScheme.new(nil, nil, self), |
||||
Form::Sales::Subsections::OutrightSale.new(nil, nil, self), |
||||
] || [] |
||||
end |
||||
end |
@ -0,0 +1,23 @@
|
||||
class Form::Sales::Subsections::DiscountedOwnershipScheme < ::Form::Subsection |
||||
def initialize(id, hsh, section) |
||||
super |
||||
@id = "discounted_ownership_scheme" |
||||
@label = "Discounted ownership scheme" |
||||
@section = section |
||||
@depends_on = [{ "ownershipsch" => 2, "setup_completed?" => true }] |
||||
end |
||||
|
||||
def pages |
||||
@pages ||= [ |
||||
Form::Sales::Pages::LivingBeforePurchase.new("living_before_purchase_discounted_ownership", nil, self), |
||||
Form::Sales::Pages::AboutPriceRtb.new(nil, nil, self), |
||||
Form::Sales::Pages::AboutPriceNotRtb.new(nil, nil, self), |
||||
Form::Sales::Pages::MortgageAmount.new("mortgage_amount_discounted_ownership", nil, self), |
||||
Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_discounted_ownership", nil, self), |
||||
] |
||||
end |
||||
|
||||
def displayed_in_tasklist?(log) |
||||
log.ownershipsch == 2 |
||||
end |
||||
end |
@ -0,0 +1,21 @@
|
||||
class Form::Sales::Subsections::OutrightSale < ::Form::Subsection |
||||
def initialize(id, hsh, section) |
||||
super |
||||
@id = "outright_sale" |
||||
@label = "Outright sale" |
||||
@section = section |
||||
@depends_on = [{ "ownershipsch" => 3, "setup_completed?" => true }] |
||||
end |
||||
|
||||
def pages |
||||
@pages ||= [ |
||||
Form::Sales::Pages::PurchasePrice.new(nil, nil, self), |
||||
Form::Sales::Pages::MortgageAmount.new("mortgage_amount_outright_sale", nil, self), |
||||
Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_outright_sale", nil, self), |
||||
] |
||||
end |
||||
|
||||
def displayed_in_tasklist?(log) |
||||
log.ownershipsch == 3 |
||||
end |
||||
end |
@ -0,0 +1,31 @@
|
||||
class Form::Sales::Subsections::SharedOwnershipScheme < ::Form::Subsection |
||||
def initialize(id, hsh, section) |
||||
super |
||||
@id = "shared_ownership_scheme" |
||||
@label = "Shared ownership scheme" |
||||
@section = section |
||||
@depends_on = [{ "ownershipsch" => 1, "setup_completed?" => true }] |
||||
end |
||||
|
||||
def pages |
||||
@pages ||= [ |
||||
Form::Sales::Pages::LivingBeforePurchase.new("living_before_purchase_shared_ownership", nil, self), |
||||
Form::Sales::Pages::Staircase.new(nil, nil, self), |
||||
Form::Sales::Pages::AboutStaircase.new(nil, nil, self), |
||||
Form::Sales::Pages::Resale.new(nil, nil, self), |
||||
Form::Sales::Pages::ExchangeDate.new(nil, nil, self), |
||||
Form::Sales::Pages::LaNominations.new(nil, nil, self), |
||||
Form::Sales::Pages::BuyerPrevious.new(nil, nil, self), |
||||
Form::Sales::Pages::PreviousBedrooms.new(nil, nil, self), |
||||
Form::Sales::Pages::AboutPriceSharedOwnership.new(nil, nil, self), |
||||
Form::Sales::Pages::MortgageAmount.new("mortgage_amount_shared_ownership", nil, self), |
||||
Form::Sales::Pages::AboutDepositWithDiscount.new(nil, nil, self), |
||||
Form::Sales::Pages::AboutDepositWithoutDiscount.new("about_deposit_shared_ownership", nil, self), |
||||
Form::Sales::Pages::MonthlyRent.new(nil, nil, self), |
||||
] |
||||
end |
||||
|
||||
def displayed_in_tasklist?(log) |
||||
log.ownershipsch == 1 |
||||
end |
||||
end |
@ -0,0 +1,7 @@
|
||||
class AddFromBedsToSales < ActiveRecord::Migration[7.0] |
||||
def change |
||||
change_table :sales_logs, bulk: true do |t| |
||||
t.column :frombeds, :integer |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,7 @@
|
||||
class AddStaircaseToSales < ActiveRecord::Migration[7.0] |
||||
def change |
||||
change_table :sales_logs, bulk: true do |t| |
||||
t.column :staircase, :integer |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,8 @@
|
||||
class AddStaircaseFieldsToSales < ActiveRecord::Migration[7.0] |
||||
def change |
||||
change_table :sales_logs, bulk: true do |t| |
||||
t.column :stairbought, :integer |
||||
t.column :stairowned, :integer |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,7 @@
|
||||
class AddRentToSales < ActiveRecord::Migration[7.0] |
||||
def change |
||||
change_table :sales_logs, bulk: true do |t| |
||||
t.column :mrent, :decimal, precision: 10, scale: 2 |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,11 @@
|
||||
class AddExchangeContractsToSales < ActiveRecord::Migration[7.0] |
||||
def change |
||||
change_table :sales_logs, bulk: true do |t| |
||||
t.column :exdate, :datetime |
||||
t.column :exday, :integer |
||||
t.column :exmonth, :integer |
||||
t.column :exyear, :integer |
||||
t.column :resale, :integer |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,8 @@
|
||||
class AddDepositFieldsToSales < ActiveRecord::Migration[7.0] |
||||
def change |
||||
change_table :sales_logs, bulk: true do |t| |
||||
t.column :deposit, :decimal, precision: 10, scale: 2 |
||||
t.column :cashdis, :decimal, precision: 10, scale: 2 |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,7 @@
|
||||
class AddLaNominations < ActiveRecord::Migration[7.0] |
||||
def change |
||||
change_table :sales_logs, bulk: true do |t| |
||||
t.column :lanomagr, :integer |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,7 @@
|
||||
class AddSoctenant < ActiveRecord::Migration[7.0] |
||||
def change |
||||
change_table :sales_logs, bulk: true do |t| |
||||
t.column :soctenant, :integer |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,10 @@
|
||||
class AddPriceFields < ActiveRecord::Migration[7.0] |
||||
def change |
||||
change_table :sales_logs, bulk: true do |t| |
||||
t.column :value, :decimal, precision: 10, scale: 2 |
||||
t.column :equity, :decimal, precision: 10, scale: 2 |
||||
t.column :discount, :decimal, precision: 10, scale: 2 |
||||
t.column :grant, :decimal, precision: 10, scale: 2 |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,7 @@
|
||||
class AddProplenToSales < ActiveRecord::Migration[7.0] |
||||
def change |
||||
change_table :sales_logs, bulk: true do |t| |
||||
t.column :proplen, :integer |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,13 @@
|
||||
class ChangeMortgageToFloat < ActiveRecord::Migration[7.0] |
||||
def self.up |
||||
change_table :sales_logs do |t| |
||||
t.change :mortgage, :decimal, precision: 10, scale: 2 |
||||
end |
||||
end |
||||
|
||||
def self.down |
||||
change_table :sales_logs do |t| |
||||
t.change :mortgage, :integer |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,35 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::AboutDepositWithDiscount, 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[deposit cashdis]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("about_deposit_with_discount") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to eq("About the deposit") |
||||
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( |
||||
[{ "is_type_discount?" => true }], |
||||
) |
||||
end |
||||
end |
@ -0,0 +1,35 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::AboutDepositWithoutDiscount, 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[deposit]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq(nil) |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to eq("About the deposit") |
||||
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( |
||||
[{ "is_type_discount?" => false }], |
||||
) |
||||
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,33 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::AboutPriceSharedOwnership, 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_shared_ownership") |
||||
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 be_nil |
||||
end |
||||
end |
@ -0,0 +1,35 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::AboutStaircase, 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[stairbought stairowned]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("about_staircasing") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to eq("About the staircasing transaction") |
||||
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([{ |
||||
"staircase" => 1, |
||||
}]) |
||||
end |
||||
end |
@ -0,0 +1,29 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::BuyerPrevious, 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[soctenant]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("buyer_previous") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to eq("") |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to eq("") |
||||
end |
||||
end |
@ -0,0 +1,35 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::ExchangeDate, 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[exdate]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("exchange_contracts") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to eq("") |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to eq("") |
||||
end |
||||
|
||||
it "has the correct depends_on" do |
||||
expect(page.depends_on).to eq([{ |
||||
"resale" => 2, |
||||
}]) |
||||
end |
||||
end |
@ -0,0 +1,29 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::LaNominations, 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[lanomagr]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("la_nominations") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to eq("") |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to eq("") |
||||
end |
||||
end |
@ -0,0 +1,33 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::LivingBeforePurchase, 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[proplen]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq(nil) |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to eq("") |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to eq("") |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to be_nil |
||||
end |
||||
end |
@ -0,0 +1,33 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::MonthlyRent, 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[mrent]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("monthly_rent") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to eq("") |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to eq("") |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to be_nil |
||||
end |
||||
end |
@ -0,0 +1,33 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::MortgageAmount, 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[mortgage]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq(nil) |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to eq("Mortgage Amount") |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to eq("") |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to be_nil |
||||
end |
||||
end |
@ -0,0 +1,35 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::PreviousBedrooms, 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[frombeds]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("previous_bedrooms") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to eq("About the buyers’ previous 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,33 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::PurchasePrice, 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("purchase_price") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to eq("") |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to eq("") |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to be_nil |
||||
end |
||||
end |
@ -0,0 +1,40 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::Resale, 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[resale]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("resale") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to eq("") |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to eq("") |
||||
end |
||||
|
||||
it "has the correct depends_on" do |
||||
expect(page.depends_on).to eq( |
||||
[{ |
||||
"staircase" => 2, |
||||
}, |
||||
{ |
||||
"staircase" => 3, |
||||
}], |
||||
) |
||||
end |
||||
end |
@ -0,0 +1,29 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::Staircase, 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[staircase]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("staircasing") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to eq("") |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to eq("") |
||||
end |
||||
end |
@ -0,0 +1,48 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::BuyerPrevious, 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("soctenant") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("Was the buyer a private registered provider, housing association or local authority tenant immediately before this sale?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Buyer was a registered provider, housing association or local authority tenant immediately before this sale?") |
||||
end |
||||
|
||||
it "has the correct type" do |
||||
expect(question.type).to eq("radio") |
||||
end |
||||
|
||||
it "is not marked as derived" do |
||||
expect(question.derived?).to be false |
||||
end |
||||
|
||||
it "has the correct answer_options" do |
||||
expect(question.answer_options).to eq({ |
||||
"1" => { "value" => "Yes" }, |
||||
"2" => { "value" => "No" }, |
||||
}) |
||||
end |
||||
|
||||
it "has correct conditional for" do |
||||
expect(question.conditional_for).to eq(nil) |
||||
end |
||||
|
||||
it "has the correct hint" do |
||||
expect(question.hint_text).to eq(nil) |
||||
end |
||||
end |
@ -0,0 +1,49 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::DepositAmount, 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("deposit") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("How much cash deposit was paid on the property?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Cash deposit") |
||||
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("Enter the total cash sum paid by the buyer towards the property that was not funded by the mortgage") |
||||
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 |
@ -0,0 +1,49 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::DepositDiscount, 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("cashdis") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("How much cash discount was given through Social HomeBuy?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Cash discount through SocialHomeBuy") |
||||
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("Enter the total cash discount given on the property being purchased through the Social HomeBuy scheme") |
||||
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 |
@ -0,0 +1,55 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::Discount, 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("discount") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("What was the percentage discount?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Percentage discount") |
||||
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("For Right to Buy (RTB), Preserved Right to Buy (PRTB), and Voluntary Right to Buy (VRTB)</br></br> |
||||
If discount capped, enter capped %</br></br> |
||||
If the property is being sold to an existing tenant under the RTB, PRTB, or VRTB schemes, enter the % discount from the full market value that is being given.") |
||||
end |
||||
|
||||
it "has correct width" do |
||||
expect(question.width).to eq(5) |
||||
end |
||||
|
||||
it "has correct suffix" do |
||||
expect(question.suffix).to eq("%") |
||||
end |
||||
|
||||
it "has correct min" do |
||||
expect(question.min).to eq(0) |
||||
end |
||||
|
||||
it "has correct max" do |
||||
expect(question.max).to eq(100) |
||||
end |
||||
end |
@ -0,0 +1,53 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::Equity, 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("equity") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("What was the initial percentage equity stake purchased?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Initial percentage equity stake") |
||||
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("Enter the amount of initial equity held by the purchaser (for example, 25% or 50%)") |
||||
end |
||||
|
||||
it "has correct width" do |
||||
expect(question.width).to eq(5) |
||||
end |
||||
|
||||
it "has correct suffix" do |
||||
expect(question.suffix).to eq("%") |
||||
end |
||||
|
||||
it "has correct min" do |
||||
expect(question.min).to eq(0) |
||||
end |
||||
|
||||
it "has correct max" do |
||||
expect(question.max).to eq(100) |
||||
end |
||||
end |
@ -0,0 +1,33 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::ExchangeDate, 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("exdate") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("What is the exchange of contracts date?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Exchange of contracts date") |
||||
end |
||||
|
||||
it "has the correct type" do |
||||
expect(question.type).to eq("date") |
||||
end |
||||
|
||||
it "is not marked as derived" do |
||||
expect(question.derived?).to be false |
||||
end |
||||
end |
@ -0,0 +1,49 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::Grant, 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("grant") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("What was the amount of any loan, grant, discount or subsidy given?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Amount of any loan, grant or subsidy") |
||||
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("For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB), Voluntary Right to Buy (VRTB)") |
||||
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 |
@ -0,0 +1,49 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::LaNominations, 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("lanomagr") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("Was the household rehoused under a 'local authority nominations agreement'?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Household rehoused under a local authority nominations agreement?") |
||||
end |
||||
|
||||
it "has the correct type" do |
||||
expect(question.type).to eq("radio") |
||||
end |
||||
|
||||
it "is not marked as derived" do |
||||
expect(question.derived?).to be false |
||||
end |
||||
|
||||
it "has the correct answer_options" do |
||||
expect(question.answer_options).to eq({ |
||||
"1" => { "value" => "Yes" }, |
||||
"2" => { "value" => "No" }, |
||||
"3" => { "value" => "Don’t know" }, |
||||
}) |
||||
end |
||||
|
||||
it "has correct conditional for" do |
||||
expect(question.conditional_for).to eq(nil) |
||||
end |
||||
|
||||
it "has the correct hint" do |
||||
expect(question.hint_text).to eq("A local authority nominations agreement is a written agreement between a local authority and private registered provider (PRP) that some or all of its sales vacancies are offered to local authorities for rehousing") |
||||
end |
||||
end |
@ -0,0 +1,57 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::LivingBeforePurchase, 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("proplen") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("How long did the buyer(s) live in the property before purchase?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Number of years living in the property before purchase") |
||||
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("You should round this up to the nearest year. If the buyers haven't been living in the property, enter '0'") |
||||
end |
||||
|
||||
it "has correct width" do |
||||
expect(question.width).to eq(5) |
||||
end |
||||
|
||||
it "has correct step" do |
||||
expect(question.step).to eq(1) |
||||
end |
||||
|
||||
it "has correct suffix" do |
||||
expect(question.suffix).to eq(" years") |
||||
end |
||||
|
||||
it "has correct min" do |
||||
expect(question.min).to eq(0) |
||||
end |
||||
|
||||
it "has correct max" do |
||||
expect(question.max).to eq(80) |
||||
end |
||||
end |
@ -0,0 +1,49 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::MonthlyRent, 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("mrent") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("What is the basic monthly rent?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Monthly rent") |
||||
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("Amount paid before any charges") |
||||
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 |
@ -0,0 +1,49 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::MortgageAmount, 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("mortgage") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("What is the mortgage amount?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Mortgage amount") |
||||
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 |
@ -0,0 +1,45 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::PreviousBedrooms, 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("frombeds") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("How many bedrooms did the property have?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Number of bedrooms in previous property") |
||||
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("For bedsits enter 1") |
||||
end |
||||
|
||||
it "has correct width" do |
||||
expect(question.width).to eq(5) |
||||
end |
||||
|
||||
it "has correct min" do |
||||
expect(question.min).to eq(0) |
||||
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 |
@ -0,0 +1,48 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::Resale, 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("resale") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("Is this a resale?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Is this a resale?") |
||||
end |
||||
|
||||
it "has the correct type" do |
||||
expect(question.type).to eq("radio") |
||||
end |
||||
|
||||
it "is not marked as derived" do |
||||
expect(question.derived?).to be false |
||||
end |
||||
|
||||
it "has the correct answer_options" do |
||||
expect(question.answer_options).to eq({ |
||||
"1" => { "value" => "Yes" }, |
||||
"2" => { "value" => "No" }, |
||||
}) |
||||
end |
||||
|
||||
it "has correct conditional for" do |
||||
expect(question.conditional_for).to eq(nil) |
||||
end |
||||
|
||||
it "has the correct hint" do |
||||
expect(question.hint_text).to eq("If the social landlord has previously sold the property to another buyer and is now reselling the property, select 'yes'. If this is the first time the property has been sold, select 'no'.") |
||||
end |
||||
end |
@ -0,0 +1,57 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::StaircaseBought, 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("stairbought") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("What percentage of the property has been bought in this staircasing transaction?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Percentage bought in this staircasing transaction") |
||||
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 be_nil |
||||
end |
||||
|
||||
it "has the correct width" do |
||||
expect(question.width).to eq(5) |
||||
end |
||||
|
||||
it "has the correct inferred check answers value" do |
||||
expect(question.inferred_check_answers_value).to eq(nil) |
||||
end |
||||
|
||||
it "has correct suffix" do |
||||
expect(question.suffix).to eq(" percent") |
||||
end |
||||
|
||||
it "has correct min" do |
||||
expect(question.min).to eq(0) |
||||
end |
||||
|
||||
it "has correct max" do |
||||
expect(question.max).to eq(100) |
||||
end |
||||
end |
@ -0,0 +1,57 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::StaircaseOwned, 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("stairowned") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("What percentage of the property does the buyer now own in total?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Percentage the buyer now owns in total") |
||||
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 be_nil |
||||
end |
||||
|
||||
it "has the correct width" do |
||||
expect(question.width).to eq(5) |
||||
end |
||||
|
||||
it "has the correct inferred check answers value" do |
||||
expect(question.inferred_check_answers_value).to eq(nil) |
||||
end |
||||
|
||||
it "has correct suffix" do |
||||
expect(question.suffix).to eq(" percent") |
||||
end |
||||
|
||||
it "has correct min" do |
||||
expect(question.min).to eq(0) |
||||
end |
||||
|
||||
it "has correct max" do |
||||
expect(question.max).to eq(100) |
||||
end |
||||
end |
@ -0,0 +1,49 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::Staircase, 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("staircase") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("Is this a staircasing transaction?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Staircasing transaction") |
||||
end |
||||
|
||||
it "has the correct type" do |
||||
expect(question.type).to eq("radio") |
||||
end |
||||
|
||||
it "is not marked as derived" do |
||||
expect(question.derived?).to be false |
||||
end |
||||
|
||||
it "has the correct answer_options" do |
||||
expect(question.answer_options).to eq({ |
||||
"1" => { "value" => "Yes" }, |
||||
"2" => { "value" => "No" }, |
||||
"3" => { "value" => "Don’t know" }, |
||||
}) |
||||
end |
||||
|
||||
it "has correct conditional for" do |
||||
expect(question.conditional_for).to eq(nil) |
||||
end |
||||
|
||||
it "has the correct hint" do |
||||
expect(question.hint_text).to eq("A staircasing transaction is when the household purchases more shares in their property, increasing the proportion they own and decreasing the proportion the housing association owns. Once the household purchases 100% of the shares, they own the property") |
||||
end |
||||
end |
@ -0,0 +1,49 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::Value, 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 was the full purchase price?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Full 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("Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser)") |
||||
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 |
@ -0,0 +1,33 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Sections::SaleInformation, type: :model do |
||||
subject(:sale_information) { described_class.new(section_id, section_definition, form) } |
||||
|
||||
let(:section_id) { nil } |
||||
let(:section_definition) { nil } |
||||
let(:form) { instance_double(Form) } |
||||
|
||||
it "has correct form" do |
||||
expect(sale_information.form).to eq(form) |
||||
end |
||||
|
||||
it "has correct subsections" do |
||||
expect(sale_information.subsections.map(&:id)).to eq(%w[ |
||||
shared_ownership_scheme |
||||
discounted_ownership_scheme |
||||
outright_sale |
||||
]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(sale_information.id).to eq("sale_information") |
||||
end |
||||
|
||||
it "has the correct label" do |
||||
expect(sale_information.label).to eq("Sale information") |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(sale_information.description).to eq("") |
||||
end |
||||
end |
@ -0,0 +1,57 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Subsections::DiscountedOwnershipScheme, type: :model do |
||||
subject(:discounted_ownership_scheme) { described_class.new(subsection_id, subsection_definition, section) } |
||||
|
||||
let(:subsection_id) { nil } |
||||
let(:subsection_definition) { nil } |
||||
let(:section) { instance_double(Form::Sales::Sections::SaleInformation) } |
||||
|
||||
it "has correct section" do |
||||
expect(discounted_ownership_scheme.section).to eq(section) |
||||
end |
||||
|
||||
it "has correct pages" do |
||||
expect(discounted_ownership_scheme.pages.map(&:id)).to eq( |
||||
%w[ |
||||
living_before_purchase_discounted_ownership |
||||
about_price_rtb |
||||
about_price_not_rtb |
||||
mortgage_amount_discounted_ownership |
||||
about_deposit_discounted_ownership |
||||
], |
||||
) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(discounted_ownership_scheme.id).to eq("discounted_ownership_scheme") |
||||
end |
||||
|
||||
it "has the correct label" do |
||||
expect(discounted_ownership_scheme.label).to eq("Discounted ownership scheme") |
||||
end |
||||
|
||||
it "has the correct depends_on" do |
||||
expect(discounted_ownership_scheme.depends_on).to eq([ |
||||
{ |
||||
"ownershipsch" => 2, "setup_completed?" => true |
||||
}, |
||||
]) |
||||
end |
||||
|
||||
context "when it is a discounted ownership scheme" do |
||||
let(:log) { FactoryBot.create(:sales_log, ownershipsch: 2) } |
||||
|
||||
it "is displayed in tasklist" do |
||||
expect(discounted_ownership_scheme.displayed_in_tasklist?(log)).to eq(true) |
||||
end |
||||
end |
||||
|
||||
context "when it is not a discounted ownership scheme" do |
||||
let(:log) { FactoryBot.create(:sales_log, ownershipsch: 1) } |
||||
|
||||
it "is displayed in tasklist" do |
||||
expect(discounted_ownership_scheme.displayed_in_tasklist?(log)).to eq(false) |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,53 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Subsections::OutrightSale, type: :model do |
||||
subject(:outright_sale) { described_class.new(subsection_id, subsection_definition, section) } |
||||
|
||||
let(:subsection_id) { nil } |
||||
let(:subsection_definition) { nil } |
||||
let(:section) { instance_double(Form::Sales::Sections::SaleInformation) } |
||||
|
||||
it "has correct section" do |
||||
expect(outright_sale.section).to eq(section) |
||||
end |
||||
|
||||
it "has correct pages" do |
||||
expect(outright_sale.pages.map(&:id)).to eq( |
||||
%w[purchase_price |
||||
mortgage_amount_outright_sale |
||||
about_deposit_outright_sale], |
||||
) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(outright_sale.id).to eq("outright_sale") |
||||
end |
||||
|
||||
it "has the correct label" do |
||||
expect(outright_sale.label).to eq("Outright sale") |
||||
end |
||||
|
||||
it "has the correct depends_on" do |
||||
expect(outright_sale.depends_on).to eq([ |
||||
{ |
||||
"ownershipsch" => 3, "setup_completed?" => true |
||||
}, |
||||
]) |
||||
end |
||||
|
||||
context "when it is a outright sale" do |
||||
let(:log) { FactoryBot.create(:sales_log, ownershipsch: 3) } |
||||
|
||||
it "is displayed in tasklist" do |
||||
expect(outright_sale.displayed_in_tasklist?(log)).to eq(true) |
||||
end |
||||
end |
||||
|
||||
context "when it is not a outright sale" do |
||||
let(:log) { FactoryBot.create(:sales_log, ownershipsch: 2) } |
||||
|
||||
it "is displayed in tasklist" do |
||||
expect(outright_sale.displayed_in_tasklist?(log)).to eq(false) |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,65 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Subsections::SharedOwnershipScheme, type: :model do |
||||
subject(:shared_ownership_scheme) { described_class.new(subsection_id, subsection_definition, section) } |
||||
|
||||
let(:subsection_id) { nil } |
||||
let(:subsection_definition) { nil } |
||||
let(:section) { instance_double(Form::Sales::Sections::SaleInformation) } |
||||
|
||||
it "has correct section" do |
||||
expect(shared_ownership_scheme.section).to eq(section) |
||||
end |
||||
|
||||
it "has correct pages" do |
||||
expect(shared_ownership_scheme.pages.map(&:id)).to eq( |
||||
%w[ |
||||
living_before_purchase_shared_ownership |
||||
staircasing |
||||
about_staircasing |
||||
resale |
||||
exchange_contracts |
||||
la_nominations |
||||
buyer_previous |
||||
previous_bedrooms |
||||
about_price_shared_ownership |
||||
mortgage_amount_shared_ownership |
||||
about_deposit_with_discount |
||||
about_deposit_shared_ownership |
||||
monthly_rent |
||||
], |
||||
) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(shared_ownership_scheme.id).to eq("shared_ownership_scheme") |
||||
end |
||||
|
||||
it "has the correct label" do |
||||
expect(shared_ownership_scheme.label).to eq("Shared ownership scheme") |
||||
end |
||||
|
||||
it "has the correct depends_on" do |
||||
expect(shared_ownership_scheme.depends_on).to eq([ |
||||
{ |
||||
"ownershipsch" => 1, "setup_completed?" => true |
||||
}, |
||||
]) |
||||
end |
||||
|
||||
context "when it is a shared ownership scheme" do |
||||
let(:log) { FactoryBot.create(:sales_log, ownershipsch: 1) } |
||||
|
||||
it "is displayed in tasklist" do |
||||
expect(shared_ownership_scheme.displayed_in_tasklist?(log)).to eq(true) |
||||
end |
||||
end |
||||
|
||||
context "when it is not a shared ownership scheme" do |
||||
let(:log) { FactoryBot.create(:sales_log, ownershipsch: 2) } |
||||
|
||||
it "is displayed in tasklist" do |
||||
expect(shared_ownership_scheme.displayed_in_tasklist?(log)).to eq(false) |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue