[rspec-users] Specs for RSpec Matchers and Helpers

Mark Wilden mark at mwilden.com
Wed Apr 15 11:10:09 EDT 2009

On Wed, Apr 15, 2009 at 7:52 AM, Brandon Olivares
<programmer2188 at gmail.com> wrote:
> I've been extracting a lot of code out of my specs into their own matchers,
> helpers, and macros.
> I notice that the plugins that have their own specs, such as rspec-rails,
> and even RSpec itself, have specs for the matchers and helpers. Is this
> generally a good thing to do, or is it unnecessary?

The main difference is that they ship their matchers and you don't. If
their matchers have bugs, then their product has bugs. Not necessarily
so with your matchers.

In general, test code is simpler and more obvious than the code it
tests. So we don't have to test our tests. But it certainly doesn't
hurt, and if doing so increases the comfort level to a desired level,
then by all means do it.

Finally, much code can benefit from TDD, including matchers.


More information about the rspec-users mailing list