Module: Sidekiq::TransactionGuard::DatabaseCleaner

Defined in:
lib/sidekiq/transaction_guard/database_cleaner.rb

Instance Method Summary collapse

Instance Method Details

#cleaning { ... } ⇒ Object

Wrap the ‘Sidekiq::TransactionGuard.testing` method which sets up the data structures needed for custom counting of the transaction level within a test block.

Yields:

  • the cleaning block to execute

Returns:

  • (Object)

    the return value of the block



25
26
27
# File 'lib/sidekiq/transaction_guard/database_cleaner.rb', line 25

def cleaning(&block)
  Sidekiq::TransactionGuard.testing { super(&block) }
end

#startObject

Override the start method to set the base number of allowed transactions to the current level. Anything above this number will then be considered to be in a transaction.

Returns:

  • (Object)

    the return value from the superclass’s start method



14
15
16
17
18
# File 'lib/sidekiq/transaction_guard/database_cleaner.rb', line 14

def start
  retval = super
  Sidekiq::TransactionGuard.set_allowed_transaction_level(connection_class)
  retval
end