Sha256: 824c086f35aa92efa833ee9780f9d30429c55d246101493ff7e5b239d1467804

Contents?: true

Size: 866 Bytes

Versions: 14

Compression:

Stored size: 866 Bytes

Contents

# 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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rspeckled-1.0.3 lib/rspeckled/plugins/database_cleaner.rb
rspeckled-1.0.2 lib/rspeckled/plugins/database_cleaner.rb
rspeckled-1.0.1 lib/rspeckled/plugins/database_cleaner.rb
rspeckled-1.0.0 lib/rspeckled/plugins/database_cleaner.rb
rspeckled-0.0.64 lib/rspeckled/plugins/database_cleaner.rb
rspeckled-0.0.63 lib/rspeckled/plugins/database_cleaner.rb
rspeckled-0.0.62 lib/rspeckled/plugins/database_cleaner.rb
rspeckled-0.0.61 lib/rspeckled/plugins/database_cleaner.rb
rspeckled-0.0.60 lib/rspeckled/plugins/database_cleaner.rb
rspeckled-0.0.59 lib/rspeckled/plugins/database_cleaner.rb
rspeckled-0.0.58 lib/rspeckled/plugins/database_cleaner.rb
rspeckled-0.0.57 lib/rspeckled/plugins/database_cleaner.rb
rspeckled-0.0.56 lib/rspeckled/plugins/database_cleaner.rb
rspeckled-0.0.55 lib/rspeckled/plugins/database_cleaner.rb