Can you just stub it before the example in question, either in it or in a
before block?

2009/7/13 Adam Anderson <adamanderso...@gmail.com>

> 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.stub!(:now).and_return(foo_time)
> Time.now # => foo_time
> Time.unstub!(:now)
> Time.now # => whatever time it actually is
>
> Is this possible? I noticed $rspec_mocks.reset_all, but obviously I don't
> want everything to go away, just this one stub.
>
>
> -Adam
>
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to