Sha256: ce97025d04c2fa4aa32788209b99afe9334f6f8a302ae33ef8f62de07f8bb41e

Contents?: true

Size: 1.5 KB

Versions: 70

Compression:

Stored size: 1.5 KB

Contents

require 'spec/runner/formatter/progress_bar_formatter'

module Fivemat
  class Spec < ::Spec::Runner::Formatter::ProgressBarFormatter
    include ElapsedTime

    def initialize(*)
      super
      @dumping = false
      @example_group_number = 0
      @failed_examples = []
      @failure_index_offset = 1
      @last_nested_descriptions = []
      @last_root_example_group = nil
    end

    def example_group_started(example_group_proxy)
      super
      @example_group_number += 1

      unless example_group_proxy.nested_descriptions.first == @last_nested_descriptions.first
        @last_root_example_group = example_group_proxy
        example_group_finished(example_group_proxy) unless @example_group_number == 1
        output.print "#{example_group_proxy.nested_descriptions.first} "
        @start_time = Time.now
      end

      @last_nested_descriptions = example_group_proxy.nested_descriptions
    end

    def example_group_finished(example_group_proxy)
      print_elapsed_time output, @start_time
      puts

      @failed_examples.each_with_index do |example, index|
        dump_failure(@failure_index_offset + index, example)
      end

      @failure_index_offset += @failed_examples.size
      @failed_examples.clear
    end

    def example_failed(example, counter, failure)
      super
      @failed_examples << failure
    end

    def start_dump
      example_group_finished(@last_root_example_group)
      @dumping = true
    end

    def dump_failure(*)
      super unless @dumping
    end
  end
end

Version data entries

70 entries across 67 versions & 15 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/fivemat-1.3.7/lib/fivemat/spec.rb