-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(bookings): prevent start and end times being the same
- Loading branch information
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -269,4 +269,26 @@ module PlaceOS::Model | |
local.save.should be_false | ||
local.persisted?.should be_false | ||
end | ||
|
||
it "rejects a booking with the same start and end times" do | ||
user_email = "[email protected]" | ||
tenant_id = Generator.tenant.id | ||
start_time = 1.hour.from_now.to_unix | ||
|
||
booking = Booking.new( | ||
booking_type: "desk", | ||
asset_ids: ["desk2"], | ||
booking_start: start_time, | ||
booking_end: start_time, | ||
user_email: PlaceOS::Model::Email.new(user_email), | ||
user_name: "Steve", | ||
booked_by_email: PlaceOS::Model::Email.new(user_email), | ||
booked_by_name: "Steve", | ||
tenant_id: tenant_id, | ||
booked_by_id: "user-1234", | ||
history: [] of Booking::History | ||
) | ||
booking.save.should be_false | ||
booking.persisted?.should be_false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters