Class: TapFormatter
- Inherits:
-
RSpec::Core::Formatters::BaseFormatter
- Object
- RSpec::Core::Formatters::BaseFormatter
- TapFormatter
- Defined in:
- lib/rspec-extra-formatters/tap_formatter.rb
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.
Constructor Details
#initialize(output) ⇒ TapFormatter
Returns a new instance of TapFormatter.
35 36 37 38 |
# File 'lib/rspec-extra-formatters/tap_formatter.rb', line 35 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
56 57 58 59 60 61 |
# File 'lib/rspec-extra-formatters/tap_formatter.rb', line 56 def dump_summary(duration, example_count, failure_count, pending_count) super(duration, example_count, failure_count, pending_count) if (@total > 0) output.puts("1..#{example_count}") end end |
#example_failed(example) ⇒ Object
50 51 52 53 54 |
# File 'lib/rspec-extra-formatters/tap_formatter.rb', line 50 def example_failed(example) super(example) @total += 1 output.puts("not ok #{@total} - #{example.[:full_description]}") end |
#example_passed(example) ⇒ Object
40 41 42 43 44 |
# File 'lib/rspec-extra-formatters/tap_formatter.rb', line 40 def example_passed(example) super(example) @total += 1 output.puts("ok #{@total} - #{example.[:full_description]}") end |
#example_pending(example) ⇒ Object
46 47 48 |
# File 'lib/rspec-extra-formatters/tap_formatter.rb', line 46 def example_pending(example) self.example_failed(example) end |