On Thu, Sep 4, 2008 at 4:14 PM, Nick Hoffman <[EMAIL PROTECTED]> wrote:
> However, I'm not a fan of mocking and stubbing, primarily for two reasons: > 1) I believe that specs should test behaviour, rather than a behaviour's > implementation. "Behavior" (to me) means "what it does." "What it does" means how it interacts with other objects. If you make sure it interacts with other objects properly (and you make sure those other objects also behave correctly) you have a confidence-inspiring spec. The alternative is to test state, which could be termed "what it is." I think you may be saying you prefer that approach, which is completely valid. Martin Fowler wrote the canonical article on the difference between these two approaches. 2) Using mocks and stubs causes your specs and implementation to be tightly > coupled, which often forces you to modify your specs if changes occur in the > implementation. > That's completely true. However, you are shielded from -other- classes' implementation. With state-based testing, everything has to be correct all the way down. With behavior-based testing, you're only testing one thing at a time. I haven't been working with mock objects all that long myself, so anything I've said here is subject to contradiction by someone who really knows what they're talking about. :) ///ark
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users