Sha256: e8a8a8e7372e68c56a06d652f77b85b5c7b4d7d7fa568d9d49027f4f9cab987b
Contents?: true
Size: 979 Bytes
Versions: 21
Compression:
Stored size: 979 Bytes
Contents
require 'rspec/core/formatters/progress_formatter' module RSpec class Instafail < RSpec::Core::Formatters::ProgressFormatter 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 private 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 preserve_size(array) old = array.size yield array.pop if array.size > old end end end
Version data entries
21 entries across 16 versions & 3 rubygems