Sha256: ff69c447a48c0c95fc5fe12635bc5411f3b16298620a3448c62e4609f8eb6c06

Contents?: true

Size: 1.04 KB

Versions: 12

Compression:

Stored size: 1.04 KB

Contents

require "database_cleaner"
require "support/migration_helpers"

RSpec.configure do |config|

  config.include MigrationHelpers, migration: true, data_migration: true

  config.before(:suite) do
    if defined?(::DB)
      DatabaseCleaner.strategy = :transaction
      PactBroker::Database.truncate
    end
  end

  config.before :each, migration: true do
    PactBroker::Database.drop_objects
  end

  config.after :each, migration: true do
    PactBroker::Database.migrate
    PactBroker::Database.truncate
  end

  config.after :each, data_migration: true do
    PactBroker::Database.truncate
  end

  config.after :all, data_migration: true do
    PactBroker::Database.migrate
    PactBroker::Database.truncate
  end

  config.before(:each) do | example |
    unless example.metadata[:no_db_clean] || example.metadata[:migration]
      DatabaseCleaner.start if defined?(::DB)
    end
  end

  config.after(:each) do | example |
    unless example.metadata[:no_db_clean] || example.metadata[:migration]
      DatabaseCleaner.clean if defined?(::DB)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pact_broker-2.89.1 spec/support/database_cleaner.rb
pact_broker-2.89.0 spec/support/database_cleaner.rb
pact_broker-2.88.0 spec/support/database_cleaner.rb
pact_broker-2.87.0 spec/support/database_cleaner.rb
pact_broker-2.86.0 spec/support/database_cleaner.rb
pact_broker-2.85.1 spec/support/database_cleaner.rb
pact_broker-2.85.0 spec/support/database_cleaner.rb
pact_broker-2.84.0 spec/support/database_cleaner.rb
pact_broker-2.83.0 spec/support/database_cleaner.rb
pact_broker-2.82.0 spec/support/database_cleaner.rb
pact_broker-2.81.0 spec/support/database_cleaner.rb
pact_broker-2.80.0 spec/support/database_cleaner.rb