|
|
|
@ -9,8 +9,6 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do |
|
|
|
let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2026_or_later?: start_year_2026_or_later?, person_question_count:) } |
|
|
|
let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1), start_year_2026_or_later?: start_year_2026_or_later?, person_question_count:) } |
|
|
|
let(:subsection) { instance_double(Form::Subsection, form:) } |
|
|
|
let(:subsection) { instance_double(Form::Subsection, form:) } |
|
|
|
let(:person_index) { 2 } |
|
|
|
let(:person_index) { 2 } |
|
|
|
let(:is_any_person_partner?) { false } |
|
|
|
|
|
|
|
let(:log) { instance_double(LettingsLog, is_any_person_partner?: is_any_person_partner?) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "has correct subsection" do |
|
|
|
it "has correct subsection" do |
|
|
|
expect(page.subsection).to eq(subsection) |
|
|
|
expect(page.subsection).to eq(subsection) |
|
|
|
@ -20,46 +18,6 @@ RSpec.describe Form::Lettings::Pages::PersonLeadPartner, type: :model do |
|
|
|
expect(page.description).to be_nil |
|
|
|
expect(page.description).to be_nil |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "#skip_page_in_form_flow?" do |
|
|
|
|
|
|
|
context "with start year < 2026", metadata: { year: 25 } do |
|
|
|
|
|
|
|
context "when no other person is the partner of the lead tenant" do |
|
|
|
|
|
|
|
let(:is_any_person_partner?) { false } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "returns false" do |
|
|
|
|
|
|
|
expect(page.skip_page_in_form_flow?(log)).to be false |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when another person is the partner of the lead tenant" do |
|
|
|
|
|
|
|
let(:is_any_person_partner?) { true } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "returns false" do |
|
|
|
|
|
|
|
expect(page.skip_page_in_form_flow?(log)).to be false |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "with start year >= 2026", metadata: { year: 26 } do |
|
|
|
|
|
|
|
let(:start_year_2026_or_later?) { true } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when no other person is the partner of the lead tenant" do |
|
|
|
|
|
|
|
let(:is_any_person_partner?) { false } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "returns false" do |
|
|
|
|
|
|
|
expect(page.skip_page_in_form_flow?(log)).to be false |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when another person is the partner of the lead tenant" do |
|
|
|
|
|
|
|
let(:is_any_person_partner?) { true } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "returns true" do |
|
|
|
|
|
|
|
expect(page.skip_page_in_form_flow?(log)).to be true |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "with person 2" do |
|
|
|
context "with person 2" do |
|
|
|
it "has correct questions" do |
|
|
|
it "has correct questions" do |
|
|
|
expect(page.questions.map(&:id)).to eq(%w[relat2]) |
|
|
|
expect(page.questions.map(&:id)).to eq(%w[relat2]) |
|
|
|
|