Sha256: 5565fa85b058d56a225652c44cbd63dad139fd5dfc0923e459aaad04887a416d

Contents?: true

Size: 854 Bytes

Versions: 2

Compression:

Stored size: 854 Bytes

Contents

# frozen_string_literal: true

RSpec.configure do |config|
  config.before(:suite) do
    config.rspeckled_logger.debug("Before Suite - Start - #{__FILE__}")

    ::DatabaseCleaner.clean_with(:truncation, except: %w{ar_internal_metadata})

    config.rspeckled_logger.debug("Before Suite - End   - #{__FILE__}")
  end

  config.around(:each) do |example|
    config.rspeckled_logger.debug("Around Each  - Start - #{__FILE__}")

    ::DatabaseCleaner.strategy = if example.metadata[:js]
                                   [:truncation, { except: %w{ar_internal_metadata} }]
                                 else
                                   :transaction
                                 end

    ::DatabaseCleaner.start

    example.run

    ::DatabaseCleaner.clean

    config.rspeckled_logger.debug("Around Each  - End   - #{__FILE__}")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspeckled-2.1.1 lib/rspeckled/plugins/hooks/database_cleaner.rb
rspeckled-2.1.0 lib/rspeckled/plugins/hooks/database_cleaner.rb