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.

Of course, I always treat code smells as indicators and not dictators. :)
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.

I definitely got some value out of it! In fact I have already started adopting some of the patterns you shared, so thank you for writing it. My response to Lenny was in no means trying to discount the article but rather just stating my view on that particular code smell. I apologize if you felt like my reply was trying to discredit the article.

-Ben


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

Reply via email to