-
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.
test(bookings): returns query for current user when no user or zone i…
…s specified (#144)
- Loading branch information
Showing
1 changed file
with
14 additions
and
0 deletions.
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 |
---|---|---|
|
@@ -80,6 +80,20 @@ describe Bookings do | |
booking_user_ids = body.map { |r| r["user_id"] } | ||
booking_user_ids.should eq(["[email protected]"]) | ||
end | ||
|
||
it "should return a list of bookings filtered current user when no zones or user is specified" do | ||
tenant = Tenant.query.find! { domain == "toby.staff-api.dev" } | ||
BookingsHelper.create_booking(tenant_id: tenant.id, user_id: "[email protected]") | ||
BookingsHelper.create_booking(tenant.id) | ||
|
||
starting = 5.minutes.from_now.to_unix | ||
ending = 40.minutes.from_now.to_unix | ||
# Since we are using Toby's token to login, user=current means Toby | ||
route = "#{BOOKINGS_BASE}?period_start=#{starting}&period_end=#{ending}&type=desk" | ||
body = Context(Bookings, JSON::Any).response("GET", route, headers: Mock::Headers.office365_guest, &.index)[1].as_a | ||
booking_user_ids = body.map { |r| r["user_id"] } | ||
booking_user_ids.should eq(["[email protected]"]) | ||
end | ||
end | ||
|
||
it "#show should find booking" do | ||
|