JDeville
2011-Nov-10 17:10 UTC
[rspec-users] Is it possible to execute ''lets'' once for all ''its''?
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? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20111110/1aa819ee/attachment.html>
Cynthia Kiser
2011-Nov-14 20:47 UTC
[rspec-users] Is it possible to execute ''lets'' once for all ''its''?
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