FactoryGirl and time suggestions

I have an Email model with confirmation code, confirmed_at, and confirmation_sent_at attributes. I’m making a factory for this using FactoryGirl. Any suggestions as to what might be the best practice for the time for the confirmation_sent_at attribute? A sequence with some arbitrary starting date/time and then + 1 day per sequence? All of it Time.now? All of it another arbitrary time in the past?

As the attribute names would suggest, this email model is used to communicate with clients, etc.


I wouldn’t even use sequence for the attributes you’ve mentioned. Instead I’d create couple of factories (one for confirmed and one for unconfirmed user) since this is the only thing that’s important. And when you’re testing the actual confirmation functionallity I’d use Timecop and stub out the attributes under test. Hope it helps.

1 Like

I think that’s a great suggestion. thanks!