Browse Source

Remove soft grant validation for 2024 onwards

pull/2209/head
Kat 2 years ago
parent
commit
b2dc92e402
  1. 1
      app/models/validations/sales/soft_validations.rb
  2. 10
      spec/models/validations/sales/soft_validations_spec.rb

1
app/models/validations/sales/soft_validations.rb

@ -117,6 +117,7 @@ module Validations::Sales::SoftValidations
def grant_outside_common_range?
return unless grant
return unless saledate && !form.start_year_after_2024?
!grant.between?(9_000, 16_000)
end

10
spec/models/validations/sales/soft_validations_spec.rb

@ -660,18 +660,28 @@ RSpec.describe Validations::Sales::SoftValidations do
describe "#grant_outside_common_range?" do
it "returns true if grant is below 9000" do
record.grant = 1_000
record.saledate = Time.zone.local(2024, 1, 1)
expect(record).to be_grant_outside_common_range
end
it "returns true if grant is above 16000" do
record.grant = 100_000
record.saledate = Time.zone.local(2024, 1, 1)
expect(record).to be_grant_outside_common_range
end
it "returns false if grant is within expected range" do
record.grant = 10_000
record.saledate = Time.zone.local(2024, 1, 1)
expect(record).not_to be_grant_outside_common_range
end
it "returns false for logs after 2024" do
record.grant = 100_000
record.saledate = Time.zone.local(2025, 1, 1)
expect(record).not_to be_grant_outside_common_range
end

Loading…
Cancel
Save