Sha256: f3502ba03697fc1a514b561176f4785f5393b2c0793f50d2975e5bb6cdc70dd2

Contents?: true

Size: 828 Bytes

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
cucumber-3.0.0.pre.2 lib/cucumber/formatter/rerun.rb