Module: TestProf::BeforeAll::Minitest::ClassMethods
- Defined in:
- lib/test_prof/recipes/minitest/before_all.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #after_all(&block) ⇒ Object
- #before_all(setup_fixtures: BeforeAll.config.setup_fixtures, &block) ⇒ Object
Instance Attribute Details
#before_all_executor ⇒ Object
140 141 142 143 144 145 146 |
# File 'lib/test_prof/recipes/minitest/before_all.rb', line 140 def before_all_executor return @before_all_executor if instance_variable_defined?(:@before_all_executor) @before_all_executor = if superclass.respond_to?(:before_all_executor) superclass.before_all_executor end end |
Instance Method Details
#after_all(&block) ⇒ Object
174 175 176 177 |
# File 'lib/test_prof/recipes/minitest/before_all.rb', line 174 def after_all(&block) self.before_all_executor = Executor.new(parent: before_all_executor) before_all_executor.teardown(&block) end |
#before_all(setup_fixtures: BeforeAll.config.setup_fixtures, &block) ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/test_prof/recipes/minitest/before_all.rb', line 148 def before_all(setup_fixtures: BeforeAll.config.setup_fixtures, &block) self.before_all_executor = Executor.new( setup_fixtures: setup_fixtures, parent: before_all_executor, &block ) # Do not add patches multiple times return if before_all_executor.parent 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! unless parallelized end end) end |