Sha256: 9d6867780a94b0b9c921588a6d8d6f8c11da522c85117ac203f96a66bacfe8aa

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 KB

Contents

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

5 entries across 5 versions & 1 rubygems

Version Path
test-queue-0.4.2 lib/test_queue/runner/rspec3.rb
test-queue-0.4.1 lib/test_queue/runner/rspec3.rb
test-queue-0.4.0 lib/test_queue/runner/rspec3.rb
test-queue-0.3.1 lib/test_queue/runner/rspec3.rb
test-queue-0.3.0 lib/test_queue/runner/rspec3.rb