Class: RspecTap::Formatter

Inherits:
RSpec::Core::Formatters::BaseTextFormatter
  • Object
show all
Defined in:
lib/rspec_tap/formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(stdout) ⇒ Formatter

Returns a new instance of Formatter.



13
14
15
16
# File 'lib/rspec_tap/formatter.rb', line 13

def initialize(stdout)
  @progress_count = 0
  super(stdout)
end

Instance Method Details

#dump_failures(*args) ⇒ Object



46
47
48
# File 'lib/rspec_tap/formatter.rb', line 46

def dump_failures(*args)
  # No-op. We already output failure info inline
end

#example_failed(notification) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/rspec_tap/formatter.rb', line 31

def example_failed(notification)
  example_line(
    status:      "not ok",
    description: notification.example.description
  )
  diagnostic(notification)
end

#example_passed(notification) ⇒ Object



27
28
29
# File 'lib/rspec_tap/formatter.rb', line 27

def example_passed(notification)
  example_line(description: notification.example.description)
end

#example_pending(notification) ⇒ Object



39
40
41
42
43
44
# File 'lib/rspec_tap/formatter.rb', line 39

def example_pending(notification)
  example_line(
    description: notification.example.description,
    directive:   "# SKIP"
  )
end

#example_started(notification) ⇒ Object



18
19
20
# File 'lib/rspec_tap/formatter.rb', line 18

def example_started(notification)
  @progress_count += 1
end

#start(notification) ⇒ Object



22
23
24
25
# File 'lib/rspec_tap/formatter.rb', line 22

def start(notification)
  super(notification)
  output.puts "1..#{notification.count}"
end