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

David Chelimsky dchelimsky at gmail.com
Thu Jan 27 21:58:12 EST 2011

On Thu, Jan 27, 2011 at 8: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.

You're absolutely right that it would be confusing for after, and
given that, I think we should probably not add it.

More information about the rspec-users mailing list