diff --git a/app/models/location.rb b/app/models/location.rb index f73f70549..25fc05fd9 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -405,7 +405,7 @@ class Location < ApplicationRecord end else collection_start_date = FormHandler.instance.current_collection_start_date - unless deactivation_date.between?(collection_start_date, Date.new(2200, 1, 1)) + unless deactivation_date.between?(collection_start_date, Time.zone.local(2200, 1, 1)) errors.add(:deactivation_date, message: I18n.t("validations.location.deactivation_date.out_of_range", date: collection_start_date.to_formatted_s(:govuk_date))) end end diff --git a/db/schema.rb b/db/schema.rb index f42fa7c68..2644c8b0b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -372,6 +372,9 @@ ActiveRecord::Schema[7.0].define(version: 2022_11_15_113437) do t.integer "la_known" t.integer "income1" t.integer "income1nk" + t.integer "details_known_2" + t.integer "details_known_3" + t.integer "details_known_4" t.integer "age4" t.integer "age4_known" t.integer "age5" diff --git a/spec/helpers/locations_helper_spec.rb b/spec/helpers/locations_helper_spec.rb index 525043e6d..e0d2abfea 100644 --- a/spec/helpers/locations_helper_spec.rb +++ b/spec/helpers/locations_helper_spec.rb @@ -70,7 +70,7 @@ RSpec.describe LocationsHelper do context "with are no deactivations" do it "displays created_at as availability date if startdate is not present" do location.update!(startdate: nil) - availability_attribute = display_attributes(location).find { |x| x[:name] == "Availability" }[:value] + availability_attribute = display_location_attributes(location).find { |x| x[:name] == "Availability" }[:value] expect(availability_attribute).to eq("Active from #{location.created_at.to_formatted_s(:govuk_date)}") end @@ -83,7 +83,7 @@ RSpec.describe LocationsHelper do end it "displays the timeline of availability" do - availability_attribute = display_attributes(location).find { |x| x[:name] == "Availability" }[:value] + availability_attribute = display_location_attributes(location).find { |x| x[:name] == "Availability" }[:value] expect(availability_attribute).to eq("Active from 8 August 2022 to 9 August 2022\nDeactivated on 10 August 2022\nActive from 1 September 2022 to 14 September 2022\nDeactivated on 15 September 2022") end diff --git a/spec/models/location_spec.rb b/spec/models/location_spec.rb index 06518136e..2a23f0299 100644 --- a/spec/models/location_spec.rb +++ b/spec/models/location_spec.rb @@ -119,7 +119,7 @@ RSpec.describe Location, type: :model do Timecop.freeze(2022, 6, 7) end - context "when there have not been any previous deactivations" do + context "when there have not been any previous deactivations" do it "returns active if the location has no deactivation records" do expect(location.status).to eq(:active) end