On Dec 19, 2008, at 12:55 PM, Avdi Grimm wrote:

On Fri, Dec 19, 2008 at 12:02 PM, Lenny Marks <le...@aps.org> wrote:
Thanks to you and Dave for your responses. I've commented on the original 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.

--
Avdi


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 to share.

-lenny
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to