|
|
|
|
@ -17,10 +17,6 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "with person 2" do |
|
|
|
|
it "has correct questions" do |
|
|
|
|
expect(page.questions.map(&:id)).to eq(%w[relat2]) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct id" do |
|
|
|
|
expect(page.id).to eq("person_2_lead_partner") |
|
|
|
|
end |
|
|
|
|
@ -30,6 +26,10 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do
|
|
|
|
|
allow(form).to receive(:start_year_2026_or_later?).and_return(false) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has correct questions" do |
|
|
|
|
expect(page.questions.map(&:id)).to eq(%w[relat2]) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has correct depends_on" do |
|
|
|
|
expect(page.depends_on).to eq( |
|
|
|
|
[{ "details_known_2" => 0 }], |
|
|
|
|
@ -42,6 +42,10 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do
|
|
|
|
|
allow(form).to receive(:start_year_2026_or_later?).and_return(true) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has correct questions" do |
|
|
|
|
expect(page.questions.map(&:id)).to eq(%w[relat2]) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has correct depends_on" do |
|
|
|
|
expect(page.depends_on).to eq( |
|
|
|
|
[ |
|
|
|
|
@ -62,10 +66,6 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do
|
|
|
|
|
context "with person 3" do |
|
|
|
|
let(:person_index) { 3 } |
|
|
|
|
|
|
|
|
|
it "has correct questions" do |
|
|
|
|
expect(page.questions.map(&:id)).to eq(%w[relat3]) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct id" do |
|
|
|
|
expect(page.id).to eq("person_3_lead_partner") |
|
|
|
|
end |
|
|
|
|
@ -75,6 +75,10 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do
|
|
|
|
|
allow(form).to receive(:start_year_2026_or_later?).and_return(false) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has correct questions" do |
|
|
|
|
expect(page.questions.map(&:id)).to eq(%w[relat3]) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has correct depends_on" do |
|
|
|
|
expect(page.depends_on).to eq( |
|
|
|
|
[{ "details_known_3" => 0 }], |
|
|
|
|
@ -87,6 +91,10 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do
|
|
|
|
|
allow(form).to receive(:start_year_2026_or_later?).and_return(true) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has correct questions" do |
|
|
|
|
expect(page.questions.map(&:id)).to eq(%w[relat3]) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has correct depends_on" do |
|
|
|
|
expect(page.depends_on).to eq( |
|
|
|
|
[ |
|
|
|
|
@ -108,4 +116,60 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "with person 4" do |
|
|
|
|
let(:person_index) { 4 } |
|
|
|
|
|
|
|
|
|
it "has the correct id" do |
|
|
|
|
expect(page.id).to eq("person_4_lead_partner") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "with start year < 2026", metadata: { year: 25 } do |
|
|
|
|
before do |
|
|
|
|
allow(form).to receive(:start_year_2026_or_later?).and_return(false) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has correct questions" do |
|
|
|
|
expect(page.questions.map(&:id)).to eq(%w[relat4]) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has correct depends_on" do |
|
|
|
|
expect(page.depends_on).to eq( |
|
|
|
|
[{ "details_known_4" => 0 }], |
|
|
|
|
) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "with start year >= 2026", metadata: { year: 26 } do |
|
|
|
|
before do |
|
|
|
|
allow(form).to receive(:start_year_2026_or_later?).and_return(true) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has correct questions" do |
|
|
|
|
expect(page.questions.map(&:id)).to eq(%w[relat4]) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has correct depends_on" do |
|
|
|
|
expect(page.depends_on).to eq( |
|
|
|
|
[ |
|
|
|
|
{ |
|
|
|
|
"details_known_4" => 0, |
|
|
|
|
"age4" => { |
|
|
|
|
"operator" => ">=", |
|
|
|
|
"operand" => 16, |
|
|
|
|
}, |
|
|
|
|
"relat2" => { "operator" => "!=", "operand" => "P" }, |
|
|
|
|
"relat3" => { "operator" => "!=", "operand" => "P" }, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"details_known_4" => 0, |
|
|
|
|
"age4" => nil, |
|
|
|
|
"relat2" => { "operator" => "!=", "operand" => "P" }, |
|
|
|
|
"relat3" => { "operator" => "!=", "operand" => "P" }, |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|