Module: Minitest
- Defined in:
- lib/furnish/test/scheduler_runner.rb
Overview
Monkey Patches for Minitest for Furnish::Test
Class Attribute Summary collapse
-
.keep_scheduler ⇒ Object
If this is set, the scheduler will be kept running between test methods, so that it can be re-used.
Class Method Summary collapse
-
.__run(reporter, options) ⇒ Object
:nodoc:.
Class Attribute Details
.keep_scheduler ⇒ Object
If this is set, the scheduler will be kept running between test methods, so that it can be re-used. This can be used to save some time in situaitons where a long-running provision will be used in all methods in a suite.
12 13 14 |
# File 'lib/furnish/test/scheduler_runner.rb', line 12 def keep_scheduler @keep_scheduler end |
Class Method Details
.__run(reporter, options) ⇒ Object
:nodoc:
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/furnish/test/scheduler_runner.rb', line 16 def __run(reporter, ) # :nodoc: at_exit do if Furnish.initialized? $sched.force_deprovision = true #$sched.teardown #Furnish.shutdown FileUtils.rm_f('test.db') end end Minitest::Runnable.runnables.each do |suite| begin if keep_scheduler require 'fileutils' Furnish.init('test.db') unless Furnish.initialized? if ENV["FURNISH_DEBUG"] Furnish.logger = Furnish::Logger.new($stderr, 3) end $sched ||= Furnish::Scheduler.new $sched.run end if suite.respond_to?(:before_suite) suite.before_suite end suite.run(reporter, ) ensure if suite.respond_to?(:after_suite) suite.after_suite end end end end |