Sha256: 41f2738351f897617d0f4b4c4ed4bf312406e97f8413b44a0e7a481613df7c86

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

module Micronaut

  class Runner
        
    def self.installed_at_exit?
      @installed_at_exit ||= false
    end

    def self.autorun
      at_exit { Micronaut::Runner.new.run(ARGV) ? exit(0) : exit(1) } unless installed_at_exit?
      @installed_at_exit = true
    end
    
    def options
      Micronaut.configuration.options
    end

    def run(args = [])
      @verbose = args.delete('-v')

       total_examples = Micronaut::World.behaviour_groups.inject(0) { |sum, eg| sum + eg.examples.size }
       
       old_sync, options.formatter.output.sync = options.formatter.output.sync, true if options.formatter.output.respond_to?(:sync=)
              
       options.formatter.start(total_examples)

       suite_success = true
      
       starts_at = Time.now
       Micronaut::World.behaviour_groups.each do |example_group|
         suite_success &= example_group.run(options.formatter)
       end
       duration = Time.now - starts_at
       
       options.formatter.start_dump
       options.formatter.dump_pending
       options.formatter.dump_failures
       options.formatter.dump_summary(duration, total_examples, options.formatter.failed_examples.size, options.formatter.pending_examples.size)
      
       options.formatter.output.sync = old_sync if options.formatter.output.respond_to? :sync=
       
       suite_success
    end
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spicycode-micronaut-0.1.1 lib/micronaut/runner.rb