Browse Source
* Allow interruption screens to format money values * Remove formatting from saleslog method * Use money flag * Use pre exhisting method to format values * Update config/locales/en.yml Co-authored-by: Arthur Campbell <51094020+arfacamble@users.noreply.github.com> --------- Co-authored-by: Arthur Campbell <51094020+arfacamble@users.noreply.github.com>pull/1542/head
Jack
2 years ago
committed by
GitHub
17 changed files with 304 additions and 52 deletions
@ -0,0 +1,37 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Lettings::Pages::MaxRentValueCheck, 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(: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[rent_value_check]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("max_rent_value_check") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to be_nil |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq([{ "rent_in_soft_max_range?" => true }]) |
||||
end |
||||
|
||||
it "has the correct title_text" do |
||||
expect(page.title_text).to eq({ "arguments" => [{ "i18n_template" => "brent", "key" => "brent", "label" => true }], "translation" => "soft_validations.rent.outside_range_title" }) |
||||
end |
||||
|
||||
it "has the correct informative_text" do |
||||
expect(page.informative_text).to eq({ "arguments" => [{ "arguments_for_key" => "soft_max_for_period", "i18n_template" => "soft_max_for_period", "key" => "field_formatted_as_currency" }], "translation" => "soft_validations.rent.max_hint_text" }) |
||||
end |
||||
end |
@ -0,0 +1,48 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Lettings::Pages::MinRentValueCheck, type: :model do |
||||
subject(:page) { described_class.new(nil, page_definition, subsection) } |
||||
|
||||
let(:page_definition) { nil } |
||||
let(:subsection) { instance_double(Form::Subsection) } |
||||
|
||||
it "has correct subsection" do |
||||
expect(page.subsection).to eq(subsection) |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to be nil |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to be nil |
||||
end |
||||
|
||||
it "has correct questions" do |
||||
expect(page.questions.map(&:id)).to eq(%w[rent_value_check]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("min_rent_value_check") |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq( |
||||
[{ "rent_in_soft_min_range?" => true }], |
||||
) |
||||
end |
||||
|
||||
it "has the correct title_text" do |
||||
expect(page.title_text).to eq({ |
||||
"translation" => "soft_validations.rent.outside_range_title", |
||||
"arguments" => [{ "i18n_template" => "brent", "key" => "brent", "label" => true }], |
||||
}) |
||||
end |
||||
|
||||
it "has the correct informative_text" do |
||||
expect(page.informative_text).to eq({ |
||||
"arguments" => [{ "arguments_for_key" => "soft_min_for_period", "i18n_template" => "soft_min_for_period", "key" => "field_formatted_as_currency" }], |
||||
"translation" => "soft_validations.rent.min_hint_text", |
||||
}) |
||||
end |
||||
end |
@ -0,0 +1,40 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Lettings::Pages::NetIncomeValueCheck, 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(: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[net_income_value_check]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("net_income_value_check") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to be_nil |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq([{ "net_income_soft_validation_triggered?" => true }]) |
||||
end |
||||
|
||||
it "has the correct title_text" do |
||||
expect(page.title_text).to eq({ "translation" => "soft_validations.net_income.title_text" }) |
||||
end |
||||
|
||||
it "has the correct informative_text" do |
||||
expect(page.informative_text).to eq({ |
||||
"arguments" => [{ "arguments_for_key" => "ecstat1", "i18n_template" => "ecstat1", "key" => "field_formatted_as_currency" }, { "arguments_for_key" => "earnings", "i18n_template" => "earnings", "key" => "field_formatted_as_currency" }], |
||||
"translation" => "soft_validations.net_income.hint_text", |
||||
}) |
||||
end |
||||
end |
@ -0,0 +1,54 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::AboutPriceValueCheck, type: :model do |
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { "savings_value_check" } |
||||
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_value_check]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("savings_value_check") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(page.header).to be_nil |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq([{ "purchase_price_out_of_soft_range?" => true }]) |
||||
end |
||||
|
||||
it "is interruption screen page" do |
||||
expect(page.interruption_screen?).to eq(true) |
||||
end |
||||
|
||||
it "has the correct title_text" do |
||||
expect(page.title_text).to eq({ "arguments" => [{ "i18n_template" => "value", "key" => "value", "label" => true }], "translation" => "soft_validations.purchase_price.title_text" }) |
||||
end |
||||
|
||||
it "has the correct informative_text" do |
||||
expect(page.informative_text).to eq({ |
||||
"translation" => "soft_validations.purchase_price.hint_text", |
||||
"arguments" => [ |
||||
{ |
||||
"key" => "field_formatted_as_currency", |
||||
"arguments_for_key" => "purchase_price_soft_min_or_soft_max", |
||||
"i18n_template" => "soft_min_or_soft_max", |
||||
}, |
||||
{ |
||||
"key" => "purchase_price_min_or_max_text", |
||||
"i18n_template" => "min_or_max", |
||||
}, |
||||
], |
||||
}) |
||||
end |
||||
end |
Loading…
Reference in new issue