spec/rails_helper.rb in pulitzer-0.11.3 vs spec/rails_helper.rb in pulitzer-0.12.0

- old
+ new

@@ -2,31 +2,28 @@ require 'spec_helper' require File.expand_path("../dummy/config/environment", __FILE__) require 'rspec/rails' require 'shoulda-matchers' require 'factory_girl_rails' -require 'database_cleaner' ActiveRecord::Migration.maintain_test_schema! RSpec.configure do |config| config.include FactoryGirl::Syntax::Methods - config.use_transactional_fixtures = false + config.use_transactional_fixtures = true config.infer_spec_type_from_file_location! config.include(Shoulda::Matchers::ActiveModel, type: :model) config.include(Shoulda::Matchers::ActiveRecord, type: :model) config.before(:suite) do - DatabaseCleaner.strategy = :transaction - DatabaseCleaner.clean_with(:truncation) - end - - config.before(:each) do |example| - DatabaseCleaner.start - end - - config.after(:each) do |example| - DatabaseCleaner.clean + ActiveRecord::Base.connection.tables.each do |name| + begin + ActiveRecord::Base.connection.execute("TRUNCATE TABLE #{name};") + rescue ActiveRecord::StatementInvalid + ActiveRecord::Base.connection.execute("delete from #{name};") + end + end + Rails.application.load_seed end end