12 changed files with 0 additions and 319 deletions
@ -1,35 +0,0 @@ |
|||||||
class Form::Sales::Pages::SharedOwnershipDepositValueCheck < ::Form::Page |
|
||||||
def initialize(id, hsh, subsection) |
|
||||||
super |
|
||||||
@depends_on = [ |
|
||||||
{ |
|
||||||
"shared_ownership_deposit_invalid?" => true, |
|
||||||
}, |
|
||||||
] |
|
||||||
@copy_key = "sales.soft_validations.shared_ownership_deposit_value_check" |
|
||||||
@title_text = { |
|
||||||
"translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text", |
|
||||||
"arguments" => [ |
|
||||||
{ |
|
||||||
"key" => "mortgage_deposit_and_discount_error_fields", |
|
||||||
"i18n_template" => "mortgage_deposit_and_discount_error_fields", |
|
||||||
}, |
|
||||||
{ |
|
||||||
"key" => "field_formatted_as_currency", |
|
||||||
"arguments_for_key" => "mortgage_deposit_and_discount_total", |
|
||||||
"i18n_template" => "mortgage_deposit_and_discount_total", |
|
||||||
}, |
|
||||||
], |
|
||||||
} |
|
||||||
end |
|
||||||
|
|
||||||
def questions |
|
||||||
@questions ||= [ |
|
||||||
Form::Sales::Questions::SharedOwnershipDepositValueCheck.new(nil, nil, self), |
|
||||||
] |
|
||||||
end |
|
||||||
|
|
||||||
def interruption_screen_question_ids |
|
||||||
%w[mortgage mortgageused cashdis type deposit value equity] |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,22 +0,0 @@ |
|||||||
class Form::Sales::Questions::SharedOwnershipDepositValueCheck < ::Form::Question |
|
||||||
def initialize(id, hsh, page) |
|
||||||
super |
|
||||||
@id = "shared_ownership_deposit_value_check" |
|
||||||
@copy_key = "sales.soft_validations.shared_ownership_deposit_value_check" |
|
||||||
@type = "interruption_screen" |
|
||||||
@answer_options = { |
|
||||||
"0" => { "value" => "Yes" }, |
|
||||||
"1" => { "value" => "No" }, |
|
||||||
} |
|
||||||
@hidden_in_check_answers = { |
|
||||||
"depends_on" => [ |
|
||||||
{ |
|
||||||
"shared_ownership_deposit_value_check" => 0, |
|
||||||
}, |
|
||||||
{ |
|
||||||
"shared_ownership_deposit_value_check" => 1, |
|
||||||
}, |
|
||||||
], |
|
||||||
} |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,44 +0,0 @@ |
|||||||
require "rails_helper" |
|
||||||
|
|
||||||
RSpec.describe Form::Sales::Pages::SharedOwnershipDepositValueCheck, type: :model do |
|
||||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
|
||||||
|
|
||||||
let(:page_id) { "shared_ownership_deposit_value_check" } |
|
||||||
let(:page_definition) { nil } |
|
||||||
let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) } |
|
||||||
let(:subsection) { instance_double(Form::Subsection, form:) } |
|
||||||
|
|
||||||
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[shared_ownership_deposit_value_check]) |
|
||||||
end |
|
||||||
|
|
||||||
it "has the correct id" do |
|
||||||
expect(page.id).to eq("shared_ownership_deposit_value_check") |
|
||||||
end |
|
||||||
|
|
||||||
it "has correct depends_on" do |
|
||||||
expect(page.depends_on).to eq([ |
|
||||||
{ |
|
||||||
"shared_ownership_deposit_invalid?" => true, |
|
||||||
}, |
|
||||||
]) |
|
||||||
end |
|
||||||
|
|
||||||
it "has the correct title_text" do |
|
||||||
expect(page.title_text).to eq({ |
|
||||||
"translation" => "forms.2024.sales.soft_validations.shared_ownership_deposit_value_check.title_text", |
|
||||||
"arguments" => [ |
|
||||||
{ "i18n_template" => "mortgage_deposit_and_discount_error_fields", "key" => "mortgage_deposit_and_discount_error_fields" }, |
|
||||||
{ "arguments_for_key" => "mortgage_deposit_and_discount_total", "i18n_template" => "mortgage_deposit_and_discount_total", "key" => "field_formatted_as_currency" }, |
|
||||||
], |
|
||||||
}) |
|
||||||
end |
|
||||||
|
|
||||||
it "has the correct interruption_screen_question_ids" do |
|
||||||
expect(page.interruption_screen_question_ids).to eq(%w[mortgage mortgageused cashdis type deposit value equity]) |
|
||||||
end |
|
||||||
end |
|
||||||
@ -1,45 +0,0 @@ |
|||||||
require "rails_helper" |
|
||||||
|
|
||||||
RSpec.describe Form::Sales::Questions::SharedOwnershipDepositValueCheck, 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("shared_ownership_deposit_value_check") |
|
||||||
end |
|
||||||
|
|
||||||
it "has the correct type" do |
|
||||||
expect(question.type).to eq("interruption_screen") |
|
||||||
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({ |
|
||||||
"0" => { "value" => "Yes" }, |
|
||||||
"1" => { "value" => "No" }, |
|
||||||
}) |
|
||||||
end |
|
||||||
|
|
||||||
it "has the correct hidden_in_check_answers" do |
|
||||||
expect(question.hidden_in_check_answers).to eq({ |
|
||||||
"depends_on" => [ |
|
||||||
{ |
|
||||||
"shared_ownership_deposit_value_check" => 0, |
|
||||||
}, |
|
||||||
{ |
|
||||||
"shared_ownership_deposit_value_check" => 1, |
|
||||||
}, |
|
||||||
], |
|
||||||
}) |
|
||||||
end |
|
||||||
end |
|
||||||
Loading…
Reference in new issue