[rspec-users] Strange message expectation behaviour with Time.now in a find condition

Mark Wilden mark at mwilden.com
Fri Jan 30 12:05:42 EST 2009

On Fri, Jan 30, 2009 at 7:38 AM, David Chelimsky <dchelimsky at gmail.com>wrote:

> On Fri, Jan 30, 2009 at 9:17 AM, Mark Wilden <mark at mwilden.com> wrote:
> > Avdi Grimm wrote a blog post about why he doesn't stub Time.now and
> instead
> > always injects a clock into his objects. I disagreed, but I can't seem to
> > find the article now.
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/297660

Yeah, I saw that, but he laid out his case in greater depth in a blog post
(i know because I posted a comment disagreeing with it!).

The interesting thing is that Avdi says that stubbing Time.now has broken
some of his tests in the past because of other code (like RSpec) that calls
it. I can't say I've ever run into that myself, but it bears keeping in

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090130/a6c854ae/attachment.html>

More information about the rspec-users mailing list