Module: TestProf::BeforeAll::Minitest::ClassMethods

Defined in:
lib/test_prof/recipes/minitest/before_all.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#before_all_executorObject

Returns the value of attribute before_all_executor.



76
77
78
# File 'lib/test_prof/recipes/minitest/before_all.rb', line 76

def before_all_executor
  @before_all_executor
end

Instance Method Details

#after_all(&block) ⇒ Object



97
98
99
100
# File 'lib/test_prof/recipes/minitest/before_all.rb', line 97

def after_all(&block)
  self.before_all_executor ||= Executor.new
  before_all_executor.teardown(&block)
end

#before_all(setup_fixtures: BeforeAll.config.setup_fixtures, &block) ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/test_prof/recipes/minitest/before_all.rb', line 78

def before_all(setup_fixtures: BeforeAll.config.setup_fixtures, &block)
  self.before_all_executor = Executor.new(setup_fixtures: setup_fixtures, &block)

  prepend(Module.new do
    def before_setup
      self.class.before_all_executor.activate!(self)
      super
    end
  end)

  singleton_class.prepend(Module.new do
    def run(*)
      super
    ensure
      before_all_executor&.deactivate!
    end
  end)
end