Class: DeepTest::Spec::Runner
- Inherits:
-
Spec::Runner::ExampleGroupRunner
- Object
- Spec::Runner::ExampleGroupRunner
- DeepTest::Spec::Runner
- Defined in:
- lib/deep_test/spec/runner.rb
Instance Method Summary collapse
- #central_command ⇒ Object
-
#initialize(options, deep_test_options) ⇒ Runner
constructor
A new instance of Runner.
- #load_files(files) ⇒ Object
- #main ⇒ Object
- #process_work_units(central_command) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(options, deep_test_options) ⇒ Runner
Returns a new instance of Runner.
4 5 6 7 8 9 10 11 12 |
# File 'lib/deep_test/spec/runner.rb', line 4 def initialize(, ) super() if ::Spec::VERSION::MAJOR == 1 && ::Spec::VERSION::MINOR == 1 && ::Spec::VERSION::TINY >= 12 @runner_options = # added to make work with 1.1.12 end @deep_test_options = DeepTest::Options.from_command_line() end |
Instance Method Details
#central_command ⇒ Object
18 19 20 21 22 23 |
# File 'lib/deep_test/spec/runner.rb', line 18 def central_command # Can't create central_command as default argument to initialize # because Main hasn't been invoked at # instantiation time @central_command ||= main.central_command end |
#load_files(files) ⇒ Object
25 26 27 |
# File 'lib/deep_test/spec/runner.rb', line 25 def load_files(files) main.load_files files end |
#main ⇒ Object
14 15 16 |
# File 'lib/deep_test/spec/runner.rb', line 14 def main @main ||= Main.new @deep_test_options, @deep_test_options.new_deployment, self end |
#process_work_units(central_command) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/deep_test/spec/runner.rb', line 33 def process_work_units(central_command) prepare examples = (example_groups.map do |g| if ::Spec::VERSION::MAJOR == 1 && ::Spec::VERSION::MINOR == 1 && ::Spec::VERSION::TINY >= 12 g.send(:examples_to_run, @runner_options) # added @runner_options to make wiork with 1.1.12 else g.send(:examples_to_run) end end).flatten examples_by_location = {} examples.each do |example| raise "duplicate example: #{example.identifier}" if examples_by_location[example.identifier] examples_by_location[example.identifier] = example central_command.write_work Spec::WorkUnit.new(example.identifier) end success = true missing_examples = ResultReader.new(central_command).read(examples_by_location) do |example, result| @options.reporter.example_finished(example, result.error) success &= result.success? end success &= missing_examples.empty? if missing_examples.any? @options.reporter.example_finished(examples_by_location[missing_examples.keys.first], IncompleteTestRunError.new(missing_examples.size)) end success ensure finish end |
#run ⇒ Object
29 30 31 |
# File 'lib/deep_test/spec/runner.rb', line 29 def run main.run end |