Module: Minitest::Queue
- Defined in:
- lib/minitest/queue.rb
Constant Summary collapse
- SuiteNotFound =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#queue ⇒ Object
Returns the value of attribute queue.
Instance Method Summary collapse
- #__run(*args) ⇒ Object
- #loaded_tests ⇒ Object
- #queue_reporters=(reporters) ⇒ Object
- #run_from_queue(reporter) ⇒ Object
Instance Attribute Details
#queue ⇒ Object
Returns the value of attribute queue.
48 49 50 |
# File 'lib/minitest/queue.rb', line 48 def queue @queue end |
Instance Method Details
#__run(*args) ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/minitest/queue.rb', line 75 def __run(*args) if queue run_from_queue(*args) else super end end |
#loaded_tests ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/minitest/queue.rb', line 67 def loaded_tests MiniTest::Test.runnables.flat_map do |suite| suite.runnable_methods.map do |method| "#{suite}##{method}" end end end |
#queue_reporters=(reporters) ⇒ Object
59 60 61 62 63 |
# File 'lib/minitest/queue.rb', line 59 def queue_reporters=(reporters) @queue_reporters ||= [] Reporters.reporters = ((Reporters.reporters || []) - @queue_reporters) + reporters @queue_reporters = reporters end |
#run_from_queue(reporter) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/minitest/queue.rb', line 83 def run_from_queue(reporter, *) runnable_classes = Minitest::Runnable.runnables.map { |s| [s.name, s] }.to_h queue.poll do |test_name| class_name, method_name = test_name.split("#".freeze, 2) if klass = runnable_classes[class_name] result = Minitest.run_one_method(klass, method_name) unless queue.acknowledge(test_name, result.passed? || result.skipped?) result.requeue! end reporter.record(result) else raise SuiteNotFound, "Couldn't find suite matching: #{test_name}" end end end |