|
|
|
@ -17,18 +17,8 @@ RSpec.describe Form::Sales::Pages::PropertyLocalAuthority, type: :model do |
|
|
|
expect(page.subsection).to eq(subsection) |
|
|
|
expect(page.subsection).to eq(subsection) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "has correct questions" do |
|
|
|
|
|
|
|
context "when 2023" do |
|
|
|
|
|
|
|
let(:start_date) { Time.utc(2023, 2, 8) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "has correct questions" do |
|
|
|
it "has correct questions" do |
|
|
|
expect(page.questions.map(&:id)).to eq( |
|
|
|
expect(page.questions.map(&:id)).to eq(%w[la]) |
|
|
|
%w[ |
|
|
|
|
|
|
|
la |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "has the correct id" do |
|
|
|
it "has the correct id" do |
|
|
|
@ -42,9 +32,8 @@ RSpec.describe Form::Sales::Pages::PropertyLocalAuthority, type: :model do |
|
|
|
context "when routing to the page" do |
|
|
|
context "when routing to the page" do |
|
|
|
let(:log) { build(:sales_log) } |
|
|
|
let(:log) { build(:sales_log) } |
|
|
|
|
|
|
|
|
|
|
|
context "with form before 2024" do |
|
|
|
|
|
|
|
before do |
|
|
|
before do |
|
|
|
allow(form).to receive(:start_year_2024_or_later?).and_return(false) |
|
|
|
allow(form).to receive(:start_year_2025_or_later?).and_return(true) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "is routed to when la is not inferred" do |
|
|
|
it "is routed to when la is not inferred" do |
|
|
|
@ -57,32 +46,4 @@ RSpec.describe Form::Sales::Pages::PropertyLocalAuthority, type: :model do |
|
|
|
expect(page).not_to be_routed_to(log, nil) |
|
|
|
expect(page).not_to be_routed_to(log, nil) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "with form after 2024" do |
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
allow(form).to receive(:start_year_2024_or_later?).and_return(true) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "is routed to when la is not inferred and address search has been given" do |
|
|
|
|
|
|
|
log.is_la_inferred = false |
|
|
|
|
|
|
|
log.address_line1_input = "1" |
|
|
|
|
|
|
|
log.postcode_full_input = "A11AA" |
|
|
|
|
|
|
|
expect(page).to be_routed_to(log, nil) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "is not routed to when la is inferred" do |
|
|
|
|
|
|
|
log.is_la_inferred = true |
|
|
|
|
|
|
|
log.address_line1_input = "1" |
|
|
|
|
|
|
|
log.postcode_full_input = "A11AA" |
|
|
|
|
|
|
|
expect(page).not_to be_routed_to(log, nil) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "is not routed to when address search is not given" do |
|
|
|
|
|
|
|
log.is_la_inferred = false |
|
|
|
|
|
|
|
log.address_line1_input = nil |
|
|
|
|
|
|
|
log.postcode_full_input = "A11AA" |
|
|
|
|
|
|
|
expect(page).not_to be_routed_to(log, nil) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|