Sha256: c478dc44d74cf7763688a7fbc65ab77585655c79ca4ce702e89f34b0b28d0b30

Contents?: true

Size: 879 Bytes

Versions: 7

Compression:

Stored size: 879 Bytes

Contents

RSpec.configure do |config|
  # Capybara javascript drivers require transactional fixtures set to false, and we use DatabaseCleaner
  # to cleanup after each test instead.  Without transactional fixtures set to false the records created
  # to setup a test will be unavailable to the browser, which runs under a separate server instance.
  config.use_transactional_fixtures = false

  config.before(:suite) do
    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.clean_with(:truncation)
  end

  # Before each spec check if it is a Javascript test and switch between using database transactions or not where necessary.
  config.before(:each) do
    DatabaseCleaner.strategy = RSpec.current_example.metadata[:js] ? :truncation : :transaction
  end

  config.before(:each) do
    DatabaseCleaner.start
  end

  config.after(:each) do
    DatabaseCleaner.clean
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
solidus_pagseguro_oficial-1.1.2 spec/support/database_cleaner.rb
solidus_br_common-1.1.3 spec/support/database_cleaner.rb
solidus_pagseguro_oficial-1.1.1 spec/support/database_cleaner.rb
solidus_pagseguro_oficial-1.1.0 spec/support/database_cleaner.rb
solidus_br_common-1.1.2 spec/support/database_cleaner.rb
solidus_br_common-1.1.1 spec/support/database_cleaner.rb
solidus_br_common-1.1.0 spec/support/database_cleaner.rb