Module: AcidicJob::Testing

Included in:
TestCase
Defined in:
lib/acidic_job/testing.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



7
8
9
# File 'lib/acidic_job/testing.rb', line 7

def self.included(mod)
  mod.class_eval "self.use_transactional_tests = false if respond_to?(:use_transactional_tests)", __FILE__, __LINE__
end

Instance Method Details

#after_teardownObject



19
20
21
22
23
# File 'lib/acidic_job/testing.rb', line 19

def after_teardown
  ::DatabaseCleaner.clean
  super
  ::DatabaseCleaner.cleaners = @original_cleaners
end

#before_setupObject



11
12
13
14
15
16
17
# File 'lib/acidic_job/testing.rb', line 11

def before_setup
  @connection = ::ActiveRecord::Base.connection
  @original_cleaners = ::DatabaseCleaner.cleaners
  ::DatabaseCleaner.cleaners = transaction_free_cleaners_for(@original_cleaners)
  super
  ::DatabaseCleaner.start
end