Sha256: b0e7b12361325ffe3e6c6ee2261071d8f5ac26b1f32f324733f60eb44a231a1d

Contents?: true

Size: 1.09 KB

Versions: 32

Compression:

Stored size: 1.09 KB

Contents

require 'cucumber/formatter/progress'

module Fivemat
  class Cucumber3 < ::Cucumber::Formatter::Progress
    include ElapsedTime

    def on_test_case_started(event)
      super
      feature = event.test_case.feature

      unless same_feature_as_previous_test_case?(feature)
        after_feature unless @current_feature.nil?
        before_feature(feature)
      end
    end

    def on_test_run_finished(_event)
      after_feature
      after_suite
    end

    private

    def before_feature(feature)
      @io.print "#{feature} "
      @io.flush
      @current_feature = feature
      @start_time = Time.now
    end

    def after_feature
      print_elapsed_time @io, @start_time
      @io.puts
      @io.flush

      print_elements(@pending_step_matches, :pending, 'steps')
      print_elements(@failed_results, :failed, 'steps')

      @pending_step_matches = []
      @failed_results = []
    end

    def after_suite
      @io.puts
      print_summary
    end

    def same_feature_as_previous_test_case?(feature)
      @current_feature && @current_feature.location == feature.location
    end
  end
end

Version data entries

32 entries across 32 versions & 4 rubygems

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