Sha256: 0a9975f44ee5815ceb84fdb4f5b00cbfe352cf88d0e5bd5c9d5aa6372bb752b7
Contents?: true
Size: 1.6 KB
Versions: 2
Compression:
Stored size: 1.6 KB
Contents
require 'rspec/core/formatters/base_text_formatter' # Code is based on standard SpecdocFormatter, but will print full error details as soon as they are found. # Successful or pending examples are written only as a dot in the output. Header is only printed if errors occur. # # To use it, add the following to your spec/spec.opts: # --require # lib/rspec_immediate_feedback_formatter.rb # --format # RSpec::Core::Runner::Formatter::ImmediateFeedbackFormatter module RSpec module Core module Formatters class ImmediateFeedbackFormatter < BaseTextFormatter def add_example_group(example_group) super @current_group = example_group.description end def example_failed(example, counter, failure) if @current_group output.puts output.puts @current_group @current_group = nil # only print the group name once end message = if failure.expectation_not_met? "- #{example.description} (FAILED - #{counter})" else "- #{example.description} (ERROR - #{counter})" end output.puts(red(message)) # output.puts(failure.expectation_not_met? ? red(message) : message) dump_failure(counter, failure) # dump stacktrace immediately output.flush end def example_passed(*) output.print green('.') output.flush end def example_pending(*) super output.print yellow('*') output.flush end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sbf-dm-core-1.3.0 | spec/lib/rspec_immediate_feedback_formatter.rb |
sbf-dm-core-1.3.0.beta | spec/lib/rspec_immediate_feedback_formatter.rb |