On Wed, Feb 22, 2012 at 12:54:31PM -0800, gdo wrote:
> But now, I need to do automatic test and in the code you use Time.now
> and I can't control the system date to repeat my test.
> Is it possible to replace Time.now by
> def Rufus.time_now
> if $rufus_time == nil
> return Time.now
> return $rufus_time
> with this code I obtain a fine control on time to repeat my tests.
why not simply override Time.now at the beginning of your tests?
# return your test time...
If you want something a bit more sophisticated:
There are other such time stopping gems, but I only remember this one.
John Mettraux - http://lambda.io/processi