[rspec-users] DateTime.now.utc in fixtures

Rick DeNatale rick.denatale at gmail.com
Tue Oct 12 08:51:03 EDT 2010


On Tue, Oct 12, 2010 at 6:06 AM, Thomas R. Koll <tomk32 at gmx.de> wrote:
> Hi,
>
> It might sound strange, but you usually stub Time.now
> Read here: http://ariejan.net/2008/11/05/rspecing-with-timenow/

I used to do this myself even with Test::Unit
http://talklikeaduck.denhaven2.com/2007/07/18/time-flies-while-youre-having-fun-testing

More recently I've been using timecop

http://github.com/jtrupiano/timecop

It allows time to be either frozen or offset, and it stubs Time,
DateTime and Date to do the right thing.

-- 
Rick DeNatale

Help fund my talk at Ruby Conf 2010:http://pledgie.com/campaigns/13677
Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale


More information about the rspec-users mailing list