Displaying 1 result from an estimated 1 matches for "exactly_onc".
Did you mean:
exactly_once
2007 Apr 03
5
small suggestion - once method on Expectation
I find that a lot of times I want to ensure a method 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)