Closed RobRuana closed 7 years ago
Ok, so here's what's going on with the business logic.
MAGFest offers hotel space to returning volunteers. By default, this hotel space is just for the nights of the actual event, e.g. for MAGFest itself that means Thur / Fri / Sat nights.
We also need people to come in before the event to help set up and stay afterwards to help tear down. Therefore, when we ask people what nights they want, we allow them to request setup nights and teardown nights, e.g. Wed / Sun. Since we have WAY more people who want to work setup/teardown than we need, those nights need to be approved by an admin.
The way this is reflected in the database is that we create a HotelRequests
row in the database which foreign keys into the Attendee
table with the nights they've requested, and by default it's approved
column is false.
The setup and teardown shifts in the database are also each special kinds of shifts which we don't display by default, because volunteers need to be approved to take them. This is represented by the can_work_setup
and can_work_teardown
boolean database columns we add to the Attendee
table.
What these failing tests are checking is the desired behavior that when we approve someone's hotel requests, it's supposed to automatically approve them for setup / teardown shifts based on what nights they requested.
At a glance, the reason why this isn't working is that the monkeypatching/mocking wasn't done correctly. In particular, what's happening seems to be that we're basically saying
hr = HotelRequests()
hr.attendee = Attendee()
and then calling some methods on hr.attendee
but the attendee.hotel_requests
backref isn't working because these objects were never added to the database and that relationship wasn't fully set up.
Thank you for the fantastic explanation!
See this travis build for details (also copied below). Yay automated tests!
You can quickly reproduce this from the command line with:
This is a failure of business logic that I don't understand.