[rspec-users] Stubs and contract tests
dchelimsky at gmail.com
Fri May 11 16:48:54 UTC 2012
On Fri, May 11, 2012 at 9:24 AM, Alexandre de Oliveira <
chavedomundo at gmail.com> wrote:
> Hey guys, could you help me (in)validating an idea?
> As you might know, Contract tests solve a problem stubs have: if the
> object interface changes, the stubbed tests will continue passing.
> In RSpec, it's common to use a shared_context to describe contracts, so
> both Posts and Comments tests would have PostsCommentsContract. If
> Comment's interface ever changed, Posts tests would present a failure
> wherever we ran it. However, it won't tell us which stubbed methods were
> invalid now; it just tell us the file that have invalid stubs.
> If we had, for example, #stub_contract(:method), automatically raising
> a failure if its reference (double) object's interface changed, how would
> it be bad?
> I'm trying to think the cons of it. Could you guys help me finding it?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users