Class: Micronaut::Runner
Class Method Summary collapse
Instance Method Summary collapse
- #configuration ⇒ Object
- #formatter ⇒ Object
- #require_all_behaviours(files_from_args = []) ⇒ Object
- #run(args = []) ⇒ Object
Class Method Details
.autorun ⇒ Object
9 10 11 12 13 |
# File 'lib/micronaut/runner.rb', line 9 def self.autorun return if installed_at_exit? @installed_at_exit = true at_exit { Micronaut::Runner.new.run(ARGV) ? exit(0) : exit(1) } end |
.installed_at_exit? ⇒ Boolean
5 6 7 |
# File 'lib/micronaut/runner.rb', line 5 def self.installed_at_exit? @installed_at_exit ||= false end |
Instance Method Details
#configuration ⇒ Object
15 16 17 |
# File 'lib/micronaut/runner.rb', line 15 def configuration Micronaut.configuration end |
#formatter ⇒ Object
19 20 21 |
# File 'lib/micronaut/runner.rb', line 19 def formatter Micronaut.configuration.formatter end |
#require_all_behaviours(files_from_args = []) ⇒ Object
23 24 25 |
# File 'lib/micronaut/runner.rb', line 23 def require_all_behaviours(files_from_args=[]) files_from_args.each { |file| require file } end |
#run(args = []) ⇒ Object
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 52 53 54 55 56 |
# File 'lib/micronaut/runner.rb', line 27 def run(args = []) require_all_behaviours(args) total_examples_to_run = Micronaut.world.total_examples_to_run old_sync, formatter.output.sync = formatter.output.sync, true if formatter.output.respond_to?(:sync=) suite_success = true formatter_supports_sync = formatter.output.respond_to?(:sync=) old_sync, formatter.output.sync = formatter.output.sync, true if formatter_supports_sync formatter.start(total_examples_to_run) # start the clock start = Time.now Micronaut.world.behaviours_to_run.each do |behaviour| suite_success &= behaviour.run(formatter) end formatter.start_dump(Time.now - start) formatter.dump_failures formatter.dump_summary formatter.dump_pending formatter.close formatter.output.sync = old_sync if formatter_supports_sync suite_success end |