|
|
|
@ -35,43 +35,4 @@ RSpec.describe Form::Lettings::Pages::PropertyLocalAuthority, type: :model do
|
|
|
|
|
it "has the correct depends_on" do |
|
|
|
|
expect(page.depends_on).to match([{ "is_general_needs?" => true, "is_la_inferred" => false }]) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "has correct routed_to?" do |
|
|
|
|
context "when start_date < 2023" do |
|
|
|
|
let(:log) { create(:lettings_log, uprn_known: 1) } |
|
|
|
|
let(:start_date) { Time.utc(2022, 2, 8) } |
|
|
|
|
|
|
|
|
|
it "returns false" do |
|
|
|
|
expect(page.routed_to?(log)).to eq(true) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when start_date >= 2023" do |
|
|
|
|
let(:log) { create(:lettings_log, uprn_known: 1) } |
|
|
|
|
let(:start_date) { Time.utc(2023, 2, 8) } |
|
|
|
|
|
|
|
|
|
it "returns true" do |
|
|
|
|
expect(page.routed_to?(log)).to eq(true) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when start_date < 2023 and uprn_known: nil" do |
|
|
|
|
let(:log) { create(:lettings_log, uprn_known: nil) } |
|
|
|
|
let(:start_date) { Time.utc(2023, 2, 8) } |
|
|
|
|
|
|
|
|
|
it "returns true" do |
|
|
|
|
expect(page.routed_to?(log)).to eq(false) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when is_la_inferred: true" do |
|
|
|
|
before do |
|
|
|
|
allow(log).to receive(:is_la_inferred?).and_return(true) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns true" do |
|
|
|
|
expect(page.routed_to?(log)).to eq(false) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|