[rspec-users] Difference between :each and :all

Pat Maddox patmaddox at me.com
Mon Jan 31 03:34:28 EST 2011

On Jan 27, 2011, at 6:53 PM, Rick DeNatale <rick.denatale at gmail.com> wrote:

> On Thu, Jan 27, 2011 at 6:16 PM, David Chelimsky <dchelimsky at gmail.com> wrote:
>> On Jan 27, 2011, at 5:11 PM, John Feminella wrote:
>>> That's not quite right. :each runs before _each_ spec, while :all runs
>>> once, before _any_ spec.
>> Perhaps :any is a better name? We could add it as an alternative for the same as :all. WDYT?
> Speaking for myself, I never was confused between before(:each) and
> before(:all).  The first always meant before each OF the examples, and
> the latter before all the examples.
> As a devil's advocate, while before(:any) might evoke the current
> meaning of before(:all) for some people, after(:any) to me evokes the
> curent meaning of after(:each) more than it does after(:all), i.e.
> after any OF the examples rather than after all the examples, because
> I'd never say after any the examples.
> But that might just be me.
> -- 
> Rick DeNatale
> Blog: http://talklikeaduck.denhaven2.com/
> Github: http://github.com/rubyredrick
> Twitter: @RickDeNatale
> WWR: http://www.workingwithrails.com/person/9021-rick-denatale
> LinkedIn: http://www.linkedin.com/in/rickdenatale
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

I feel like a third option will cause more confusion, especially if it's just an alias of an existing option!


More information about the rspec-users mailing list