-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
require "rspec/core/formatters/base_formatter" | ||
|
||
class TapFormatter < RSpec::Core::Formatters::BaseFormatter | ||
RSpec::Core::Formatters.register self, :example_passed, :example_failed, :example_pending | ||
|
||
attr_reader :total | ||
$VERBOSE = nil | ||
|
@@ -42,37 +43,28 @@ def initialize(output) | |
@total = 0 | ||
end | ||
|
||
def start(example_count) | ||
super(example_count) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mrerrormessage
|
||
def start(example_count_notification) | ||
output.puts("TAP version 13") | ||
output.puts("1.." + example_count.to_s) | ||
|
||
output.puts("1.." + example_count_notification.count.to_s) | ||
end | ||
|
||
def example_passed(example) | ||
super(example) | ||
tap_example_output(OK, example) | ||
def example_passed(notification) | ||
tap_example_output(OK, notification.example) | ||
end | ||
|
||
def example_pending(example) | ||
super(example) | ||
tap_example_output(NOT_OK, example, SKIP) | ||
def example_pending(notification) | ||
tap_example_output(NOT_OK, notification.example, SKIP) | ||
end | ||
|
||
def example_failed(example) | ||
super(example) | ||
tap_example_output(NOT_OK, example) | ||
def example_failed(notification) | ||
tap_example_output(NOT_OK, notification.example) | ||
output.puts(" ---") | ||
my_exception = example.exception.to_s | ||
my_exception = notification.example.exception.to_s | ||
my_exception.gsub! /"/, '' | ||
output.puts(" #{my_exception} ") | ||
output.puts(" ...") | ||
end | ||
|
||
def dump_summary(duration, example_count, failure_count, pending_count) | ||
super(duration, example_count, failure_count, pending_count) | ||
end | ||
|
||
private | ||
def tap_example_output(ok, example, modifier='') | ||
@total += 1 | ||
|
Looking more closely, I see that there is some work happening in
BaseFormatter.start
. It is probably good to callsuper
forstart
andclose
.It's irritating that some of these methods are on the base class and some are not... e.g. does every formatter need to respond to
pending_examples
with a correct array of examples?