I have couple hundred tests and I work with date/time a lot. In some tests, I aim for output format, elsewhere, I check date ranges. Therefore, my tests have lots of these:
FactoryGirl.create(:foo, ended_at: Time.zone.local(2014, 5, 5, 22, 15))
I thought, maybe there's a shortcut to these, since in some test files, I only work with few timestamps.
FactoryGirl.create(:foo, ended_at: may_5_22_15)
Where may_5_22_15 would be defined in method or using let.
Is this a good way to go?
Aucun commentaire:
Enregistrer un commentaire