Class: RspecFlatErrorFormatter
- Inherits:
-
RSpec::Core::Formatters::BaseTextFormatter
- Object
- RSpec::Core::Formatters::BaseTextFormatter
- RspecFlatErrorFormatter
- Defined in:
- lib/rspec_flat_error_formatter.rb
Constant Summary collapse
- TOKEN_SEPARATOR =
': '.freeze
Instance Method Summary collapse
- #dump_failures(notification) ⇒ Object
- #dump_pending(notification) ⇒ Object
- #dump_summary(_notification) ⇒ Object
- #example_failed(_notification) ⇒ Object
- #example_passed(_notification) ⇒ Object
- #example_pending(_notification) ⇒ Object
- #start(notification) ⇒ Object
- #start_dump(_notification) ⇒ Object
Instance Method Details
#dump_failures(notification) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/rspec_flat_error_formatter.rb', line 46 def dump_failures(notification) return if notification.failure_notifications.empty? formatted = "\nFailures:\n\n" notification.failure_notifications.each do |failure| formatted += "#{(failure)}\n" end output.puts formatted end |
#dump_pending(notification) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rspec_flat_error_formatter.rb', line 34 def dump_pending(notification) return if notification.pending_notifications.empty? formatted = "\nPending: (Failures listed here are expected and do not affect your suite's status)\n\n" notification.pending_notifications.each do |pending| formatted += "#{(pending.example)}\n" end output.puts formatted end |
#dump_summary(_notification) ⇒ Object
58 59 60 61 |
# File 'lib/rspec_flat_error_formatter.rb', line 58 def dump_summary(_notification) # TODO: Finished in 0.34138 seconds (files took 0.26296 seconds to load) (copy from BaseFormatter) # TODO: 1 example, 0 failures (copy from BaseFormatter) end |
#example_failed(_notification) ⇒ Object
26 27 28 |
# File 'lib/rspec_flat_error_formatter.rb', line 26 def example_failed(_notification) output.print colorizer.wrap('F', :failure) end |
#example_passed(_notification) ⇒ Object
18 19 20 |
# File 'lib/rspec_flat_error_formatter.rb', line 18 def example_passed(_notification) output.print colorizer.wrap('.', :success) end |
#example_pending(_notification) ⇒ Object
22 23 24 |
# File 'lib/rspec_flat_error_formatter.rb', line 22 def example_pending(_notification) output.print colorizer.wrap('*', :pending) end |
#start(notification) ⇒ Object
13 14 15 16 |
# File 'lib/rspec_flat_error_formatter.rb', line 13 def start(notification) output.puts pluralize(notification.count, 'example') output.puts end |
#start_dump(_notification) ⇒ Object
30 31 32 |
# File 'lib/rspec_flat_error_formatter.rb', line 30 def start_dump(_notification) output.puts end |