Re: [rspec-users] before(:all) and nested contexts

2009-07-09 Thread David Chelimsky
On Thu, Jul 9, 2009 at 9:37 AM, Daniel Tenner wrote: >> 2) Is it your goal to call "some_expensive_operation" once and only once? > > Yes, exactly. In the case of the project archival spec, creating a project, > archiving it, and then unzipping it to a temporary location to look at what > was archi

Re: [rspec-users] before(:all) and nested contexts

2009-07-09 Thread Daniel Tenner
> > 2) Is it your goal to call "some_expensive_operation" once and only once? Yes, exactly. In the case of the project archival spec, creating a project, archiving it, and then unzipping it to a temporary location to look at what was archived is a process that takes about 3 seconds on my machine.

Re: [rspec-users] before(:all) and nested contexts

2009-07-09 Thread Zach Moazeni
Rereading your original email, I'm thinking I may not have entirely understood your situation. 1) Looks like you've already defined the "some_expensive_operation" (but that's minor) 2) Is it your goal to call "some_expensive_operation" once and only once? On Jul 9, 2009, at 10:18 AM,

Re: [rspec-users] before(:all) and nested contexts

2009-07-09 Thread Zach Moazeni
Hey Dan, 1 approach you could do is define a method within the outer describe that is called within the inner describe and within each test not contained by an inner describe. describe "Some functionality" do it "should do something" do @variable = some_expensive_operation @variab

Re: [rspec-users] before(:all) and nested contexts

2009-07-09 Thread David Chelimsky
On Thu, Jul 9, 2009 at 5:40 AM, Daniel Tenner wrote: > Hi all, > Like everyone (?), I use nested contexts to keep my specs well organised and > tidy. > However, I have a problem. I have various sets of specs that needs to > perform very time-expensive operations to set up the fixtures that will be

Re: [rspec-users] before(:all) and nested contexts

2009-07-09 Thread Daniel Tenner
To answer myself, I've put together the following work-around: http://www.swombat.com/getting-rspec-beforeall-and-nested-contexts-w Still, would love to know if there was a better, less hackish way to do it. Daniel On Thu, Jul 9, 2009 at 11:40 AM, Daniel Tenner wrote: > Hi all, > Like everyone

[rspec-users] before(:all) and nested contexts

2009-07-09 Thread Daniel Tenner
Hi all, Like everyone (?), I use nested contexts to keep my specs well organised and tidy. However, I have a problem. I have various sets of specs that needs to perform very time-expensive operations to set up the fixtures that will be examined in the tests. Two specific examples: testing access c