> >From: Adam Anderson <adamanderso...@gmail.com> > >Would using this kind of technique require me to use that intention-revealing >method to be used in place of Time.now everywhere in the app? That is what it >seems like to me and if that's the case then I couldn't see myself doing a >Find/Replace across the entire app on Time.now. If I am misunderstanding can >you elaborate? > > >On Mon, Jul 13, 2009 at 10:00 AM, BJ Clark <b...@aboutus.org> wrote: > >What I usually do is extract out the original Time.now call to method >somewhere (with an intention revealing name) and stub out the method instead >of #now itself. >> >> > > > I think the idea is this: def test_data_time Time.now() end def create_test_data now = test_data_time() # instead of now = Time.now() ... end Now, you can stub out test_data_time, and you'll get consistent stubbed time just for the context where you wanted it. Make sense? Randy
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users