Browse Source

Update question numbers tests

pull/2924/head
Manny Dinssa 2 months ago
parent
commit
e7832f72e4
  1. 13
      spec/models/form/lettings/pages/address_search_spec.rb
  2. 13
      spec/models/form/lettings/questions/address_search_spec.rb
  3. 13
      spec/models/form/sales/pages/address_search_spec.rb
  4. 13
      spec/models/form/sales/questions/address_search_spec.rb

13
spec/models/form/lettings/pages/address_search_spec.rb

@ -5,7 +5,8 @@ RSpec.describe Form::Lettings::Pages::AddressSearch, type: :model do
let(:page_id) { nil } let(:page_id) { nil }
let(:page_definition) { nil } let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 1))) } let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date:)) }
let(:start_date) { Time.utc(2024, 4, 1) }
it "has correct subsection" do it "has correct subsection" do
expect(page.subsection).to eq(subsection) expect(page.subsection).to eq(subsection)
@ -27,7 +28,15 @@ RSpec.describe Form::Lettings::Pages::AddressSearch, type: :model do
expect(page.depends_on).to eq([{ "is_supported_housing?" => false, "manual_address_entry_selected" => false }]) expect(page.depends_on).to eq([{ "is_supported_housing?" => false, "manual_address_entry_selected" => false }])
end end
it "has the correct question_number" do it "has the correct question number" do
expect(page.question_number).to eq(12) expect(page.question_number).to eq(12)
end end
context "with 2025/26 form" do
let(:start_date) { Time.utc(2025, 4, 1) }
it "has the correct question number" do
expect(page.question_number).to eq(16)
end
end
end end

13
spec/models/form/lettings/questions/address_search_spec.rb

@ -5,7 +5,8 @@ RSpec.describe Form::Lettings::Questions::AddressSearch, type: :model do
let(:question_id) { nil } let(:question_id) { nil }
let(:question_definition) { nil } let(:question_definition) { nil }
let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 1)))) } let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date:))) }
let(:start_date) { Time.utc(2024, 4, 1) }
it "has correct page" do it "has correct page" do
expect(question.page).to eq(page) expect(question.page).to eq(page)
@ -19,10 +20,18 @@ RSpec.describe Form::Lettings::Questions::AddressSearch, type: :model do
expect(question.type).to eq("address_search") expect(question.type).to eq("address_search")
end end
it "has the correct question_number" do it "has the correct question number" do
expect(question.question_number).to eq(12) expect(question.question_number).to eq(12)
end end
context "with 2025/26 form" do
let(:start_date) { Time.utc(2025, 4, 1) }
it "has the correct question number" do
expect(question.question_number).to eq(16)
end
end
describe "get_extra_check_answer_value" do describe "get_extra_check_answer_value" do
context "when address is not present" do context "when address is not present" do
let(:log) { build(:lettings_log, manual_address_entry_selected: false) } let(:log) { build(:lettings_log, manual_address_entry_selected: false) }

13
spec/models/form/sales/pages/address_search_spec.rb

@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Pages::AddressSearch, type: :model do
let(:page_id) { nil } let(:page_id) { nil }
let(:page_definition) { nil } let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 1))) } let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date:)) }
let(:start_date) { Time.utc(2024, 4, 1) }
it "has correct subsection" do it "has correct subsection" do
expect(page.subsection).to eq(subsection) expect(page.subsection).to eq(subsection)
@ -27,7 +28,15 @@ RSpec.describe Form::Sales::Pages::AddressSearch, type: :model do
expect(page.depends_on).to eq([{ "manual_address_entry_selected" => false }]) expect(page.depends_on).to eq([{ "manual_address_entry_selected" => false }])
end end
it "has the correct question_number" do it "has the correct question number" do
expect(page.question_number).to eq(15) expect(page.question_number).to eq(15)
end end
context "with 2025/26 form" do
let(:start_date) { Time.utc(2025, 4, 1) }
it "has the correct question number" do
expect(page.question_number).to eq(13)
end
end
end end

13
spec/models/form/sales/questions/address_search_spec.rb

@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Questions::AddressSearch, type: :model do
let(:question_id) { nil } let(:question_id) { nil }
let(:question_definition) { nil } let(:question_definition) { nil }
let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2025, 4, 1)))) } let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date:))) }
let(:start_date) { Time.utc(2024, 4, 1) }
it "has correct page" do it "has correct page" do
expect(question.page).to eq(page) expect(question.page).to eq(page)
@ -19,10 +20,18 @@ RSpec.describe Form::Sales::Questions::AddressSearch, type: :model do
expect(question.type).to eq("address_search") expect(question.type).to eq("address_search")
end end
it "has the correct question_number" do it "has the correct question number" do
expect(question.question_number).to eq(15) expect(question.question_number).to eq(15)
end end
context "with 2025/26 form" do
let(:start_date) { Time.utc(2025, 4, 1) }
it "has the correct question number" do
expect(question.question_number).to eq(13)
end
end
describe "get_extra_check_answer_value" do describe "get_extra_check_answer_value" do
context "when address is not present" do context "when address is not present" do
let(:log) { build(:sales_log, manual_address_entry_selected: false) } let(:log) { build(:sales_log, manual_address_entry_selected: false) }

Loading…
Cancel
Save