-
Notifications
You must be signed in to change notification settings - Fork 57
[1449] Fix cart availability validation [master] #1452
Conversation
b095d35
to
43c49cc
Compare
As something to consider, should we also disable the add to cart button on the equipment model pages similar to how we disable the add to cart button on the catalog if the item isn't reservable between the dates in the cart? |
We could, it would improve our UX, but I'd add that as a separate issue. I'll open one up. |
Also, did you review this? If not, could you 😛? |
Should we also add tests for different start/end date overlaps in the cart spec? |
43c49cc
to
461764d
Compare
I added tests for overlapping reservations in the cart specs, ready for re-review! |
Turns out our availability calculations are still broken (see here), so I'm blocking this on the fix for v5.5 with that fix being added to this branch along with tests. |
@@ -136,4 +136,47 @@ | |||
expect { @cart.fix_items }.to change { @cart.items.length }.by(-1) | |||
end | |||
end | |||
|
|||
describe 'check_availability' do | |||
before do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is super nitpicky but can we specify :each
here for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure no problem
Looks good |
Resolves #1449 - replace reserved_in_date_range with overlaps_with_date_range that doesn't take status into account and add active where necessary - add specs for cart availability validation - fix specs for reservation availability validation
461764d
to
0e29249
Compare
Addressed the one in-line comment, merging following a green build. |
[1449] Fix cart availability validation
Resolves #1449 on master
reserved_in_date_range
withoverlaps_with_date_range
that doesn't take status into account and addactive
where necessary