Class: RspecTapFormatter

Inherits:
RSpec::Core::Formatters::BaseFormatter
  • Object
show all
Defined in:
lib/rspec_tap_formatter.rb

Constant Summary collapse

VERSION =
"0.5.0"

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ RspecTapFormatter

Returns a new instance of RspecTapFormatter.



12
13
14
15
# File 'lib/rspec_tap_formatter.rb', line 12

def initialize(output)
  @output = output
  @count = 0
end

Instance Method Details

#example_failed(notification) ⇒ Object



30
31
32
33
# File 'lib/rspec_tap_formatter.rb', line 30

def example_failed(notification)
  @output << "not ok #{@count} #{notification.example.description}\n"
  @output << "# #{failed_example_notification.message_lines.join('\n# ')}\n"
end

#example_passed(notification) ⇒ Object



26
27
28
# File 'lib/rspec_tap_formatter.rb', line 26

def example_passed(notification)
  @output << "ok #{@count} #{notification.example.description}\n"
end

#example_started(notification) ⇒ Object



22
23
24
# File 'lib/rspec_tap_formatter.rb', line 22

def example_started(notification)
  @count += 1
end

#start(notification) ⇒ Object



17
18
19
20
# File 'lib/rspec_tap_formatter.rb', line 17

def start(notification)
  @output << "TAP version 13\n"
  @output << "1..#{notification.count}\n"
end