Sha256: 04123b812dddf1c6baeb6d8b3dbc52dfec1fc287473d4269a223767392fefd87

Contents?: true

Size: 1.4 KB

Versions: 6

Compression:

Stored size: 1.4 KB

Contents

class ::RSpec::Core::ExampleGroup
  def self.failure_count
    examples.map {|e| e.execution_result.status == "failed"}.length
  end
end

module RSpec::Core
  # RSpec 3.2 introduced:
  unless Configuration.method_defined?(:with_suite_hooks)
    class Configuration
      def with_suite_hooks
        begin
          hook_context = SuiteHookContext.new
          hooks.run(:before, :suite, hook_context)
          yield
        ensure
          hooks.run(:after, :suite, hook_context)
        end
      end
    end
  end

  class QueueRunner < Runner
    def initialize
      options = ConfigurationOptions.new(ARGV)
      super(options)
    end

    def run_specs(iterator)
      @configuration.reporter.report(0) do |reporter|
        @configuration.with_suite_hooks do
          iterator.map { |g|
            start = Time.now
            if g.is_a? ::RSpec::Core::Example
              print "    #{g.full_description}: "
              example = g
              g = example.example_group
              ::RSpec.world.filtered_examples.clear
              ::RSpec.world.filtered_examples[g] = [example]
            else
              print "    #{g.description}: "
            end
            ret = g.run(reporter)
            diff = Time.now-start
            puts("  <%.3f>" % diff)

            ret
          }.all? ? 0 : @configuration.failure_exit_code
        end
      end
    end
    alias_method :run_each, :run_specs
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
test-queue-0.7.0 lib/test_queue/runner/rspec3.rb
test-queue-0.6.0 lib/test_queue/runner/rspec3.rb
test-queue-0.5.0 lib/test_queue/runner/rspec3.rb
test-queue-patched-0.4.5 lib/test_queue/runner/rspec3.rb
test-queue-patched-0.4.4 lib/test_queue/runner/rspec3.rb
test-queue-patched-0.4.3 lib/test_queue/runner/rspec3.rb