Re: [rspec-users] before(:all) to set up mocks and stubs

2010-07-15 Thread Ivo Dancet
Thanks for your answers. I'll use a fixture replacement to set up the environment. I know that this (using before(:all) to setup a state) is not a best practice. In this case however, I would consider my approach to be acceptable as the pdf takes a long time to generate. All tests run on the

[rspec-users] before(:all) to set up mocks and stubs

2010-07-13 Thread Ivo Dancet
Hi I'm upgrading an application to rspec2/rails3. A certain suite of tests, that generates a pdf document, uses a before(:all) filter to set the environment using mocks and stubs. Then the pdf gets generated and after that all the tests run on that same pdf document. In rspec2 it seems like I

Re: [rspec-users] before(:all) to set up mocks and stubs

2010-07-13 Thread Bayard Randel
I know that generally it is not considered best practice to user before(:all) and after(:all) as state is shared between all examples, which is a unit-testing anti-pattern. The rspec book recommends setting up fixtures and environment for each example. Perhaps to drive this point home, support for

Re: [rspec-users] before(:all) to set up mocks and stubs

2010-07-13 Thread David Chelimsky
On Jul 13, 2010, at 7:25 AM, Ivo Dancet wrote: Hi I'm upgrading an application to rspec2/rails3. A certain suite of tests, that generates a pdf document, uses a before(:all) filter to set the environment using mocks and stubs. Then the pdf gets generated and after that all the tests run