diff --git a/app/views/locations/toggle_active.html.erb b/app/views/locations/toggle_active.html.erb index 9ef36cf81..7b995b2b5 100644 --- a/app/views/locations/toggle_active.html.erb +++ b/app/views/locations/toggle_active.html.erb @@ -11,7 +11,7 @@ <%= form_with model: @location_deactivation_period, url: toggle_location_form_path(action, @location), method: "patch", local: true do |f| %>
- <% collection_start_date = FormHandler.instance.earliest_open_collection_start_date(now: @location.available_from) %> + <% start_date = FormHandler.instance.earliest_open_collection_start_date(now: @location.available_from) %> <%= f.govuk_error_summary %> <%= f.govuk_radio_buttons_fieldset date_type_question(action), legend: { text: I18n.t("questions.location.toggle_active.apply_from") }, diff --git a/spec/models/location_deactivation_period_spec.rb b/spec/models/location_deactivation_period_spec.rb index b18f28c8a..4e0bb3384 100644 --- a/spec/models/location_deactivation_period_spec.rb +++ b/spec/models/location_deactivation_period_spec.rb @@ -74,7 +74,7 @@ RSpec.describe LocationDeactivationPeriod do location.location_deactivation_periods.clear validator.validate(record) start_date = startdate.to_formatted_s(:govuk_date) - expect(record.errors[:deactivation_date]).to include "The location cannot be deactivated before #{start_date}, the start of the collection year when it was created" + expect(record.errors[:deactivation_date]).to include "The location cannot be deactivated before #{start_date}, the date when it was first available" end end end diff --git a/spec/models/scheme_deactivation_period_spec.rb b/spec/models/scheme_deactivation_period_spec.rb index 71b34108a..eb46ee62f 100644 --- a/spec/models/scheme_deactivation_period_spec.rb +++ b/spec/models/scheme_deactivation_period_spec.rb @@ -63,19 +63,6 @@ RSpec.describe SchemeDeactivationPeriod do expect(record.errors[:deactivation_date]).to be_empty end end - - context "but the scheme was created in the current collection period" do - let(:scheme) { FactoryBot.create(:scheme, created_at: now - 2.days) } - - context "with a deactivation date in the previous collection period" do - it "adds an error" do - record.deactivation_date = now - 1.year - scheme.scheme_deactivation_periods.clear - validator.validate(record) - expect(record.errors[:deactivation_date]).to include "The scheme cannot be deactivated before 1 April 2023, the start of the collection year when it was created" - end - end - end end end end