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

2011-01-31 Thread David Chelimsky
On Jan 31, 2011, at 3:38 AM, Evgeniy Dolzhenko wrote: > Btw. there is also before(:suite), and working from there wouldn't it make > sense to have > > 1. before(:suite) > 2. before(:group) > 3. before(:example) > > which would reflect the hierarchy of RSpec run (i.e. suite > group > example).

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

2011-01-31 Thread Steven Rogers
On Jan 31, 2011, at 3:38 AM, Evgeniy Dolzhenko wrote: > Btw. there is also before(:suite), and working from there wouldn't it make > sense to have > > 1. before(:suite) > 2. before(:group) > 3. before(:example) > > which would reflect the hierarchy of RSpec run (i.e. suite > group > example).

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

2011-01-31 Thread Evgeniy Dolzhenko
Btw. there is also before(:suite), and working from there wouldn't it make sense to have 1. before(:suite) 2. before(:group) 3. before(:example) which would reflect the hierarchy of RSpec run (i.e. suite > group > example). Anyway likely it's too late to introduce something like this, just m

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

2011-01-31 Thread Pat Maddox
On Jan 27, 2011, at 6:53 PM, Rick DeNatale wrote: > On Thu, Jan 27, 2011 at 6:16 PM, David Chelimsky 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 b

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

2011-01-27 Thread Wincent Colaiuta
El 28/01/2011, a las 03:53, Rick DeNatale escribió: > On Thu, Jan 27, 2011 at 6:16 PM, David Chelimsky 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

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

2011-01-27 Thread John Feminella
Not to shoot my own patch in the foot, but my personal opinion is to have only one way to do it. I think whatever ambiguity there may be in before(:all) isn't adequately compensated by the additional confusion of having before(:any), which sounds like it would do something subtly different. -- John

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

2011-01-27 Thread David Chelimsky
On Thu, Jan 27, 2011 at 8:53 PM, Rick DeNatale wrote: > On Thu, Jan 27, 2011 at 6:16 PM, David Chelimsky 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

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

2011-01-27 Thread Jon Homan
My understanding is that the before :each block runs before every example. While before :all blocks run once for the entire example group. Any side effects in the examples will be persist for objects if you use a before :all block. But if you were to use before :each, you guarantee the state befor

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

2011-01-27 Thread Rick DeNatale
On Thu, Jan 27, 2011 at 6:16 PM, David Chelimsky 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 >

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

2011-01-27 Thread John Feminella
> Perhaps :any is a better name? We could add it as an alternative for the same > as :all. WDYT? I think that's an interesting idea, David. I whipped up a quick pull request, which you can see here: https://github.com/rspec/rspec-core/pull/293 ~ jf -- John Feminella Principal Consultant, BitsBu

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

2011-01-27 Thread Brian Warner
That does clear it. Thank you =] -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

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

2011-01-27 Thread David Chelimsky
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? > -- > John Feminella > Principal Consultant, BitsB

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

2011-01-27 Thread John Feminella
That's not quite right. :each runs before _each_ spec, while :all runs once, before _any_ spec. -- John Feminella Principal Consultant, BitsBuilder LI: http://www.linkedin.com/in/fjsquared SO: http://stackoverflow.com/users/75170/ On Thu, Jan 27, 2011 at 17:56, Brian Warner wrote: > I'm having

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

2011-01-27 Thread John Feminella
Here's an illustrative example that should clear things up: require 'spec_helper' describe "behavior of before-each and before-all" do before(:all) { puts "-- running :all" } before(:each) { puts "-- running :each" } describe "addition" do it "should add two and two" do (2 + 2).s

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

2011-01-27 Thread Brian Warner
I'm having a hard time grasping the difference between :each and :all. If I have a bunch of stuff inside a "before :each" block. Everytime I try to run an example that block of code will be run before the example. Now if I had the same code inside a "before :all" block. Everytime an example is ru