Re: [rspec-users] let vs ivar w/ before block

2011-10-01 Thread Ash Moran
On 1 Oct 2011, at 00:36, Srushti Ambekallu wrote: > On 30/09/11 6:24 PM, Patrick J. Collins wrote: >> So regarding objects persisting over multiple examples-- I was told >> repeatedly >> by experienced RSpec peeps to not use before(:all)… > > I don't know if object creation (including the corr

Re: [rspec-users] let vs ivar w/ before block

2011-09-30 Thread Srushti Ambekallu
On 30/09/11 6:24 PM, Patrick J. Collins wrote: Proper usage, sure, but the memoization is only within each example - not across examples. That way you can do this: So regarding objects persisting over multiple examples-- I was told repeatedly by experienced RSpec peeps to not use before(:all)..

Re: [rspec-users] let vs ivar w/ before block

2011-09-30 Thread Patrick J. Collins
> Proper usage, sure, but the memoization is only within each example - not > across examples. That way you can do this: So regarding objects persisting over multiple examples-- I was told repeatedly by experienced RSpec peeps to not use before(:all)... But in a case like: before(:each) do @u

Re: [rspec-users] let vs ivar w/ before block

2011-09-30 Thread David Chelimsky
On Sep 30, 2011, at 4:32 PM, Srushti Ambekallu wrote: > On 30/09/11 3:58 PM, David Chelimsky wrote: >> On Sep 30, 2011, at 3:31 PM, Patrick J. Collins wrote: >> Proper usage, sure, but the memoization is only within each example - not across examples. That way you can do this: >

Re: [rspec-users] let vs ivar w/ before block

2011-09-30 Thread Srushti Ambekallu
On 30/09/11 3:58 PM, David Chelimsky wrote: On Sep 30, 2011, at 3:31 PM, Patrick J. Collins wrote: Proper usage, sure, but the memoization is only within each example - not across examples. That way you can do this: let(:thing) { Thing.new } it "does something" do thing.blah thing.whatev

Re: [rspec-users] let vs ivar w/ before block

2011-09-30 Thread David Chelimsky
On Sep 30, 2011, at 3:31 PM, Patrick J. Collins wrote: >> Proper usage, sure, but the memoization is only within each example - not >> across examples. That way you can do this: >> >> let(:thing) { Thing.new } >> >> it "does something" do >> thing.blah >> thing.whatever >> thing.yet_again >>

Re: [rspec-users] let vs ivar w/ before block

2011-09-30 Thread Patrick J. Collins
> Proper usage, sure, but the memoization is only within each example - not > across examples. That way you can do this: > > let(:thing) { Thing.new } > > it "does something" do > thing.blah > thing.whatever > thing.yet_again > end > > In that case each reference to thing returns the same

Re: [rspec-users] let vs ivar w/ before block

2011-09-30 Thread David Chelimsky
On Sep 30, 2011, at 2:48 PM, Patrick J. Collins wrote: > Am I correct in understanding that the point of using let is that it can > minimize database calls due to memoization? > > describe "#something" do > > let(:something) = Something.groovy_scope > > it "does x" do >something.first.x.s

[rspec-users] let vs ivar w/ before block

2011-09-30 Thread Patrick J. Collins
Am I correct in understanding that the point of using let is that it can minimize database calls due to memoization? describe "#something" do let(:something) = Something.groovy_scope it "does x" do something.first.x.should have_coolness end it "does y" do something.first.y.

Re: [rspec-users] let vs ivar w/ before block

2011-09-30 Thread Patrick J. Collins
> Am I correct in understanding that the point of using let is that it can > minimize database calls due to memoization? > > describe "#something" do > > let(:something) = Something.groovy_scope and obviously I meant let(:something) { ... }, not = (oops)... Patrick J. Collins http://collinat