Class: TapFormatter
- Inherits:
-
RSpec::Core::Formatters::BaseFormatter
- Object
- RSpec::Core::Formatters::BaseFormatter
- TapFormatter
- Defined in:
- lib/rspec-extra-formatters/tap_formatter.rb
Constant Summary collapse
- OK =
'ok'
- NOT_OK =
'not ok'
- TODO =
'# TODO '
- SKIP =
'# SKIP '
Instance Attribute Summary collapse
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
- #example_failed(example) ⇒ Object
- #example_passed(example) ⇒ Object
- #example_pending(example) ⇒ Object
-
#initialize(output) ⇒ TapFormatter
constructor
A new instance of TapFormatter.
- #start(example_count) ⇒ Object
Constructor Details
#initialize(output) ⇒ TapFormatter
Returns a new instance of TapFormatter.
40 41 42 43 |
# File 'lib/rspec-extra-formatters/tap_formatter.rb', line 40 def initialize(output) super(output) @total = 0 end |
Instance Attribute Details
#total ⇒ Object (readonly)
Returns the value of attribute total.
33 34 35 |
# File 'lib/rspec-extra-formatters/tap_formatter.rb', line 33 def total @total end |
Instance Method Details
#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
72 73 74 |
# File 'lib/rspec-extra-formatters/tap_formatter.rb', line 72 def dump_summary(duration, example_count, failure_count, pending_count) super(duration, example_count, failure_count, pending_count) end |
#example_failed(example) ⇒ Object
62 63 64 65 66 67 68 69 70 |
# File 'lib/rspec-extra-formatters/tap_formatter.rb', line 62 def example_failed(example) super(example) tap_example_output(NOT_OK, example) output.puts(" ---") my_exception = example.exception.to_s my_exception.gsub! /"/, '' output.puts(" #{my_exception} ") output.puts(" ...") end |
#example_passed(example) ⇒ Object
52 53 54 55 |
# File 'lib/rspec-extra-formatters/tap_formatter.rb', line 52 def example_passed(example) super(example) tap_example_output(OK, example) end |
#example_pending(example) ⇒ Object
57 58 59 60 |
# File 'lib/rspec-extra-formatters/tap_formatter.rb', line 57 def example_pending(example) super(example) tap_example_output(NOT_OK, example, SKIP) end |
#start(example_count) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/rspec-extra-formatters/tap_formatter.rb', line 45 def start(example_count) super(example_count) output.puts("TAP version 13") output.puts("1.." + example_count.to_s) end |