Module: TestProf::BeforeAll

Defined in:
lib/test_prof/before_all.rb,
lib/test_prof/before_all/isolator.rb,
lib/test_prof/recipes/rspec/before_all.rb,
lib/test_prof/recipes/minitest/before_all.rb,
lib/test_prof/before_all/adapters/active_record.rb

Overview

‘before_all` helper configuration

Defined Under Namespace

Modules: Adapters, Isolator, Minitest, RSpec Classes: AdapterMissing, Configuration, HooksChain

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.adapterObject

Returns the value of attribute adapter.



16
17
18
# File 'lib/test_prof/before_all.rb', line 16

def adapter
  @adapter
end

Class Method Details

.begin_transactionObject

Raises:



18
19
20
21
22
23
24
25
# File 'lib/test_prof/before_all.rb', line 18

def begin_transaction
  raise AdapterMissing if adapter.nil?

  config.run_hooks(:begin) do
    adapter.begin_transaction
  end
  yield
end

.configObject



41
42
43
# File 'lib/test_prof/before_all.rb', line 41

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



45
46
47
# File 'lib/test_prof/before_all.rb', line 45

def configure
  yield config
end

.rollback_transactionObject

Raises:



27
28
29
30
31
32
33
# File 'lib/test_prof/before_all.rb', line 27

def rollback_transaction
  raise AdapterMissing if adapter.nil?

  config.run_hooks(:rollback) do
    adapter.rollback_transaction
  end
end

.setup_fixtures(test_object) ⇒ Object

Raises:

  • (ArgumentError)


35
36
37
38
39
# File 'lib/test_prof/before_all.rb', line 35

def setup_fixtures(test_object)
  raise ArgumentError, "Current adapter doesn't support #setup_fixtures" unless adapter.respond_to?(:setup_fixtures)

  adapter.setup_fixtures(test_object)
end