Browse Source
# Conflicts: # config/locales/forms/2025/sales/sale_information.en.ymlCLDC-3740-Replace-you-didnt-answer-with-link
Manny Dinssa
4 weeks ago
64 changed files with 986 additions and 85 deletions
@ -0,0 +1,17 @@
|
||||
class Form::Sales::Pages::MonthlyRentStaircasing < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "monthly_rent_staircasing" |
||||
@copy_key = "sales.sale_information.mrent_staircasing" |
||||
@depends_on = [{ |
||||
"stairowned_100?" => false, |
||||
}] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::MonthlyRentBeforeStaircasing.new(nil, nil, self), |
||||
Form::Sales::Questions::MonthlyRentAfterStaircasing.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,17 @@
|
||||
class Form::Sales::Pages::MonthlyRentStaircasingOwned < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "monthly_rent_staircasing_owned" |
||||
@copy_key = "sales.sale_information.mrent_staircasing" |
||||
@header = "" |
||||
@depends_on = [{ |
||||
"stairowned_100?" => true, |
||||
}] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::MonthlyRentBeforeStaircasing.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,15 @@
|
||||
class Form::Sales::Pages::StaircaseFirstTime < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super(id, hsh, subsection) |
||||
@id = "staircase_first_time" |
||||
@depends_on = [{ |
||||
"staircase" => 1, |
||||
}] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::StaircaseFirstTime.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,16 @@
|
||||
class Form::Sales::Pages::StaircaseInitialDate < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super(id, hsh, subsection) |
||||
@id = "staircase_initial_date" |
||||
@header = "" |
||||
@depends_on = [{ |
||||
"is_firststair?" => true, |
||||
}] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::StaircaseInitialDate.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,18 @@
|
||||
class Form::Sales::Pages::StaircasePrevious < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super(id, hsh, subsection) |
||||
@id = "staircase_previous" |
||||
@copy_key = "sales.sale_information.stairprevious" |
||||
@depends_on = [{ |
||||
"is_firststair?" => false, |
||||
}] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::StaircaseCount.new(nil, nil, self), |
||||
Form::Sales::Questions::StaircaseLastDate.new(nil, nil, self), |
||||
Form::Sales::Questions::StaircaseInitialDate.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,17 @@
|
||||
class Form::Sales::Pages::StaircaseSale < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super(id, hsh, subsection) |
||||
@id = "staircase_sale" |
||||
@copy_key = form.start_year_2025_or_later? ? "sales.sale_information.staircasesale" : "sales.sale_information.about_staircasing.staircasesale" |
||||
@depends_on = [{ |
||||
"staircase" => 1, |
||||
"stairowned" => 100, |
||||
}] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::StaircaseSale.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,15 @@
|
||||
class Form::Sales::Questions::MonthlyRentAfterStaircasing < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "mrent" |
||||
@copy_key = "sales.sale_information.mrent_staircasing.poststaircasing" |
||||
@type = "numeric" |
||||
@min = 0 |
||||
@step = 0.01 |
||||
@width = 5 |
||||
@prefix = "£" |
||||
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] |
||||
end |
||||
|
||||
QUESTION_NUMBER_FROM_YEAR = { 2025 => 99 }.freeze |
||||
end |
@ -0,0 +1,15 @@
|
||||
class Form::Sales::Questions::MonthlyRentBeforeStaircasing < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "mrentprestaircasing" |
||||
@copy_key = "sales.sale_information.mrent_staircasing.prestaircasing" |
||||
@type = "numeric" |
||||
@min = 0 |
||||
@step = 0.01 |
||||
@width = 5 |
||||
@prefix = "£" |
||||
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] |
||||
end |
||||
|
||||
QUESTION_NUMBER_FROM_YEAR = { 2025 => 98 }.freeze |
||||
end |
@ -0,0 +1,15 @@
|
||||
class Form::Sales::Questions::StaircaseCount < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "numstair" |
||||
@copy_key = "sales.sale_information.stairprevious.numstair" |
||||
@type = "numeric" |
||||
@width = 2 |
||||
@min = 2 |
||||
@max = 10 |
||||
@step = 1 |
||||
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] |
||||
end |
||||
|
||||
QUESTION_NUMBER_FROM_YEAR = { 2025 => 82 }.freeze |
||||
end |
@ -0,0 +1,16 @@
|
||||
class Form::Sales::Questions::StaircaseFirstTime < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "firststair" |
||||
@type = "radio" |
||||
@answer_options = ANSWER_OPTIONS |
||||
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] |
||||
end |
||||
|
||||
ANSWER_OPTIONS = { |
||||
"1" => { "value" => "Yes" }, |
||||
"2" => { "value" => "No" }, |
||||
}.freeze |
||||
|
||||
QUESTION_NUMBER_FROM_YEAR = { 2025 => 81 }.freeze |
||||
end |
@ -0,0 +1,11 @@
|
||||
class Form::Sales::Questions::StaircaseInitialDate < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "initialpurchase" |
||||
@copy_key = "sales.sale_information.stairprevious.initialpurchase" |
||||
@type = "date" |
||||
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] |
||||
end |
||||
|
||||
QUESTION_NUMBER_FROM_YEAR = { 2025 => 83 }.freeze |
||||
end |
@ -0,0 +1,11 @@
|
||||
class Form::Sales::Questions::StaircaseLastDate < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "lasttransaction" |
||||
@copy_key = "sales.sale_information.stairprevious.lasttransaction" |
||||
@type = "date" |
||||
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] |
||||
end |
||||
|
||||
QUESTION_NUMBER_FROM_YEAR = { 2025 => 83 }.freeze |
||||
end |
@ -0,0 +1,35 @@
|
||||
class Form::Sales::Subsections::SharedOwnershipStaircasingTransaction < ::Form::Subsection |
||||
def initialize(id, hsh, section) |
||||
super |
||||
@id = "shared_ownership_staircasing_transaction" |
||||
@label = "Shared ownership - staircasing transaction" |
||||
@depends_on = [{ "ownershipsch" => 1, "setup_completed?" => true, "staircase" => 1 }] |
||||
@copy_key = "sale_information" |
||||
end |
||||
|
||||
def pages |
||||
@pages ||= [ |
||||
Form::Sales::Pages::AboutStaircase.new("about_staircasing_joint_purchase", nil, self, joint_purchase: true), |
||||
Form::Sales::Pages::AboutStaircase.new("about_staircasing_not_joint_purchase", nil, self, joint_purchase: false), |
||||
Form::Sales::Pages::StaircaseSale.new(nil, nil, self), |
||||
Form::Sales::Pages::StaircaseBoughtValueCheck.new(nil, nil, self), |
||||
Form::Sales::Pages::StaircaseOwnedValueCheck.new("staircase_owned_value_check_joint_purchase", nil, self, joint_purchase: true), |
||||
Form::Sales::Pages::StaircaseOwnedValueCheck.new("staircase_owned_value_check_not_joint_purchase", nil, self, joint_purchase: false), |
||||
Form::Sales::Pages::StaircaseFirstTime.new(nil, nil, self), |
||||
Form::Sales::Pages::StaircasePrevious.new(nil, nil, self), |
||||
Form::Sales::Pages::StaircaseInitialDate.new(nil, nil, self), |
||||
Form::Sales::Pages::ValueSharedOwnership.new("value_shared_ownership_staircase", nil, self), |
||||
Form::Sales::Pages::AboutPriceValueCheck.new("about_price_shared_ownership_value_check", nil, self), |
||||
Form::Sales::Pages::Equity.new("staircase_equity", nil, self), |
||||
Form::Sales::Pages::SharedOwnershipDepositValueCheck.new("shared_ownership_equity_value_check", nil, self), |
||||
Form::Sales::Pages::Mortgageused.new("staircase_mortgage_used_shared_ownership", nil, self, ownershipsch: 1), |
||||
Form::Sales::Pages::MonthlyRentStaircasingOwned.new(nil, nil, self), |
||||
Form::Sales::Pages::MonthlyRentStaircasing.new(nil, nil, self), |
||||
Form::Sales::Pages::MonthlyChargesValueCheck.new("monthly_charges_shared_ownership_value_check", nil, self), |
||||
].compact |
||||
end |
||||
|
||||
def displayed_in_tasklist?(log) |
||||
log.staircase == 1 && (log.ownershipsch.nil? || log.ownershipsch == 1) |
||||
end |
||||
end |
@ -0,0 +1,11 @@
|
||||
class AddFieldsToSalesLog < ActiveRecord::Migration[7.0] |
||||
def change |
||||
change_table :sales_logs, bulk: true do |t| |
||||
t.column :firststair, :integer |
||||
t.column :numstair, :integer |
||||
t.column :mrentprestaircasing, :decimal, precision: 10, scale: 2 |
||||
t.column :lasttransaction, :datetime |
||||
t.column :initialpurchase, :datetime |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,31 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::MonthlyRentStaircasingOwned, 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, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 1))) } |
||||
|
||||
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[mrentprestaircasing]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("monthly_rent_staircasing_owned") |
||||
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([ |
||||
{ "stairowned_100?" => true }, |
||||
]) |
||||
end |
||||
end |
@ -0,0 +1,31 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::MonthlyRentStaircasing, 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, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 1))) } |
||||
|
||||
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[mrentprestaircasing mrent]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("monthly_rent_staircasing") |
||||
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([ |
||||
{ "stairowned_100?" => false }, |
||||
]) |
||||
end |
||||
end |
@ -0,0 +1,31 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::StaircaseFirstTime, 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, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 1))) } |
||||
|
||||
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[firststair]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("staircase_first_time") |
||||
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([ |
||||
{ "staircase" => 1 }, |
||||
]) |
||||
end |
||||
end |
@ -0,0 +1,31 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::StaircaseInitialDate, 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, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 1))) } |
||||
|
||||
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[initialpurchase]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("staircase_initial_date") |
||||
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([ |
||||
{ "is_firststair?" => true }, |
||||
]) |
||||
end |
||||
end |
@ -0,0 +1,31 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::StaircasePrevious, 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, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 1))) } |
||||
|
||||
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[numstair lasttransaction initialpurchase]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("staircase_previous") |
||||
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([ |
||||
{ "is_firststair?" => false }, |
||||
]) |
||||
end |
||||
end |
@ -0,0 +1,38 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::StaircaseSale, 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, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 1))) } |
||||
|
||||
before do |
||||
allow(subsection.form).to receive(:start_year_2025_or_later?).and_return(true) |
||||
end |
||||
|
||||
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[staircasesale]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("staircase_sale") |
||||
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([ |
||||
{ |
||||
"staircase" => 1, |
||||
"stairowned" => 100, |
||||
}, |
||||
]) |
||||
end |
||||
end |
@ -0,0 +1,37 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::MonthlyRentAfterStaircasing, 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, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } |
||||
|
||||
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 type" do |
||||
expect(question.type).to eq("numeric") |
||||
end |
||||
|
||||
it "is not marked as derived" do |
||||
expect(question.derived?(nil)).to be false |
||||
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,37 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::MonthlyRentBeforeStaircasing, 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, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } |
||||
|
||||
it "has correct page" do |
||||
expect(question.page).to eq(page) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("mrentprestaircasing") |
||||
end |
||||
|
||||
it "has the correct type" do |
||||
expect(question.type).to eq("numeric") |
||||
end |
||||
|
||||
it "is not marked as derived" do |
||||
expect(question.derived?(nil)).to be false |
||||
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::Questions::StaircaseCount, 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, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 1)))) } |
||||
|
||||
before do |
||||
allow(page.subsection.form).to receive(:start_year_2025_or_later?).and_return(true) |
||||
end |
||||
|
||||
it "has correct page" do |
||||
expect(question.page).to eq(page) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("numstair") |
||||
end |
||||
|
||||
it "has the correct type" do |
||||
expect(question.type).to eq("numeric") |
||||
end |
||||
|
||||
it "is not marked as derived" do |
||||
expect(question.derived?(nil)).to be false |
||||
end |
||||
|
||||
it "has correct conditional for" do |
||||
expect(question.conditional_for).to eq(nil) |
||||
end |
||||
end |
@ -0,0 +1,40 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::StaircaseFirstTime, 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, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 1)))) } |
||||
|
||||
before do |
||||
allow(page.subsection.form).to receive(:start_year_2025_or_later?).and_return(true) |
||||
end |
||||
|
||||
it "has correct page" do |
||||
expect(question.page).to eq(page) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("firststair") |
||||
end |
||||
|
||||
it "has the correct type" do |
||||
expect(question.type).to eq("radio") |
||||
end |
||||
|
||||
it "is not marked as derived" do |
||||
expect(question.derived?(nil)).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 |
||||
end |
@ -0,0 +1,33 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::StaircaseInitialDate, 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, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 1)))) } |
||||
|
||||
before do |
||||
allow(page.subsection.form).to receive(:start_year_2025_or_later?).and_return(true) |
||||
end |
||||
|
||||
it "has correct page" do |
||||
expect(question.page).to eq(page) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("initialpurchase") |
||||
end |
||||
|
||||
it "has the correct type" do |
||||
expect(question.type).to eq("date") |
||||
end |
||||
|
||||
it "is not marked as derived" do |
||||
expect(question.derived?(nil)).to be false |
||||
end |
||||
|
||||
it "has correct conditional for" do |
||||
expect(question.conditional_for).to eq(nil) |
||||
end |
||||
end |
@ -0,0 +1,33 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::StaircaseLastDate, 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, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 1)))) } |
||||
|
||||
before do |
||||
allow(page.subsection.form).to receive(:start_year_2025_or_later?).and_return(true) |
||||
end |
||||
|
||||
it "has correct page" do |
||||
expect(question.page).to eq(page) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("lasttransaction") |
||||
end |
||||
|
||||
it "has the correct type" do |
||||
expect(question.type).to eq("date") |
||||
end |
||||
|
||||
it "is not marked as derived" do |
||||
expect(question.derived?(nil)).to be false |
||||
end |
||||
|
||||
it "has correct conditional for" do |
||||
expect(question.conditional_for).to eq(nil) |
||||
end |
||||
end |
Loading…
Reference in new issue