Topic: Brain freeze ... testing updated/created_at parameters...
Is there a best practice for testing how the magic created_at/updated_at timestamped files are updated?
I have a standard has_many :through, with the join model having the created_at as an extra parameter. This join model related "couples" to "events" through "event_registrations". The normal interaction is that from a couple-based form a list of event_ids is returned (checkboxes). I'll compare the list of event_ids to the saved list to derive the events-to-add registrations for and the events-to-delete registrations for. (This part is easy...) And while my initial implementation is correct, the tests don't properly constrain it -- I need to add the test that if an event was already registered it doesn't change the created_on. (Ie, the implementation shall not do a "drop all current registration for the couple and then add the selected list").
I could hard-code a timestamp into the fixture, cache the result in the test and compare. I think this is the easiest, and I don't really need the flexibility of that timestamp migrated (like in the future-proof book of AWDwR). Does the timestamp/cahche/compare method sound right to you? Is there a better way?