class TestProf::BeforeAll::Configuration

Constants

HOOKS

Attributes

hooks[R]
setup_fixtures[RW]

Public Class Methods

new() click to toggle source
# File lib/test_prof/before_all.rb, line 71
def initialize
  @hooks = Hash.new { |h, k| h[k] = HooksChain.new(k) }
  @setup_fixtures = false
end

Public Instance Methods

after(type, &block) click to toggle source

Add `after` hook for `begin` or `rollback` operation:

config.after(:begin) { ... }
# File lib/test_prof/before_all.rb, line 89
def after(type, &block)
  validate_hook_type!(type)
  hooks[type].after << block if block
end
before(type, &block) click to toggle source

Add `before` hook for `begin` or `rollback` operation:

config.before(:rollback) { ... }
# File lib/test_prof/before_all.rb, line 80
def before(type, &block)
  validate_hook_type!(type)
  hooks[type].before << block if block
end

Private Instance Methods

validate_hook_type!(type) click to toggle source
# File lib/test_prof/before_all.rb, line 101
def validate_hook_type!(type)
  return if HOOKS.include?(type)

  raise ArgumentError, "Unknown hook type: #{type}. Valid types: #{HOOKS.join(", ")}"
end