[rspec-users] Stubbing out Time correctly
scott at railsnewbie.com
Mon Jul 13 12:58:20 EDT 2009
On Jul 13, 2009, at 12:09 PM, Adam Anderson wrote:
> I can't seem to find a good way to do this. If I stub out Time.now
> in one of my specs but need to return it to its original
> functionality then can I remove the stub?
> So I'd like to say something like:
> Time.now # => foo_time
> Time.now # => whatever time it actually is
Capture it before you stub it:
> Is this possible? I noticed $rspec_mocks.reset_all, but obviously I
> don't want everything to go away, just this one stub.
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users