diff --git a/spec/models/form/lettings/pages/person2_age_spec.rb b/spec/models/form/lettings/pages/person2_age_spec.rb deleted file mode 100644 index f6e16cbb6..000000000 --- a/spec/models/form/lettings/pages/person2_age_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Pages::PersonAge, 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 eq("") - end - - it "has the correct description" do - expect(page.description).to eq("") - end - - it "has correct questions" do - expect(page.questions.map(&:id)).to eq(%w[age2_known age2]) - end - - it "has the correct id" do - expect(page.id).to eq("person_2_age") - end - - it "has correct depends_on" do - expect(page.depends_on).to eq( - [{ "details_known_2" => 0 }], - ) - end -end diff --git a/spec/models/form/lettings/pages/person3_age_spec.rb b/spec/models/form/lettings/pages/person3_age_spec.rb deleted file mode 100644 index 4b0b9ee0d..000000000 --- a/spec/models/form/lettings/pages/person3_age_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Pages::PersonAge, 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) { 3 } - - it "has correct subsection" do - expect(page.subsection).to eq(subsection) - end - - it "has the correct header" do - expect(page.header).to eq("") - end - - it "has the correct description" do - expect(page.description).to eq("") - end - - it "has correct questions" do - expect(page.questions.map(&:id)).to eq(%w[age3_known age3]) - end - - it "has the correct id" do - expect(page.id).to eq("person_3_age") - end - - it "has correct depends_on" do - expect(page.depends_on).to eq( - [{ "details_known_3" => 0 }], - ) - end -end diff --git a/spec/models/form/lettings/pages/person4_age_spec.rb b/spec/models/form/lettings/pages/person4_age_spec.rb deleted file mode 100644 index 1866127c7..000000000 --- a/spec/models/form/lettings/pages/person4_age_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Pages::PersonAge, 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) { 4 } - - it "has correct subsection" do - expect(page.subsection).to eq(subsection) - end - - it "has the correct header" do - expect(page.header).to eq("") - end - - it "has the correct description" do - expect(page.description).to eq("") - end - - it "has correct questions" do - expect(page.questions.map(&:id)).to eq(%w[age4_known age4]) - end - - it "has the correct id" do - expect(page.id).to eq("person_4_age") - end - - it "has correct depends_on" do - expect(page.depends_on).to eq( - [{ "details_known_4" => 0 }], - ) - end -end diff --git a/spec/models/form/lettings/pages/person5_age_spec.rb b/spec/models/form/lettings/pages/person5_age_spec.rb deleted file mode 100644 index bd3e231ec..000000000 --- a/spec/models/form/lettings/pages/person5_age_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Pages::PersonAge, 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) { 5 } - - it "has correct subsection" do - expect(page.subsection).to eq(subsection) - end - - it "has the correct header" do - expect(page.header).to eq("") - end - - it "has the correct description" do - expect(page.description).to eq("") - end - - it "has correct questions" do - expect(page.questions.map(&:id)).to eq(%w[age5_known age5]) - end - - it "has the correct id" do - expect(page.id).to eq("person_5_age") - end - - it "has correct depends_on" do - expect(page.depends_on).to eq( - [{ "details_known_5" => 0 }], - ) - end -end diff --git a/spec/models/form/lettings/pages/person6_age_spec.rb b/spec/models/form/lettings/pages/person6_age_spec.rb deleted file mode 100644 index 9dbc891e5..000000000 --- a/spec/models/form/lettings/pages/person6_age_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Pages::PersonAge, 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) { 6 } - - it "has correct subsection" do - expect(page.subsection).to eq(subsection) - end - - it "has the correct header" do - expect(page.header).to eq("") - end - - it "has the correct description" do - expect(page.description).to eq("") - end - - it "has correct questions" do - expect(page.questions.map(&:id)).to eq(%w[age6_known age6]) - end - - it "has the correct id" do - expect(page.id).to eq("person_6_age") - end - - it "has correct depends_on" do - expect(page.depends_on).to eq( - [{ "details_known_6" => 0 }], - ) - end -end diff --git a/spec/models/form/lettings/pages/person7_age_spec.rb b/spec/models/form/lettings/pages/person7_age_spec.rb deleted file mode 100644 index 9a018ef9a..000000000 --- a/spec/models/form/lettings/pages/person7_age_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Pages::PersonAge, 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) { 7 } - - it "has correct subsection" do - expect(page.subsection).to eq(subsection) - end - - it "has the correct header" do - expect(page.header).to eq("") - end - - it "has the correct description" do - expect(page.description).to eq("") - end - - it "has correct questions" do - expect(page.questions.map(&:id)).to eq(%w[age7_known age7]) - end - - it "has the correct id" do - expect(page.id).to eq("person_7_age") - end - - it "has correct depends_on" do - expect(page.depends_on).to eq( - [{ "details_known_7" => 0 }], - ) - end -end diff --git a/spec/models/form/lettings/pages/person8_age_spec.rb b/spec/models/form/lettings/pages/person8_age_spec.rb deleted file mode 100644 index e3118631e..000000000 --- a/spec/models/form/lettings/pages/person8_age_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Pages::PersonAge, 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) { 8 } - - it "has correct subsection" do - expect(page.subsection).to eq(subsection) - end - - it "has the correct header" do - expect(page.header).to eq("") - end - - it "has the correct description" do - expect(page.description).to eq("") - end - - it "has correct questions" do - expect(page.questions.map(&:id)).to eq(%w[age8_known age8]) - end - - it "has the correct id" do - expect(page.id).to eq("person_8_age") - end - - it "has correct depends_on" do - expect(page.depends_on).to eq( - [{ "details_known_8" => 0 }], - ) - end -end diff --git a/spec/models/form/lettings/pages/person_age_spec.rb b/spec/models/form/lettings/pages/person_age_spec.rb new file mode 100644 index 000000000..d0d7d2981 --- /dev/null +++ b/spec/models/form/lettings/pages/person_age_spec.rb @@ -0,0 +1,55 @@ +require "rails_helper" + +RSpec.describe Form::Lettings::Pages::PersonAge, 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 eq("") + end + + it "has the correct description" do + expect(page.description).to eq("") + end + + context "with person 2" do + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[age2_known age2]) + end + + it "has the correct id" do + expect(page.id).to eq("person_2_age") + end + + it "has correct depends_on" do + expect(page.depends_on).to eq( + [{ "details_known_2" => 0 }], + ) + end + end + + context "with person 3" do + let(:person_index) { 3 } + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[age3_known age3]) + end + + it "has the correct id" do + expect(page.id).to eq("person_3_age") + end + + it "has correct depends_on" do + expect(page.depends_on).to eq( + [{ "details_known_3" => 0 }], + ) + end + end +end diff --git a/spec/models/form/lettings/questions/age2_known_spec.rb b/spec/models/form/lettings/questions/age2_known_spec.rb deleted file mode 100644 index 1a3ae9b89..000000000 --- a/spec/models/form/lettings/questions/age2_known_spec.rb +++ /dev/null @@ -1,69 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Questions::AgeKnown, type: :model do - subject(:question) { described_class.new(nil, question_definition, page, person_index:) } - - let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - let(:person_index) { 2 } - - it "has correct page" do - expect(question.page).to eq(page) - end - - it "has the correct type" do - expect(question.type).to eq("radio") - end - - it "is not marked as derived" do - expect(question.derived?).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 hint" do - expect(question.hint_text).to eq("") - end - - it "has the correct id" do - expect(question.id).to eq("age2_known") - end - - it "has the correct header" do - expect(question.header).to eq("Do you know person 2’s age?") - end - - it "has the correct check_answer_label" do - expect(question.check_answer_label).to eq("") - end - - it "has correct conditional for" do - expect(question.conditional_for).to eq({ - "age2" => [0], - }) - end - - it "has the correct hidden_in_check_answers" do - expect(question.hidden_in_check_answers).to eq( - { - "depends_on" => [ - { - "age2_known" => 0, - }, - { - "age2_known" => 1, - }, - ], - }, - ) - end - - it "has the correct check_answers_card_number" do - expect(question.check_answers_card_number).to eq(2) - end -end diff --git a/spec/models/form/lettings/questions/age2_spec.rb b/spec/models/form/lettings/questions/age2_spec.rb deleted file mode 100644 index 0b159ff16..000000000 --- a/spec/models/form/lettings/questions/age2_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Questions::Age, type: :model do - subject(:question) { described_class.new(nil, question_definition, page, person_index:) } - - let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - let(:person_index) { 2 } - - it "has correct page" do - expect(question.page).to eq(page) - end - - it "has the correct header" do - expect(question.header).to eq("Age") - end - - it "has the correct type" do - expect(question.type).to eq("numeric") - end - - it "is not marked as derived" do - expect(question.derived?).to be false - end - - it "has the correct hint" do - expect(question.hint_text).to be_nil - end - - it "has the correct min" do - expect(question.min).to eq(0) - end - - it "has the correct max" do - expect(question.max).to eq(120) - end - - it "has the correct id" do - expect(question.id).to eq("age2") - end - - it "has the correct check_answer_label" do - expect(question.check_answer_label).to eq("Person 2’s age") - end - - it "has the correct width" do - expect(question.width).to eq(2) - end - - it "has the correct inferred check answers value" do - expect(question.inferred_check_answers_value).to eq([{ - "condition" => { "age2_known" => 1 }, - "value" => "Not known", - }]) - end - - it "has the correct check_answers_card_number" do - expect(question.check_answers_card_number).to eq(2) - end -end diff --git a/spec/models/form/lettings/questions/age3_known_spec.rb b/spec/models/form/lettings/questions/age3_known_spec.rb deleted file mode 100644 index ef475aded..000000000 --- a/spec/models/form/lettings/questions/age3_known_spec.rb +++ /dev/null @@ -1,69 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Questions::AgeKnown, type: :model do - subject(:question) { described_class.new(nil, question_definition, page, person_index:) } - - let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - let(:person_index) { 3 } - - it "has correct page" do - expect(question.page).to eq(page) - end - - it "has the correct type" do - expect(question.type).to eq("radio") - end - - it "is not marked as derived" do - expect(question.derived?).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 hint" do - expect(question.hint_text).to eq("") - end - - it "has the correct id" do - expect(question.id).to eq("age3_known") - end - - it "has the correct header" do - expect(question.header).to eq("Do you know person 3’s age?") - end - - it "has the correct check_answer_label" do - expect(question.check_answer_label).to eq("") - end - - it "has correct conditional for" do - expect(question.conditional_for).to eq({ - "age3" => [0], - }) - end - - it "has the correct hidden_in_check_answers" do - expect(question.hidden_in_check_answers).to eq( - { - "depends_on" => [ - { - "age3_known" => 0, - }, - { - "age3_known" => 1, - }, - ], - }, - ) - end - - it "has the correct check_answers_card_number" do - expect(question.check_answers_card_number).to eq(3) - end -end diff --git a/spec/models/form/lettings/questions/age3_spec.rb b/spec/models/form/lettings/questions/age3_spec.rb deleted file mode 100644 index 685a41790..000000000 --- a/spec/models/form/lettings/questions/age3_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Questions::Age, type: :model do - subject(:question) { described_class.new(nil, question_definition, page, person_index:) } - - let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - let(:person_index) { 3 } - - it "has correct page" do - expect(question.page).to eq(page) - end - - it "has the correct header" do - expect(question.header).to eq("Age") - end - - it "has the correct type" do - expect(question.type).to eq("numeric") - end - - it "is not marked as derived" do - expect(question.derived?).to be false - end - - it "has the correct hint" do - expect(question.hint_text).to be_nil - end - - it "has the correct min" do - expect(question.min).to eq(0) - end - - it "has the correct max" do - expect(question.max).to eq(120) - end - - it "has the correct id" do - expect(question.id).to eq("age3") - end - - it "has the correct check_answer_label" do - expect(question.check_answer_label).to eq("Person 3’s age") - end - - it "has the correct width" do - expect(question.width).to eq(2) - end - - it "has the correct inferred check answers value" do - expect(question.inferred_check_answers_value).to eq([{ - "condition" => { "age3_known" => 1 }, - "value" => "Not known", - }]) - end - - it "has the correct check_answers_card_number" do - expect(question.check_answers_card_number).to eq(3) - end -end diff --git a/spec/models/form/lettings/questions/age4_known_spec.rb b/spec/models/form/lettings/questions/age4_known_spec.rb deleted file mode 100644 index 287275104..000000000 --- a/spec/models/form/lettings/questions/age4_known_spec.rb +++ /dev/null @@ -1,69 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Questions::AgeKnown, type: :model do - subject(:question) { described_class.new(nil, question_definition, page, person_index:) } - - let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - let(:person_index) { 4 } - - it "has correct page" do - expect(question.page).to eq(page) - end - - it "has the correct type" do - expect(question.type).to eq("radio") - end - - it "is not marked as derived" do - expect(question.derived?).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 hint" do - expect(question.hint_text).to eq("") - end - - it "has the correct id" do - expect(question.id).to eq("age4_known") - end - - it "has the correct header" do - expect(question.header).to eq("Do you know person 4’s age?") - end - - it "has the correct check_answer_label" do - expect(question.check_answer_label).to eq("") - end - - it "has correct conditional for" do - expect(question.conditional_for).to eq({ - "age4" => [0], - }) - end - - it "has the correct hidden_in_check_answers" do - expect(question.hidden_in_check_answers).to eq( - { - "depends_on" => [ - { - "age4_known" => 0, - }, - { - "age4_known" => 1, - }, - ], - }, - ) - end - - it "has the correct check_answers_card_number" do - expect(question.check_answers_card_number).to eq(4) - end -end diff --git a/spec/models/form/lettings/questions/age4_spec.rb b/spec/models/form/lettings/questions/age4_spec.rb deleted file mode 100644 index d19ffb11b..000000000 --- a/spec/models/form/lettings/questions/age4_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Questions::Age, type: :model do - subject(:question) { described_class.new(nil, question_definition, page, person_index:) } - - let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - let(:person_index) { 4 } - - it "has correct page" do - expect(question.page).to eq(page) - end - - it "has the correct header" do - expect(question.header).to eq("Age") - end - - it "has the correct type" do - expect(question.type).to eq("numeric") - end - - it "is not marked as derived" do - expect(question.derived?).to be false - end - - it "has the correct hint" do - expect(question.hint_text).to be_nil - end - - it "has the correct min" do - expect(question.min).to eq(0) - end - - it "has the correct max" do - expect(question.max).to eq(120) - end - - it "has the correct id" do - expect(question.id).to eq("age4") - end - - it "has the correct check_answer_label" do - expect(question.check_answer_label).to eq("Person 4’s age") - end - - it "has the correct width" do - expect(question.width).to eq(2) - end - - it "has the correct inferred check answers value" do - expect(question.inferred_check_answers_value).to eq([{ - "condition" => { "age4_known" => 1 }, - "value" => "Not known", - }]) - end - - it "has the correct check_answers_card_number" do - expect(question.check_answers_card_number).to eq(4) - end -end diff --git a/spec/models/form/lettings/questions/age5_known_spec.rb b/spec/models/form/lettings/questions/age5_known_spec.rb deleted file mode 100644 index 24b9f8c32..000000000 --- a/spec/models/form/lettings/questions/age5_known_spec.rb +++ /dev/null @@ -1,69 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Questions::AgeKnown, type: :model do - subject(:question) { described_class.new(nil, question_definition, page, person_index:) } - - let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - let(:person_index) { 5 } - - it "has correct page" do - expect(question.page).to eq(page) - end - - it "has the correct type" do - expect(question.type).to eq("radio") - end - - it "is not marked as derived" do - expect(question.derived?).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 hint" do - expect(question.hint_text).to eq("") - end - - it "has the correct id" do - expect(question.id).to eq("age5_known") - end - - it "has the correct header" do - expect(question.header).to eq("Do you know person 5’s age?") - end - - it "has the correct check_answer_label" do - expect(question.check_answer_label).to eq("") - end - - it "has correct conditional for" do - expect(question.conditional_for).to eq({ - "age5" => [0], - }) - end - - it "has the correct hidden_in_check_answers" do - expect(question.hidden_in_check_answers).to eq( - { - "depends_on" => [ - { - "age5_known" => 0, - }, - { - "age5_known" => 1, - }, - ], - }, - ) - end - - it "has the correct check_answers_card_number" do - expect(question.check_answers_card_number).to eq(5) - end -end diff --git a/spec/models/form/lettings/questions/age5_spec.rb b/spec/models/form/lettings/questions/age5_spec.rb deleted file mode 100644 index 1037ef5e4..000000000 --- a/spec/models/form/lettings/questions/age5_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Questions::Age, type: :model do - subject(:question) { described_class.new(nil, question_definition, page, person_index:) } - - let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - let(:person_index) { 5 } - - it "has correct page" do - expect(question.page).to eq(page) - end - - it "has the correct header" do - expect(question.header).to eq("Age") - end - - it "has the correct type" do - expect(question.type).to eq("numeric") - end - - it "is not marked as derived" do - expect(question.derived?).to be false - end - - it "has the correct hint" do - expect(question.hint_text).to be_nil - end - - it "has the correct min" do - expect(question.min).to eq(0) - end - - it "has the correct max" do - expect(question.max).to eq(120) - end - - it "has the correct id" do - expect(question.id).to eq("age5") - end - - it "has the correct check_answer_label" do - expect(question.check_answer_label).to eq("Person 5’s age") - end - - it "has the correct width" do - expect(question.width).to eq(2) - end - - it "has the correct inferred check answers value" do - expect(question.inferred_check_answers_value).to eq([{ - "condition" => { "age5_known" => 1 }, - "value" => "Not known", - }]) - end - - it "has the correct check_answers_card_number" do - expect(question.check_answers_card_number).to eq(5) - end -end diff --git a/spec/models/form/lettings/questions/age6_known_spec.rb b/spec/models/form/lettings/questions/age6_known_spec.rb deleted file mode 100644 index f5297abfd..000000000 --- a/spec/models/form/lettings/questions/age6_known_spec.rb +++ /dev/null @@ -1,69 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Questions::AgeKnown, type: :model do - subject(:question) { described_class.new(nil, question_definition, page, person_index:) } - - let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - let(:person_index) { 6 } - - it "has correct page" do - expect(question.page).to eq(page) - end - - it "has the correct type" do - expect(question.type).to eq("radio") - end - - it "is not marked as derived" do - expect(question.derived?).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 hint" do - expect(question.hint_text).to eq("") - end - - it "has the correct id" do - expect(question.id).to eq("age6_known") - end - - it "has the correct header" do - expect(question.header).to eq("Do you know person 6’s age?") - end - - it "has the correct check_answer_label" do - expect(question.check_answer_label).to eq("") - end - - it "has correct conditional for" do - expect(question.conditional_for).to eq({ - "age6" => [0], - }) - end - - it "has the correct hidden_in_check_answers" do - expect(question.hidden_in_check_answers).to eq( - { - "depends_on" => [ - { - "age6_known" => 0, - }, - { - "age6_known" => 1, - }, - ], - }, - ) - end - - it "has the correct check_answers_card_number" do - expect(question.check_answers_card_number).to eq(6) - end -end diff --git a/spec/models/form/lettings/questions/age6_spec.rb b/spec/models/form/lettings/questions/age6_spec.rb deleted file mode 100644 index 56673f80b..000000000 --- a/spec/models/form/lettings/questions/age6_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Questions::Age, type: :model do - subject(:question) { described_class.new(nil, question_definition, page, person_index:) } - - let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - let(:person_index) { 6 } - - it "has correct page" do - expect(question.page).to eq(page) - end - - it "has the correct header" do - expect(question.header).to eq("Age") - end - - it "has the correct type" do - expect(question.type).to eq("numeric") - end - - it "is not marked as derived" do - expect(question.derived?).to be false - end - - it "has the correct hint" do - expect(question.hint_text).to be_nil - end - - it "has the correct min" do - expect(question.min).to eq(0) - end - - it "has the correct max" do - expect(question.max).to eq(120) - end - - it "has the correct id" do - expect(question.id).to eq("age6") - end - - it "has the correct check_answer_label" do - expect(question.check_answer_label).to eq("Person 6’s age") - end - - it "has the correct width" do - expect(question.width).to eq(2) - end - - it "has the correct inferred check answers value" do - expect(question.inferred_check_answers_value).to eq([{ - "condition" => { "age6_known" => 1 }, - "value" => "Not known", - }]) - end - - it "has the correct check_answers_card_number" do - expect(question.check_answers_card_number).to eq(6) - end -end diff --git a/spec/models/form/lettings/questions/age7_known_spec.rb b/spec/models/form/lettings/questions/age7_known_spec.rb deleted file mode 100644 index 704cf7a51..000000000 --- a/spec/models/form/lettings/questions/age7_known_spec.rb +++ /dev/null @@ -1,69 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Questions::AgeKnown, type: :model do - subject(:question) { described_class.new(nil, question_definition, page, person_index:) } - - let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - let(:person_index) { 7 } - - it "has correct page" do - expect(question.page).to eq(page) - end - - it "has the correct type" do - expect(question.type).to eq("radio") - end - - it "is not marked as derived" do - expect(question.derived?).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 hint" do - expect(question.hint_text).to eq("") - end - - it "has the correct id" do - expect(question.id).to eq("age7_known") - end - - it "has the correct header" do - expect(question.header).to eq("Do you know person 7’s age?") - end - - it "has the correct check_answer_label" do - expect(question.check_answer_label).to eq("") - end - - it "has correct conditional for" do - expect(question.conditional_for).to eq({ - "age7" => [0], - }) - end - - it "has the correct hidden_in_check_answers" do - expect(question.hidden_in_check_answers).to eq( - { - "depends_on" => [ - { - "age7_known" => 0, - }, - { - "age7_known" => 1, - }, - ], - }, - ) - end - - it "has the correct check_answers_card_number" do - expect(question.check_answers_card_number).to eq(7) - end -end diff --git a/spec/models/form/lettings/questions/age7_spec.rb b/spec/models/form/lettings/questions/age7_spec.rb deleted file mode 100644 index 5e7a2dbcc..000000000 --- a/spec/models/form/lettings/questions/age7_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Questions::Age, type: :model do - subject(:question) { described_class.new(nil, question_definition, page, person_index:) } - - let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - let(:person_index) { 7 } - - it "has correct page" do - expect(question.page).to eq(page) - end - - it "has the correct header" do - expect(question.header).to eq("Age") - end - - it "has the correct type" do - expect(question.type).to eq("numeric") - end - - it "is not marked as derived" do - expect(question.derived?).to be false - end - - it "has the correct hint" do - expect(question.hint_text).to be_nil - end - - it "has the correct min" do - expect(question.min).to eq(0) - end - - it "has the correct max" do - expect(question.max).to eq(120) - end - - it "has the correct id" do - expect(question.id).to eq("age7") - end - - it "has the correct check_answer_label" do - expect(question.check_answer_label).to eq("Person 7’s age") - end - - it "has the correct width" do - expect(question.width).to eq(2) - end - - it "has the correct inferred check answers value" do - expect(question.inferred_check_answers_value).to eq([{ - "condition" => { "age7_known" => 1 }, - "value" => "Not known", - }]) - end - - it "has the correct check_answers_card_number" do - expect(question.check_answers_card_number).to eq(7) - end -end diff --git a/spec/models/form/lettings/questions/age8_known_spec.rb b/spec/models/form/lettings/questions/age8_known_spec.rb deleted file mode 100644 index 9c5ddd38e..000000000 --- a/spec/models/form/lettings/questions/age8_known_spec.rb +++ /dev/null @@ -1,69 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Questions::AgeKnown, type: :model do - subject(:question) { described_class.new(nil, question_definition, page, person_index:) } - - let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - let(:person_index) { 8 } - - it "has correct page" do - expect(question.page).to eq(page) - end - - it "has the correct type" do - expect(question.type).to eq("radio") - end - - it "is not marked as derived" do - expect(question.derived?).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 hint" do - expect(question.hint_text).to eq("") - end - - it "has the correct id" do - expect(question.id).to eq("age8_known") - end - - it "has the correct header" do - expect(question.header).to eq("Do you know person 8’s age?") - end - - it "has the correct check_answer_label" do - expect(question.check_answer_label).to eq("") - end - - it "has correct conditional for" do - expect(question.conditional_for).to eq({ - "age8" => [0], - }) - end - - it "has the correct hidden_in_check_answers" do - expect(question.hidden_in_check_answers).to eq( - { - "depends_on" => [ - { - "age8_known" => 0, - }, - { - "age8_known" => 1, - }, - ], - }, - ) - end - - it "has the correct check_answers_card_number" do - expect(question.check_answers_card_number).to eq(8) - end -end diff --git a/spec/models/form/lettings/questions/age8_spec.rb b/spec/models/form/lettings/questions/age8_spec.rb deleted file mode 100644 index 01721988c..000000000 --- a/spec/models/form/lettings/questions/age8_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -require "rails_helper" - -RSpec.describe Form::Lettings::Questions::Age, type: :model do - subject(:question) { described_class.new(nil, question_definition, page, person_index:) } - - let(:question_definition) { nil } - let(:page) { instance_double(Form::Page) } - let(:person_index) { 8 } - - it "has correct page" do - expect(question.page).to eq(page) - end - - it "has the correct header" do - expect(question.header).to eq("Age") - end - - it "has the correct type" do - expect(question.type).to eq("numeric") - end - - it "is not marked as derived" do - expect(question.derived?).to be false - end - - it "has the correct hint" do - expect(question.hint_text).to be_nil - end - - it "has the correct min" do - expect(question.min).to eq(0) - end - - it "has the correct max" do - expect(question.max).to eq(120) - end - - it "has the correct id" do - expect(question.id).to eq("age8") - end - - it "has the correct check_answer_label" do - expect(question.check_answer_label).to eq("Person 8’s age") - end - - it "has the correct width" do - expect(question.width).to eq(2) - end - - it "has the correct inferred check answers value" do - expect(question.inferred_check_answers_value).to eq([{ - "condition" => { "age8_known" => 1 }, - "value" => "Not known", - }]) - end - - it "has the correct check_answers_card_number" do - expect(question.check_answers_card_number).to eq(8) - end -end diff --git a/spec/models/form/lettings/questions/age_known_spec.rb b/spec/models/form/lettings/questions/age_known_spec.rb new file mode 100644 index 000000000..a3ca5c3fb --- /dev/null +++ b/spec/models/form/lettings/questions/age_known_spec.rb @@ -0,0 +1,108 @@ +require "rails_helper" + +RSpec.describe Form::Lettings::Questions::AgeKnown, type: :model do + subject(:question) { described_class.new(nil, question_definition, page, person_index:) } + + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + let(:person_index) { 2 } + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct type" do + expect(question.type).to eq("radio") + end + + it "is not marked as derived" do + expect(question.derived?).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 hint" do + expect(question.hint_text).to eq("") + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq("") + end + + context "with person 2" do + it "has the correct id" do + expect(question.id).to eq("age2_known") + end + + it "has the correct header" do + expect(question.header).to eq("Do you know person 2’s age?") + end + + it "has correct conditional for" do + expect(question.conditional_for).to eq({ + "age2" => [0], + }) + end + + it "has the correct hidden_in_check_answers" do + expect(question.hidden_in_check_answers).to eq( + { + "depends_on" => [ + { + "age2_known" => 0, + }, + { + "age2_known" => 1, + }, + ], + }, + ) + end + + it "has the correct check_answers_card_number" do + expect(question.check_answers_card_number).to eq(2) + end + end + + context "with person 3" do + let(:person_index) { 3 } + + it "has the correct id" do + expect(question.id).to eq("age3_known") + end + + it "has the correct header" do + expect(question.header).to eq("Do you know person 3’s age?") + end + + it "has correct conditional for" do + expect(question.conditional_for).to eq({ + "age3" => [0], + }) + end + + it "has the correct hidden_in_check_answers" do + expect(question.hidden_in_check_answers).to eq( + { + "depends_on" => [ + { + "age3_known" => 0, + }, + { + "age3_known" => 1, + }, + ], + }, + ) + end + + it "has the correct check_answers_card_number" do + expect(question.check_answers_card_number).to eq(3) + end + end +end diff --git a/spec/models/form/lettings/questions/age_spec.rb b/spec/models/form/lettings/questions/age_spec.rb new file mode 100644 index 000000000..bc3aad946 --- /dev/null +++ b/spec/models/form/lettings/questions/age_spec.rb @@ -0,0 +1,85 @@ +require "rails_helper" + +RSpec.describe Form::Lettings::Questions::Age, type: :model do + subject(:question) { described_class.new(nil, question_definition, page, person_index:) } + + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + let(:person_index) { 2 } + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct header" do + expect(question.header).to eq("Age") + end + + it "has the correct type" do + expect(question.type).to eq("numeric") + end + + it "is not marked as derived" do + expect(question.derived?).to be false + end + + it "has the correct hint" do + expect(question.hint_text).to be_nil + end + + it "has the correct min" do + expect(question.min).to eq(0) + end + + it "has the correct max" do + expect(question.max).to eq(120) + end + + it "has the correct width" do + expect(question.width).to eq(2) + end + + context "with person 2" do + it "has the correct id" do + expect(question.id).to eq("age2") + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq("Person 2’s age") + end + + it "has the correct inferred check answers value" do + expect(question.inferred_check_answers_value).to eq([{ + "condition" => { "age2_known" => 1 }, + "value" => "Not known", + }]) + end + + it "has the correct check_answers_card_number" do + expect(question.check_answers_card_number).to eq(2) + end + end + + context "with person 3" do + let(:person_index) { 3 } + + it "has the correct id" do + expect(question.id).to eq("age3") + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq("Person 3’s age") + end + + it "has the correct inferred check answers value" do + expect(question.inferred_check_answers_value).to eq([{ + "condition" => { "age3_known" => 1 }, + "value" => "Not known", + }]) + end + + it "has the correct check_answers_card_number" do + expect(question.check_answers_card_number).to eq(3) + end + end +end