On Jan 8, 2008 7:14 PM, Daniel Tenner <[EMAIL PROTECTED]> wrote:
> Might be a personal thing, but my approach is that I try to test the
> public behaviour of the object. Testing private methods is, imho,
> getting dangerously close to specifying how the object does its
> business, rather than what it does.
>
> I would just spec the externally visible behaviour, where it occurs,
> and let the object implement it as it wants (using private methods or
> any other mechanism).

The trouble is that this makes it very difficult to get effective coverage.
There is usually a lot more setup involved. If your tests are more expensive
to write, because you are unit testing indirectly through public methods,
less testing will get done, and worse tests can end up getting very brittle.

I do like the idea though of during the unit test itself, you unseal the method.
You get the best of both worlds.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to