[rspec-users] Specifying that code is called in a block

Ashley Moran work at ashleymoran.me.uk
Thu Mar 8 06:17:06 EST 2007

On 7 Mar 2007, at 16:45, aslak hellesoy wrote:

> How is JMock supporting ordering of calls across mocks? I have been
> using JMock for years and have never seen that feature.

 From <http://www.jmock.org/oopsla2004.pdf>, section 3.4

public void
testReturnsCachedObjectWithinTimeout() {
     .method("load").with( eq(KEY) )
     .will( returnValue(VALUE) );

     .after(mockLoader, "load")
     .will( returnValues(loadTime, fetchTime) );

        .with( eq(loadTime), eq(fetchTime) )
      .will( returnValue(false) );
   assertSame( "should be loaded object",
               VALUE, cache.lookup(KEY) );
   assertSame( "should be cached object",
               VALUE, cache.lookup(KEY) );

More information about the rspec-users mailing list