mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Allow to schedule resource allocations on just one day
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user