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

Wincent Colaiuta win at wincent.com
Thu Jan 27 21:57:13 EST 2011


El 28/01/2011, a las 03:53, Rick DeNatale escribió:

> 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).

Same. When you look at them side by side like that, it is pretty clear what "before each" and "before all" must refer to. Adding a third term to the mix would actually increase the chance of confusion, IMO.

Cheers,
Wincent





More information about the rspec-users mailing list