|
|
|
@ -90,6 +90,30 @@ RSpec.describe SalesLog, type: :model do
|
|
|
|
|
expect(completed_sales_log.not_started?).to be(false) |
|
|
|
|
expect(completed_sales_log.completed?).to be(true) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when proplen is not given" do |
|
|
|
|
before do |
|
|
|
|
Timecop.freeze(Time.zone.local(2023, 5, 1)) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
after do |
|
|
|
|
Timecop.unfreeze |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "is set to completed for a log with a saledate before 23/24" do |
|
|
|
|
completed_sales_log.update!(proplen: nil, saledate: Time.zone.local(2022, 5, 1)) |
|
|
|
|
expect(completed_sales_log.in_progress?).to be(false) |
|
|
|
|
expect(completed_sales_log.not_started?).to be(false) |
|
|
|
|
expect(completed_sales_log.completed?).to be(true) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "is set to in_progress for a log with a saledate after 23/24" do |
|
|
|
|
completed_sales_log.update!(proplen: nil, saledate: Time.zone.local(2023, 5, 1)) |
|
|
|
|
expect(completed_sales_log.in_progress?).to be(true) |
|
|
|
|
expect(completed_sales_log.not_started?).to be(false) |
|
|
|
|
expect(completed_sales_log.completed?).to be(false) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when filtering by organisation" do |
|
|
|
|