Browse Source

rebase fixes

pull/996/head
Kat 4 years ago
parent
commit
3fa0570df9
  1. 2
      app/models/location.rb
  2. 3
      db/schema.rb
  3. 4
      spec/helpers/locations_helper_spec.rb
  4. 2
      spec/models/location_spec.rb

2
app/models/location.rb

@ -405,7 +405,7 @@ class Location < ApplicationRecord
end end
else else
collection_start_date = FormHandler.instance.current_collection_start_date 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))) 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
end end

3
db/schema.rb

@ -372,6 +372,9 @@ ActiveRecord::Schema[7.0].define(version: 2022_11_15_113437) do
t.integer "la_known" t.integer "la_known"
t.integer "income1" t.integer "income1"
t.integer "income1nk" t.integer "income1nk"
t.integer "details_known_2"
t.integer "details_known_3"
t.integer "details_known_4"
t.integer "age4" t.integer "age4"
t.integer "age4_known" t.integer "age4_known"
t.integer "age5" t.integer "age5"

4
spec/helpers/locations_helper_spec.rb

@ -70,7 +70,7 @@ RSpec.describe LocationsHelper do
context "with are no deactivations" do context "with are no deactivations" do
it "displays created_at as availability date if startdate is not present" do it "displays created_at as availability date if startdate is not present" do
location.update!(startdate: nil) 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)}") expect(availability_attribute).to eq("Active from #{location.created_at.to_formatted_s(:govuk_date)}")
end end
@ -83,7 +83,7 @@ RSpec.describe LocationsHelper do
end end
it "displays the timeline of availability" do 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") 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 end

2
spec/models/location_spec.rb

@ -119,7 +119,7 @@ RSpec.describe Location, type: :model do
Timecop.freeze(2022, 6, 7) Timecop.freeze(2022, 6, 7)
end 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 it "returns active if the location has no deactivation records" do
expect(location.status).to eq(:active) expect(location.status).to eq(:active)
end end

Loading…
Cancel
Save