class RSpec::Instafail

def _dump_pending_example(example, index)

def _dump_pending_example(example, index)
  if defined? pending_fixed? # > 2.8
    if pending_fixed?(example)
      dump_pending_fixed(example, index)
    else
      preserve_size(example.example_group.ancestors) do
        dump_failure(example, index)
      end
    end
  else
    dump_pending_example_fixed(example, index) || dump_failure(example, index)
  end
end

def example_failed(example, counter, failure)

def example_failed(example, counter, failure)
  dump_failure(counter, failure)
end

def example_failed(example)

def example_failed(example)
  # do what BaseFormatter#example_failed would do
  @failed_examples << example
  # do what BaseTextFormatter#dump_failures would do
  index = failed_examples.size - 1
  _dump_pending_example(example, index)
  dump_backtrace(example)
end

def example_failed(failure)

def example_failed(failure)
  @failed_examples << failure.example
  output.puts failure.fully_formatted(@failed_examples.size)
end

def initialize(output)

def initialize(output)
  super
  @failed_examples = []
end

def preserve_size(array)

def preserve_size(array)
  old = array.size
  yield
  array.pop if array.size > old
end