[rspec-users] stubbing Time.zone.now for model tests fails for Rails 2.3.1

Bart Zonneveld zuperinfinite at gmail.com
Sat Mar 14 06:27:37 EDT 2009

On 12 mrt 2009, at 04:22, Stephen Eley wrote:

> On Wed, Mar 11, 2009 at 1:40 PM, David Schmidt <davids at tower-mt.com>  
> wrote:
>> Has anyone else run into this problem and come up with a solution  
>> to getting
>> a fixed time back from Time.zone.now?
> This plugin has worked very well for me:
> http://github.com/notahat/time_travel/tree/master

Great! This is exactly what I need for a project I'm working on.
However, I need to run all my tests on a specific date. I'm doing  
stuff which is week-based, so "Tomorrow" and "Next week" are always  
different, and therefore I'd like to set it to a specific date for all  
my tests.
Any idea how to hook this into a Before-hook in Cucumber perhaps?


More information about the rspec-users mailing list