Sha256: 5ce6688d73e5011c88e341348f6a6fd1b188b1692efca7f7e07a81f0d11dd47b

Contents?: true

Size: 828 Bytes

Versions: 4

Compression:

Stored size: 828 Bytes

Contents

# frozen_string_literal: true

require 'cucumber/formatter/io'

module Cucumber
  module Formatter
    class Rerun
      include Formatter::Io

      def initialize(config)
        @io = ensure_io(config.out_stream)
        @config = config
        @failures = {}
        config.on_event :test_case_finished do |event|
          test_case, result = *event.attributes
          next if result.ok?(@config.strict)
          @failures[test_case.location.file] ||= []
          @failures[test_case.location.file] << test_case.location.line
        end
        config.on_event :test_run_finished do
          next if @failures.empty?
          @io.print file_failures.join("\n")
        end
      end

      private

      def file_failures
        @failures.map { |file, lines| [file, lines].join(':') }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
cucumber-3.2.0 lib/cucumber/formatter/rerun.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/cucumber-3.1.2/lib/cucumber/formatter/rerun.rb
cucumber-3.1.2 lib/cucumber/formatter/rerun.rb
cucumber-3.1.1 lib/cucumber/formatter/rerun.rb