[rspec-users] State-based expectations (as per jMock in GOOS)
ashley.moran at patchspace.co.uk
Fri Dec 18 09:35:55 EST 2009
I'm working my way through Growing Object-Oriented Software, 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
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).
More information about the rspec-users