24 changed files with 248 additions and 1148 deletions
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
@ -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 |
||||
Loading…
Reference in new issue