Sha256: 0f37c79c5e5aa732b074f2094340c4144a8ea1f49cd51754a2a3da6058cd3042

Contents?: true

Size: 827 Bytes

Versions: 2

Compression:

Stored size: 827 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

2 entries across 2 versions & 1 rubygems

Version Path
cucumber-3.1.0 lib/cucumber/formatter/rerun.rb
cucumber-3.0.2 lib/cucumber/formatter/rerun.rb