[rspec-users] State-based expectations (as per jMock in GOOS)

Ashley Moran ashley.moran at patchspace.co.uk
Fri Dec 18 09:35:55 EST 2009

Hi all

I'm working my way through Growing Object-Oriented Software[1], currently at the start of chapter 15.  Chapter 14 introduces a concept I haven't seen before, state-based expectations based on sent messages.

The principle appears to be 

  object O has sent message M => O is in state S

followed by

  O is in state S     => (expectation E met) passes spec
  O is not in state S => (expectation E met) violates spec

Has anyone tried this with RSpec (mocks) yet?  Just wondered if it was doable with the current syntax support or would need an extension.

I thought I'd fire this off now to get ideas, as I won't be coding using this technique until I've finished the book (a week at least, I imagine).


[1] http://www.amazon.co.uk/gp/product/0321503627/


More information about the rspec-users mailing list