From ff84e1f563d72a33405266424cb3787967ac5a75 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Fri, 5 Aug 2022 10:24:08 +0100 Subject: [PATCH] Spec nil case --- spec/models/location_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/models/location_spec.rb b/spec/models/location_spec.rb index da968f194..0b932b915 100644 --- a/spec/models/location_spec.rb +++ b/spec/models/location_spec.rb @@ -75,6 +75,7 @@ RSpec.describe Location, type: :model do FactoryBot.create(:location, name: "ABC", postcode: "NW1 8RR", startdate: Time.zone.today) FactoryBot.create(:location, name: "XYZ", postcode: "SE1 6HJ", startdate: Time.zone.today + 1.day) FactoryBot.create(:location, name: "GHQ", postcode: "EW1 7JK", startdate: Time.zone.today - 1.day, confirmed: false) + FactoryBot.create(:location, name: "GHQ", postcode: "EW1 7JK", startdate: nil) end context "when searching by name" do @@ -100,13 +101,13 @@ RSpec.describe Location, type: :model do context "when filtering by started locations" do it "returns only locations that started today or earlier" do - expect(described_class.started.count).to eq(2) + expect(described_class.started.count).to eq(3) end end context "when filtering by active locations" do it "returns only locations that started today or earlier and have been confirmed" do - expect(described_class.active.count).to eq(1) + expect(described_class.active.count).to eq(2) end end end