John Feminella
2010-Sep-21 13:45 UTC
[rspec-users] Conditional before() blocks in spec_helper based on metadata?
I have some tests that need to load my application''s seed data prior to running, and others that don''t. It''s a well-defined set of examples: describe "needs seed data", :needs_data => true do ... end What can I put in my Rspec.configure { ... } block so that every test which has ":needs_data => true" will invoke a particular before(:each) { ... } block? Note that I still want every test to run; I just want the :needs_data tests to get some special setup first. ~ jf
Lailson Bandeira
2010-Sep-22 01:02 UTC
[rspec-users] Conditional before() blocks in spec_helper based on metadata?
Look at this example for javascript pages: http://gist.github.com/518636. I think you can do something like that. -- LAILSON BANDEIRA http://lailsonbandeira.com/ On Tue, Sep 21, 2010 at 10:45 AM, John Feminella <johnf at distb.net> wrote:> I have some tests that need to load my application''s seed data prior > to running, and others that don''t. It''s a well-defined set of > examples: > > describe "needs seed data", :needs_data => true do > ... > end > > What can I put in my Rspec.configure { ... } block so that every test > which has ":needs_data => true" will invoke a particular before(:each) > { ... } block? Note that I still want every test to run; I just want > the :needs_data tests to get some special setup first. > > ~ jf > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100921/3befc7a8/attachment.html>