Displaying 1 result from an estimated 1 matches for "google_vs_yahoo".
2007 Apr 03
5
small suggestion - once method on Expectation
...gets called
exactly once, for example when testing caching or eager loading. What
does the list think of adding this little humane method to
Mocha::Expectation?
def once
times(1)
self
end
which means this:
def test_should_only_grab_post_once_from_the_cache
Post.expects(:get_cache).with(google_vs_yahoo.id).times(1)
comments.first.post
comments.first.post
end
becomes:
def test_should_only_grab_post_once_from_the_cache
Post.expects(:get_cache).with(google_vs_yahoo.id).once
comments.first.post
comments.first.post
end
Not a huge difference, but a little nicer and ruby-ish...