Browse Source
* CLDC-2439: min and max rent value check questions created * CLDC-2439: Informative removed, check pages fixed. * CLDC-2439: removed informative info tests and rent value check * CLDC-2439: fixed informative missing test failure * CLDC-2439: Text moved to en.yml * CLDC-2439: tests added, copy moved to en.yml * CLDC-2439: tests added, copy moved to en.yml * CLDC-2439: content change for bulk upload errors WIP * CLDC-2439: informative rendering change, content change, test updated * CLDC-2439: failing test fix. * CLDC-2439: display_informative_text test added for strings * CLDC-2439: string as var in testpull/1742/head
Aaron Spencer
2 years ago
committed by
GitHub
12 changed files with 125 additions and 48 deletions
@ -0,0 +1,15 @@
|
||||
class Form::Lettings::Questions::MaxRentValueCheck < ::Form::Question |
||||
def initialize(id, hsh, page, check_answers_card_number:) |
||||
super(id, hsh, page) |
||||
@id = "rent_value_check" |
||||
@check_answer_label = "Total rent confirmation" |
||||
@header = "Are you sure this is correct?" |
||||
@type = "interruption_screen" |
||||
@hint_text = I18n.t("soft_validations.rent.hint_text", higher_or_lower: "higher") |
||||
@check_answers_card_number = check_answers_card_number |
||||
@answer_options = ANSWER_OPTIONS |
||||
@hidden_in_check_answers = { "depends_on" => [{ "rent_value_check" => 0 }, { "rent_value_check" => 1 }] } |
||||
end |
||||
|
||||
ANSWER_OPTIONS = { "0" => { "value" => "Yes" }, "1" => { "value" => "No" } }.freeze |
||||
end |
@ -1,10 +1,11 @@
|
||||
class Form::Lettings::Questions::RentValueCheck < ::Form::Question |
||||
class Form::Lettings::Questions::MinRentValueCheck < ::Form::Question |
||||
def initialize(id, hsh, page, check_answers_card_number:) |
||||
super(id, hsh, page) |
||||
@id = "rent_value_check" |
||||
@check_answer_label = "Total rent confirmation" |
||||
@header = "Are you sure this is correct?" |
||||
@type = "interruption_screen" |
||||
@hint_text = I18n.t("soft_validations.rent.hint_text", higher_or_lower: "lower") |
||||
@check_answers_card_number = check_answers_card_number |
||||
@answer_options = ANSWER_OPTIONS |
||||
@hidden_in_check_answers = { "depends_on" => [{ "rent_value_check" => 0 }, { "rent_value_check" => 1 }] } |
@ -0,0 +1,44 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Lettings::Questions::MaxRentValueCheck, type: :model do |
||||
subject(:question) { described_class.new(nil, question_definition, page, check_answers_card_number:) } |
||||
|
||||
let(:question_definition) { nil } |
||||
let(:check_answers_card_number) { 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("rent_value_check") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("Are you sure this is correct?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Total rent confirmation") |
||||
end |
||||
|
||||
it "has the correct type" do |
||||
expect(question.type).to eq("interruption_screen") |
||||
end |
||||
|
||||
it "has the correct hint" do |
||||
expect(question.hint_text).to eq("Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the rent type is correct, for example affordable or social rent</li></ul>") |
||||
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" => [{ "rent_value_check" => 0 }, { "rent_value_check" => 1 }] }) |
||||
end |
||||
end |
@ -0,0 +1,44 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Lettings::Questions::MinRentValueCheck, type: :model do |
||||
subject(:question) { described_class.new(nil, question_definition, page, check_answers_card_number:) } |
||||
|
||||
let(:question_definition) { nil } |
||||
let(:check_answers_card_number) { 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("rent_value_check") |
||||
end |
||||
|
||||
it "has the correct header" do |
||||
expect(question.header).to eq("Are you sure this is correct?") |
||||
end |
||||
|
||||
it "has the correct check_answer_label" do |
||||
expect(question.check_answer_label).to eq("Total rent confirmation") |
||||
end |
||||
|
||||
it "has the correct type" do |
||||
expect(question.type).to eq("interruption_screen") |
||||
end |
||||
|
||||
it "has the correct hint" do |
||||
expect(question.hint_text).to eq("Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the rent type is correct, for example affordable or social rent</li></ul>") |
||||
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" => [{ "rent_value_check" => 0 }, { "rent_value_check" => 1 }] }) |
||||
end |
||||
end |
Loading…
Reference in new issue