I have two models, Event
and Registration
:
class Event < ApplicationRecord
has_many :registrations
end
class Registration < ApplicationRecord
belongs_to :event
end
I also have fixtures for these models:
event_one:
[...]
registration_one:
event: event_one
However, in test, if I get the event and check its registrations, there are none.
event = events(:event_one)
puts event.registrations.count # Prints: 0
How do I make sure these associations are loaded for tests?