Browse Source

refactor: linting

pull/980/head
natdeanlewissoftwire 2 years ago
parent
commit
afba2029b5
  1. 2
      app/models/location.rb
  2. 2
      app/models/scheme.rb
  3. 2
      spec/models/location_spec.rb
  4. 2
      spec/models/scheme_spec.rb

2
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

2
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

2
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

2
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

Loading…
Cancel
Save