Sha256: 64022b2c36b8347a6f180f83b2f2ce6a11cac15ae4832960021a51d577a5a7e0

Contents?: true

Size: 811 Bytes

Versions: 2

Compression:

Stored size: 811 Bytes

Contents

require 'rspec/core'
require 'rspec/core/formatters/base_text_formatter'
require 'rspec/print_failures_eagerly/version'

module RSpec
  module PrintFailuresEagerly
    class Formatter
      RSpec::Core::Formatters.register self, :example_failed

      def initialize(output)
        @output = output
        @last_failure_index = 0
      end

      def example_failed(notification)
        @output.puts
        @output.puts notification.fully_formatted(@last_failure_index += 1)
        @output.puts
      end
    end

    module SilenceDumpFailures
      def dump_failures(_notification)
      end

      RSpec::Core::Formatters::BaseTextFormatter.prepend(self)
    end
  end
end

RSpec.configure do |config|
  config.before(:suite) do
    config.add_formatter RSpec::PrintFailuresEagerly::Formatter
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-print_failures_eagerly-1.0.0 lib/rspec/print_failures_eagerly.rb
rspec-print_failures_eagerly-0.1.0 lib/rspec/print_failures_eagerly.rb