Skip to content
Browse files

Only use databasecleaner if there is a database

  • Loading branch information...
1 parent fd904ba commit 5ddc79df90f3a35edc1d268dee9806c48ec1fbaf @6 committed Mar 16, 2013
Showing with 11 additions and 9 deletions.
  1. +11 −9 spec/spec_helper.rb
View
20 spec/spec_helper.rb
@@ -18,17 +18,19 @@
config.filter_run :focus
config.include Rack::Test::Methods
- # Via Rspec example: https://github.com/bmabey/database_cleaner
- config.before(:suite) do
- DatabaseCleaner.strategy = :transaction
- end
+ if ENV['DATABASE_URL']
+ # Via Rspec example: https://github.com/bmabey/database_cleaner
+ config.before(:suite) do
+ DatabaseCleaner.strategy = :transaction
+ end
- config.before(:each) do
- DatabaseCleaner.start
- end
+ config.before(:each) do
+ DatabaseCleaner.start
+ end
- config.after(:each) do
- DatabaseCleaner.clean
+ config.after(:each) do
+ DatabaseCleaner.clean
+ end
end
end

0 comments on commit 5ddc79d

Please sign in to comment.
Something went wrong with that request. Please try again.