diff --git a/app/models/location.rb b/app/models/location.rb index 116d8e7d6..6eededcc0 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -384,7 +384,7 @@ class Location < ApplicationRecord end def status(date = Time.zone.now) - return :incomplete if [postcode, units, type_of_unit, mobility_type].any?(&:blank?) + return :incomplete unless confirmed return :deactivated if open_deactivation&.deactivation_date.present? && date >= open_deactivation.deactivation_date return :deactivating_soon if open_deactivation&.deactivation_date.present? && date < open_deactivation.deactivation_date return :reactivating_soon if recent_deactivation&.reactivation_date.present? && date < recent_deactivation.reactivation_date diff --git a/spec/models/location_spec.rb b/spec/models/location_spec.rb index f12047eff..5209dd9f1 100644 --- a/spec/models/location_spec.rb +++ b/spec/models/location_spec.rb @@ -123,30 +123,9 @@ RSpec.describe Location, type: :model do Timecop.unfreeze end - context "when location is missing some mandatory information" do - it "returns incomplete when the postcode is missing" do - location.postcode = nil - expect(location.status).to eq(:incomplete) - location.postcode = "" - expect(location.status).to eq(:incomplete) - end - - it "returns incomplete when the number of units is missing" do - location.units = nil - expect(location.status).to eq(:incomplete) - end - - it "returns incomplete when the unit type is missing" do - location.type_of_unit = nil - expect(location.status).to eq(:incomplete) - location.type_of_unit = "" - expect(location.status).to eq(:incomplete) - end - - it "returns incomplete when the mobility type is missing" do - location.mobility_type = nil - expect(location.status).to eq(:incomplete) - location.mobility_type = "" + context "when location is not confirmed" do + it "returns incomplete " do + location.confirmed = false expect(location.status).to eq(:incomplete) end end