diff --git a/app/models/location.rb b/app/models/location.rb index 4333ea27c..2df620292 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -403,7 +403,7 @@ class Location < ApplicationRecord end else collection_start_date = FormHandler.instance.current_collection_start_date - if !deactivation_date.between?(collection_start_date, Date.new(2200, 1, 1)) + unless deactivation_date.between?(collection_start_date, Date.new(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/app/models/scheme.rb b/app/models/scheme.rb index d87b33fb7..5de804c58 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -245,7 +245,7 @@ class Scheme < ApplicationRecord end else collection_start_date = FormHandler.instance.current_collection_start_date - if !deactivation_date.between?(collection_start_date, Date.new(2200, 1, 1)) + unless deactivation_date.between?(collection_start_date, Date.new(2200, 1, 1)) errors.add(:deactivation_date, message: I18n.t("validations.scheme.deactivation_date.out_of_range", date: collection_start_date.to_formatted_s(:govuk_date))) end end diff --git a/spec/models/location_spec.rb b/spec/models/location_spec.rb index 32cab5e8e..069bb21d7 100644 --- a/spec/models/location_spec.rb +++ b/spec/models/location_spec.rb @@ -152,7 +152,7 @@ RSpec.describe Location, type: :model do let(:location) { FactoryBot.create(:location, deactivation_date: Date.new(2022, 4, 1)) } it "is valid" do - expect(location.valid?).to be_truthy + expect(location).to be_valid end end end diff --git a/spec/models/scheme_spec.rb b/spec/models/scheme_spec.rb index 561aec2b1..b9e8fd886 100644 --- a/spec/models/scheme_spec.rb +++ b/spec/models/scheme_spec.rb @@ -132,7 +132,7 @@ RSpec.describe Scheme, type: :model do let(:scheme) { FactoryBot.create(:scheme, deactivation_date: Date.new(2022, 4, 1)) } it "is valid" do - expect(scheme.valid?).to be_truthy + expect(scheme).to be_valid end end end