|
|
|
|
@ -24,10 +24,6 @@ RSpec.describe Validations::Sales::SetupValidations do
|
|
|
|
|
context "when saledate is in the open collection year" do |
|
|
|
|
let(:record) { build(:sales_log, :saledate_today) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(Time).to receive(:now).and_return(Time.zone.local(2023, 1, 10)) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "does not add an error" do |
|
|
|
|
setup_validator.validate_saledate_collection_year(record) |
|
|
|
|
|
|
|
|
|
@ -71,7 +67,7 @@ RSpec.describe Validations::Sales::SetupValidations do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when saledate is in the 22/23 collection year" do |
|
|
|
|
context "when saledate is in an open previous collection year" do |
|
|
|
|
let(:record) { build(:sales_log, saledate: Time.zone.local(2024, 1, 1)) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
@ -85,7 +81,7 @@ RSpec.describe Validations::Sales::SetupValidations do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when saledate is before the 22/23 collection year" do |
|
|
|
|
context "when saledate is before an open collection year" do |
|
|
|
|
let(:record) { build(:sales_log, saledate: Time.zone.local(2020, 5, 1)) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
@ -99,7 +95,7 @@ RSpec.describe Validations::Sales::SetupValidations do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when saledate is after the 22/23 collection year" do |
|
|
|
|
context "when saledate is after an open collection year" do |
|
|
|
|
let(:record) { build(:sales_log, saledate: Time.zone.local(2025, 4, 1)) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|