[rspec-users] New article on "Listening to Your Specs" up on Ruby Advent 2008
lenny at aps.org
Fri Dec 19 15:43:24 EST 2008
On Dec 19, 2008, at 12:55 PM, Avdi Grimm wrote:
> On Fri, Dec 19, 2008 at 12:02 PM, Lenny Marks <lenny at aps.org> wrote:
>> Thanks to you and Dave for your responses. I've commented on the
>> article with back links to this thread. Hope I didn't overstep by
>> saying "I
>> think there is some consensus that 'Contexts named after methods'
>> is not a
>> smell and can even be a natural result of 'Outside In' coding".
> I'd like to remind folks of something I pointed out at the top of the
> article: the definition of a "code smell" is a pattern that *might*
> indicate something is amiss. It's not a surety.
> I agree that naming description blocks after methods is *less* of a
> smell than naming examples after methods. I've been known to name
> contexts after methods, especially when spec-ing a) Rails helper
> methods; and b) public library APIs. I don't feel guilty for this.
> Where a description block named for a method becomes a more probable
> indicator of a design issue is when it's coupled with a block that
> goes on and on for many examples. This often indicates that the
> method being described is doing too much, and wants to be either
> broken up or factored out into another class.
> I don't pretend to be a canonical source for RSpec best practices.
> Lakshan asked me for an article on RSpec practices and I listed some
> of the guidelines that have served me well. He said some nice things
> at the top of the article which I'm not sure were wholly warranted.
> Your mileage, as always, may vary.
> Anyway I'm happy to hear that some people got at least a little value
> out of the article, and I appreciate all the feedback.
Just to clarify...I thought most of your article was good stuff and I
can appreciate how difficult it is to articulate this kind of stuff.
I really just had a problem with that one smell as I understood it
from your article since it contradicted advice I often give about
coding outside in. I just wanted to get some reassurance that I
wasn't steering my fellow employees in the wrong direction. FWIW, I
agree with the way you state things above. Thanks for taking the time
More information about the rspec-users