[rspec-users] A recently observed anti pattern: commented out tests

David Chelimsky dchelimsky at gmail.com
Tue Jul 24 01:54:41 UTC 2012


On Mon, Jul 23, 2012 at 11:19 AM, James Cox <james at imaj.es> wrote:
> Hey,
>
> in a bunch of the rescues i've recently done, I see a pretty big anti
> pattern: tests don't work, and so rather than making them work, the
> dev team just comments them out till 'later'.
>
> Does anyone think it'd be useful/interesting to get a flag for rspec
> which would compare lines vs lines-commented, and if the percentage
> was higher than xx, it'd issue some kind of warning?

The pending feature is designed to help with this problem by allowing
you to disable an example while still keeping it visible.

If we were to do what you propose, we'd need to offer an opt-out
and/or the ability to configure the percentage. Consider a suite that
uses a lot of comments to annotate the specs. The problem with making
it configurable is that the folks who's priorities lead them to
comment out examples instead of fixing them will likely just disable
this feature.

I'd say, let's encourage people to use 'pending' correctly. WDYT?

Cheers,
David


More information about the rspec-users mailing list