Browse Source

CLDC-3000 Display available from date in the error message (#2058)

* Display available from date in the error message

* update created at in tests
pull/2064/head
kosiakkatrina 1 year ago committed by GitHub
parent
commit
8f1b3f39e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/models/validations/setup_validations.rb
  2. 4
      spec/models/validations/setup_validations_spec.rb

2
app/models/validations/setup_validations.rb

@ -150,7 +150,7 @@ private
elsif absorbing_owning_organisation_inactive?(record) elsif absorbing_owning_organisation_inactive?(record)
record.errors.add :startdate, I18n.t("validations.setup.startdate.invalid_absorbing_organisations_start_date.same_organisation", record.errors.add :startdate, I18n.t("validations.setup.startdate.invalid_absorbing_organisations_start_date.same_organisation",
owning_organisation: record.owning_organisation.name, owning_organisation: record.owning_organisation.name,
owning_organisation_available_from: record.owning_organisation.created_at.to_formatted_s(:govuk_date)) owning_organisation_available_from: record.owning_organisation.available_from.to_formatted_s(:govuk_date))
end end
end end

4
spec/models/validations/setup_validations_spec.rb

@ -136,8 +136,8 @@ RSpec.describe Validations::SetupValidations do
Timecop.return Timecop.return
end end
let(:absorbing_organisation) { create(:organisation, created_at: Time.zone.local(2023, 2, 1, 4, 5, 6), available_from: Time.zone.local(2023, 2, 1, 4, 5, 6), name: "Absorbing org") } let(:absorbing_organisation) { create(:organisation, created_at: Time.zone.local(2023, 1, 30, 4, 5, 6), available_from: Time.zone.local(2023, 2, 1, 4, 5, 6), name: "Absorbing org") }
let(:absorbing_organisation_2) { create(:organisation, created_at: Time.zone.local(2023, 2, 1), available_from: Time.zone.local(2023, 2, 1), name: "Absorbing org 2") } let(:absorbing_organisation_2) { create(:organisation, created_at: Time.zone.local(2023, 1, 30), available_from: Time.zone.local(2023, 2, 1), name: "Absorbing org 2") }
let(:merged_organisation) { create(:organisation, name: "Merged org") } let(:merged_organisation) { create(:organisation, name: "Merged org") }
let(:merged_organisation_2) { create(:organisation, name: "Merged org 2") } let(:merged_organisation_2) { create(:organisation, name: "Merged org 2") }

Loading…
Cancel
Save