diff options
| author | mo khan <mo@mokhan.ca> | 2013-07-19 11:42:50 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2013-07-19 11:42:50 -0600 |
| commit | e2566358593796c40e2ae495549e063da4030728 (patch) | |
| tree | bae534f60a29e0f2a1671d9de07e16d39890a331 /spec | |
| parent | 577cafd8d206a01054c4d0198aeb506fea10beb3 (diff) | |
install database_cleaner
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/spec_helper.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f5032ad..175c31b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,6 +5,7 @@ require 'rspec/rails' require 'rspec/autorun' require 'capybara/rails' require 'capybara/rspec' +require 'database_cleaner' # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. @@ -29,7 +30,7 @@ RSpec.configure do |config| # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false # instead of true. - config.use_transactional_fixtures = true + config.use_transactional_fixtures = false # If true, the base class of anonymous controllers will be inferred # automatically. This will be the default behavior in future versions of @@ -41,4 +42,16 @@ RSpec.configure do |config| # the seed, which is printed after each run. # --seed 1234 config.order = "random" + config.before(:suite) do + DatabaseCleaner.strategy = :transaction + DatabaseCleaner.clean_with(:truncation) + end + + config.before(:each) do + DatabaseCleaner.start + end + + config.after(:each) do + DatabaseCleaner.clean + end end |
