Permalink
Browse files

Wrap :js examples and set DatabaseCleaner strategy to :truncation bef…

…ore the spec and back to :transaction afterward.
  • Loading branch information...
1 parent a14a949 commit efcc9357c6add13c26e46339ed3cd4ee2eddaf99 @parndt parndt committed Apr 5, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 core/spec/support/database_cleaner.rb
@@ -2,7 +2,7 @@
RSpec.configure do |config|
config.before(:suite) do
- DatabaseCleaner.strategy = (ENV['JS'] == 'false' ? :transaction : :truncation)
+ DatabaseCleaner.strategy = :transaction
end
config.before(:each) do
@@ -12,4 +12,10 @@
config.after(:each) do
DatabaseCleaner.clean
end
+
+ config.around(:each, :js) do |example|
+ DatabaseCleaner.strategy = :truncation
+ example.call
+ DatabaseCleaner.strategy = :transaction
+ end
end

0 comments on commit efcc935

Please sign in to comment.