[rspec-users] Is it possible to execute 'lets' once for all 'its'?

Cynthia Kiser cnk at ugcs.caltech.edu
Mon Nov 14 15:47:21 EST 2011


Quoting JDeville <jeffdeville at gmail.com>:
> The setup for certain integration specs is a bit slow, and I'm generally 
> careful to make my 'it' blocks read-only.  However, I also like to keep my 
> it blocks extremely focused on just 1 thing.  This has become a performance 
> problem though, because the setup is executed for every 'it'.  Is there any 
> way to just run the setup once, and then the actual tests?

Just as there is a before(:each), there is a before(:all) which sounds
like what you are looking for. RSpec 2 docs for this are at
https://www.relishapp.com/rspec/rspec-core/v/2-0/docs/hooks/before-and-after-hooks


-- 
Cynthia N. Kiser
cnk at ugcs.caltech.edu


More information about the rspec-users mailing list