# frozen_string_literal: true begin autodetected = DatabaseCleaner::Base.new.__send__(:autodetect) rescue DatabaseCleaner::NoORMDetected autodetected = false end return unless autodetected RSpec.configure do |config| config.before(:suite) do DatabaseCleaner.clean_with(:truncation, :except => %w{ar_internal_metadata}) end config.around(:each) do |example| DatabaseCleaner.strategy = if example.metadata[:js] || %i{mongoid}.include?(autodetected) [:truncation, :except => %w{ar_internal_metadata}] else :transaction end DatabaseCleaner.start example.run DatabaseCleaner.clean end end return unless defined?(RSpec::Rails) RSpec.configure do |config| config.use_transactional_fixtures = false end