17 changed files with 218 additions and 180 deletions
@ -1,13 +0,0 @@
|
||||
class Form::Lettings::Pages::NoFemalesPregnantHouseholdPerson3AgeValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "no_females_pregnant_household_person_3_age_value_check" |
||||
@depends_on = [{ "no_females_in_a_pregnant_household?" => true, "age3_known" => 0 }] |
||||
@title_text = { "translation" => "soft_validations.pregnancy.title", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
@informative_text = { "translation" => "soft_validations.pregnancy.no_females", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [Form::Lettings::Questions::PregnancyValueCheck.new(nil, nil, self)] |
||||
end |
||||
end |
||||
@ -1,13 +0,0 @@
|
||||
class Form::Lettings::Pages::NoFemalesPregnantHouseholdPerson3ValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "no_females_pregnant_household_person_3_value_check" |
||||
@depends_on = [{ "no_females_in_a_pregnant_household?" => true, "details_known_3" => 0 }] |
||||
@title_text = { "translation" => "soft_validations.pregnancy.title", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
@informative_text = { "translation" => "soft_validations.pregnancy.no_females", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [Form::Lettings::Questions::PregnancyValueCheck.new(nil, nil, self)] |
||||
end |
||||
end |
||||
@ -1,13 +0,0 @@
|
||||
class Form::Lettings::Pages::NoFemalesPregnantHouseholdPerson4AgeValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "no_females_pregnant_household_person_4_age_value_check" |
||||
@depends_on = [{ "no_females_in_a_pregnant_household?" => true, "age4_known" => 0 }] |
||||
@title_text = { "translation" => "soft_validations.pregnancy.title", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
@informative_text = { "translation" => "soft_validations.pregnancy.no_females", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [Form::Lettings::Questions::PregnancyValueCheck.new(nil, nil, self)] |
||||
end |
||||
end |
||||
@ -1,13 +0,0 @@
|
||||
class Form::Lettings::Pages::NoFemalesPregnantHouseholdPerson4ValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "no_females_pregnant_household_person_4_value_check" |
||||
@depends_on = [{ "no_females_in_a_pregnant_household?" => true, "details_known_4" => 0 }] |
||||
@title_text = { "translation" => "soft_validations.pregnancy.title", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
@informative_text = { "translation" => "soft_validations.pregnancy.no_females", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [Form::Lettings::Questions::PregnancyValueCheck.new(nil, nil, self)] |
||||
end |
||||
end |
||||
@ -1,13 +0,0 @@
|
||||
class Form::Lettings::Pages::NoFemalesPregnantHouseholdPerson5AgeValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "no_females_pregnant_household_person_5_age_value_check" |
||||
@depends_on = [{ "no_females_in_a_pregnant_household?" => true, "age5_known" => 0 }] |
||||
@title_text = { "translation" => "soft_validations.pregnancy.title", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
@informative_text = { "translation" => "soft_validations.pregnancy.no_females", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [Form::Lettings::Questions::PregnancyValueCheck.new(nil, nil, self)] |
||||
end |
||||
end |
||||
@ -1,13 +0,0 @@
|
||||
class Form::Lettings::Pages::NoFemalesPregnantHouseholdPerson5ValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "no_females_pregnant_household_person_5_value_check" |
||||
@depends_on = [{ "no_females_in_a_pregnant_household?" => true, "details_known_5" => 0 }] |
||||
@title_text = { "translation" => "soft_validations.pregnancy.title", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
@informative_text = { "translation" => "soft_validations.pregnancy.no_females", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [Form::Lettings::Questions::PregnancyValueCheck.new(nil, nil, self)] |
||||
end |
||||
end |
||||
@ -1,13 +0,0 @@
|
||||
class Form::Lettings::Pages::NoFemalesPregnantHouseholdPerson6AgeValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "no_females_pregnant_household_person_6_age_value_check" |
||||
@depends_on = [{ "no_females_in_a_pregnant_household?" => true, "age6_known" => 0 }] |
||||
@title_text = { "translation" => "soft_validations.pregnancy.title", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
@informative_text = { "translation" => "soft_validations.pregnancy.no_females", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [Form::Lettings::Questions::PregnancyValueCheck.new(nil, nil, self)] |
||||
end |
||||
end |
||||
@ -1,13 +0,0 @@
|
||||
class Form::Lettings::Pages::NoFemalesPregnantHouseholdPerson6ValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "no_females_pregnant_household_person_6_value_check" |
||||
@depends_on = [{ "no_females_in_a_pregnant_household?" => true, "details_known_6" => 0 }] |
||||
@title_text = { "translation" => "soft_validations.pregnancy.title", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
@informative_text = { "translation" => "soft_validations.pregnancy.no_females", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [Form::Lettings::Questions::PregnancyValueCheck.new(nil, nil, self)] |
||||
end |
||||
end |
||||
@ -1,13 +0,0 @@
|
||||
class Form::Lettings::Pages::NoFemalesPregnantHouseholdPerson7AgeValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "no_females_pregnant_household_person_7_age_value_check" |
||||
@depends_on = [{ "no_females_in_a_pregnant_household?" => true, "age7_known" => 0 }] |
||||
@title_text = { "translation" => "soft_validations.pregnancy.title", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
@informative_text = { "translation" => "soft_validations.pregnancy.no_females", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [Form::Lettings::Questions::PregnancyValueCheck.new(nil, nil, self)] |
||||
end |
||||
end |
||||
@ -1,13 +0,0 @@
|
||||
class Form::Lettings::Pages::NoFemalesPregnantHouseholdPerson7ValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "no_females_pregnant_household_person_7_value_check" |
||||
@depends_on = [{ "no_females_in_a_pregnant_household?" => true, "details_known_7" => 0 }] |
||||
@title_text = { "translation" => "soft_validations.pregnancy.title", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
@informative_text = { "translation" => "soft_validations.pregnancy.no_females", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [Form::Lettings::Questions::PregnancyValueCheck.new(nil, nil, self)] |
||||
end |
||||
end |
||||
@ -1,13 +0,0 @@
|
||||
class Form::Lettings::Pages::NoFemalesPregnantHouseholdPerson8AgeValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "no_females_pregnant_household_person_8_age_value_check" |
||||
@depends_on = [{ "no_females_in_a_pregnant_household?" => true, "age8_known" => 0 }] |
||||
@title_text = { "translation" => "soft_validations.pregnancy.title", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
@informative_text = { "translation" => "soft_validations.pregnancy.no_females", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [Form::Lettings::Questions::PregnancyValueCheck.new(nil, nil, self)] |
||||
end |
||||
end |
||||
@ -1,13 +0,0 @@
|
||||
class Form::Lettings::Pages::NoFemalesPregnantHouseholdPerson8ValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "no_females_pregnant_household_person_8_value_check" |
||||
@depends_on = [{ "no_females_in_a_pregnant_household?" => true, "details_known_8" => 0 }] |
||||
@title_text = { "translation" => "soft_validations.pregnancy.title", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
@informative_text = { "translation" => "soft_validations.pregnancy.no_females", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [Form::Lettings::Questions::PregnancyValueCheck.new(nil, nil, self)] |
||||
end |
||||
end |
||||
@ -1,8 +1,8 @@
|
||||
class Form::Lettings::Pages::NoFemalesPregnantHouseholdPerson2ValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "no_females_pregnant_household_person_2_value_check" |
||||
@depends_on = [{ "no_females_in_a_pregnant_household?" => true, "details_known_2" => 0 }] |
||||
class Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection, person_index:) |
||||
super(id, hsh, subsection) |
||||
@id = "no_females_pregnant_household_person_#{person_index}_age_value_check" |
||||
@depends_on = [{ "no_females_in_a_pregnant_household?" => true, "age#{person_index}_known" => 0 }] |
||||
@title_text = { "translation" => "soft_validations.pregnancy.title", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
@informative_text = { "translation" => "soft_validations.pregnancy.no_females", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
end |
||||
@ -1,8 +1,8 @@
|
||||
class Form::Lettings::Pages::NoFemalesPregnantHouseholdPerson2AgeValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "no_females_pregnant_household_person_2_age_value_check" |
||||
@depends_on = [{ "no_females_in_a_pregnant_household?" => true, "age2_known" => 0 }] |
||||
class Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck < ::Form::Page |
||||
def initialize(id, hsh, subsection, person_index:) |
||||
super(id, hsh, subsection) |
||||
@id = "no_females_pregnant_household_person_#{person_index}_value_check" |
||||
@depends_on = [{ "no_females_in_a_pregnant_household?" => true, "details_known_#{person_index}" => 0 }] |
||||
@title_text = { "translation" => "soft_validations.pregnancy.title", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
@informative_text = { "translation" => "soft_validations.pregnancy.no_females", "arguments" => [{ "key" => "sex1", "label" => true, "i18n_template" => "sex1" }] } |
||||
end |
||||
@ -0,0 +1,97 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonAgeValueCheck, type: :model do |
||||
subject(:page) { described_class.new(nil, page_definition, subsection, person_index:) } |
||||
|
||||
let(:page_definition) { nil } |
||||
let(:subsection) { instance_double(Form::Subsection) } |
||||
let(:person_index) { 2 } |
||||
|
||||
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[pregnancy_value_check]) |
||||
end |
||||
|
||||
context "with person 2" do |
||||
it "has the correct id" do |
||||
expect(page.id).to eq("no_females_pregnant_household_person_2_age_value_check") |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq( |
||||
[{ "age2_known" => 0, |
||||
"no_females_in_a_pregnant_household?" => true }], |
||||
) |
||||
end |
||||
|
||||
it "has the correct title_text" do |
||||
expect(page.title_text).to eq({ |
||||
"translation" => "soft_validations.pregnancy.title", |
||||
"arguments" => [{ |
||||
"key" => "sex1", |
||||
"label" => true, |
||||
"i18n_template" => "sex1", |
||||
}], |
||||
}) |
||||
end |
||||
|
||||
it "has the correct informative_text" do |
||||
expect(page.informative_text).to eq({ |
||||
"translation" => "soft_validations.pregnancy.no_females", |
||||
"arguments" => [{ |
||||
"key" => "sex1", |
||||
"label" => true, |
||||
"i18n_template" => "sex1", |
||||
}], |
||||
}) |
||||
end |
||||
end |
||||
|
||||
context "with person 3" do |
||||
let(:person_index) { 3 } |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("no_females_pregnant_household_person_3_age_value_check") |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq( |
||||
[{ "age3_known" => 0, |
||||
"no_females_in_a_pregnant_household?" => true }], |
||||
) |
||||
end |
||||
|
||||
it "has the correct title_text" do |
||||
expect(page.title_text).to eq({ |
||||
"translation" => "soft_validations.pregnancy.title", |
||||
"arguments" => [{ |
||||
"key" => "sex1", |
||||
"label" => true, |
||||
"i18n_template" => "sex1", |
||||
}], |
||||
}) |
||||
end |
||||
|
||||
it "has the correct informative_text" do |
||||
expect(page.informative_text).to eq({ |
||||
"translation" => "soft_validations.pregnancy.no_females", |
||||
"arguments" => [{ |
||||
"key" => "sex1", |
||||
"label" => true, |
||||
"i18n_template" => "sex1", |
||||
}], |
||||
}) |
||||
end |
||||
end |
||||
end |
||||
@ -0,0 +1,97 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Lettings::Pages::NoFemalesPregnantHouseholdPersonValueCheck, type: :model do |
||||
subject(:page) { described_class.new(nil, page_definition, subsection, person_index:) } |
||||
|
||||
let(:page_definition) { nil } |
||||
let(:subsection) { instance_double(Form::Subsection) } |
||||
let(:person_index) { 2 } |
||||
|
||||
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[pregnancy_value_check]) |
||||
end |
||||
|
||||
context "with person 2" do |
||||
it "has the correct id" do |
||||
expect(page.id).to eq("no_females_pregnant_household_person_2_value_check") |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq( |
||||
[{ "details_known_2" => 0, |
||||
"no_females_in_a_pregnant_household?" => true }], |
||||
) |
||||
end |
||||
|
||||
it "has the correct title_text" do |
||||
expect(page.title_text).to eq({ |
||||
"translation" => "soft_validations.pregnancy.title", |
||||
"arguments" => [ |
||||
{ "key" => "sex1", |
||||
"label" => true, |
||||
"i18n_template" => "sex1" }, |
||||
], |
||||
}) |
||||
end |
||||
|
||||
it "has the correct informative_text" do |
||||
expect(page.informative_text).to eq({ |
||||
"translation" => "soft_validations.pregnancy.no_females", |
||||
"arguments" => [ |
||||
{ "key" => "sex1", |
||||
"label" => true, |
||||
"i18n_template" => "sex1" }, |
||||
], |
||||
}) |
||||
end |
||||
end |
||||
|
||||
context "with person 3" do |
||||
let(:person_index) { 3 } |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("no_females_pregnant_household_person_3_value_check") |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq( |
||||
[{ "details_known_3" => 0, |
||||
"no_females_in_a_pregnant_household?" => true }], |
||||
) |
||||
end |
||||
|
||||
it "has the correct title_text" do |
||||
expect(page.title_text).to eq({ |
||||
"translation" => "soft_validations.pregnancy.title", |
||||
"arguments" => [ |
||||
{ "key" => "sex1", |
||||
"label" => true, |
||||
"i18n_template" => "sex1" }, |
||||
], |
||||
}) |
||||
end |
||||
|
||||
it "has the correct informative_text" do |
||||
expect(page.informative_text).to eq({ |
||||
"translation" => "soft_validations.pregnancy.no_females", |
||||
"arguments" => [ |
||||
{ "key" => "sex1", |
||||
"label" => true, |
||||
"i18n_template" => "sex1" }, |
||||
], |
||||
}) |
||||
end |
||||
end |
||||
end |
||||
Loading…
Reference in new issue