On Mon, Aug 9, 2010 at 8:49 AM, David Chelimsky <dchelim...@gmail.com> wrote:
>
> On Aug 9, 2010, at 7:38 AM, Ashley Moran wrote:
>
>> Hi
>>
>> I was just about to replace a `before` block along the lines of:
>>
>>  before(:each) do
>>   �...@cti_b_id = service.create(name: "Item-B")
>>   �...@cti_z_id = service.create(name: "Z-Item")
>>   �...@cti_a_id = service.create(name: "Item-A")
>>    # ...
>>  end
>>
>> with
>>
>>   let!(:cti_b_id) { ... }
>>   let!(:cti_z_id) { ... }
>>   let!(:cti_a_id) { ... }
>>
>> But then I wondered - since the spec depends on the order they are created 
>> in (it proves ordering is independent of creation order) - is the run order 
>> of `let!` guaranteed?  I imagine they run in the order I expect (ie top to 
>> bottom), but I wondered if that was an explicitly stated property of RSpec?
>
> Yes, eval'd in order. No, not explicitly stated, but I think it should be. 
> Want to submit a patch with a spec for this?

But,

First of all, what's let! as opposed to let, I can't seem to find it
via google or the latest draft of the book.

Second, unless let! is a new method which not only defines the
memoized method but invokes it, then the order of evaluation will
depend on the order the generated let methods are invoked in the
example won't it?


-- 
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@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to