On Sun, Sep 20, 2009 at 9:34 PM, nruth <nick.rutherf...@gmail.com> wrote: > > I think I wasn't clear with my original post: before blocks work fine, > this is just a readability/comprehension/maintenance concern.
Peanut gallery: I personally find the separate "before" block clearer, more readable, and more aesthetically appealing than an inline ":context => lambda {something}". Lambda is an ugly word. I know we inherited it from Lisp and that the fundamental concept of closures is a beautiful thing, responsible for puppies and rainbows and ActiveRecord, but still. It doesn't _feel_ good to have to add jargon on top of a block just to say "I know this is a dynamic language, but this here? This part is _really_ dynamic." Putting lambdas and Proc.news into my Ruby code always makes me feel like I just scuffed my clean white shoes. (The 'stabby' operator in Ruby 1.9 is only marginally better.) Context? "Context" isn't an ugly word but it's a really ambiguous one. It means so many things, depending on...well, the context. Whereas if I see a bunch of code with "before" or "before(:each)" at the top, I can make a _really_ good guess just from looking at it what it's supposed to do, and when. It may not be attached umbilically to the describe statement, but it's still in there, doing what it does, and I keep mine right underneath the describe where I can see it. (I confess I'm not really sure what you mean by the before block "going astray." If you find that your test code is getting out from under your fence at night, roaming the neighborhood, perhaps you aren't feeding it often enough?) -- Have Fun, Steve Eley (sfe...@gmail.com) ESCAPE POD - The Science Fiction Podcast Magazine http://www.escapepod.org _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users