Allow to schedule resource allocations on just one day

This commit is contained in:
Klaus Zanders
2026-06-10 09:40:08 +02:00
parent d3b86ed049
commit 879d4e8abe
2 changed files with 3 additions and 4 deletions
@@ -160,7 +160,7 @@ class ResourceAllocation < ApplicationRecord
def end_date_after_start_date
return if start_date.blank? || end_date.blank?
return if end_date > start_date
return if end_date >= start_date
errors.add :end_date, :greater_than_start_date
end
@@ -400,9 +400,8 @@ RSpec.describe ResourceAllocation do
allocation.end_date = Date.new(2026, 1, 1)
end
it "is invalid" do
expect(allocation).not_to be_valid
expect(allocation.errors.symbols_for(:end_date)).to include(:greater_than_start_date)
it "is valid (single-day allocation)" do
expect(allocation).to be_valid
end
end