From 7b8f26bfe5a550b47af0f84091257e22cd7eb7b4 Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Wed, 23 Nov 2011 13:19:08 +1100 Subject: [PATCH] only use truncation database cleaner strat if in a javascript test --- core/spec/spec_helper.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/spec/spec_helper.rb b/core/spec/spec_helper.rb index fb13582f1a8..6df2c0a9de7 100644 --- a/core/spec/spec_helper.rb +++ b/core/spec/spec_helper.rb @@ -36,8 +36,12 @@ # instead of true. config.use_transactional_fixtures = false - config.before(:suite) do - DatabaseCleaner.strategy = :truncation, { :except => ['spree_countries', 'spree_zone_members', 'spree_states', 'spree_roles'] } + config.before(:each) do + if example.metadata[:js] + DatabaseCleaner.strategy = :truncation, { :except => ['spree_countries', 'spree_zone_members', 'spree_states', 'spree_roles'] } + else + DatabaseCleaner.strategy = :transaction + end end config.before(:each) do