These associations create unnecessary data in the database. For example, the shift association in the ShiftEvent factory creates an additional shift_event, which means creating a shift_event from a factory actually creates 2. In addition, every shift_event creates one event. That means creating an event from its factory creates 3 events:
- one from the event factory,
- one from the shift event factory,
- and one from the shift factory which creates an additional shift event
These extra associations sometimes cause tests to fail.
It seems like this was done to construct shifts, events, and shift_events more easily in tests. For example, ShiftEvent does not directly have an organization; Event does. But the factories were set up so you could assign those properties and the automatically created associations would use them.
This removes those extra associations now that the tests all use event factories.
This is a lot of reorganizing and I tried to split the commits up in a way that made them reasonable to review.