Class: RspecKeyValue::Formatter

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

Overview

A simple Rspec formatter which prints the results in the form R:group.sub_group.example_name where R is -1 for PENDING, 0 for FAILED and 1 for PASS result

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Formatter

Returns a new instance of Formatter.



19
20
21
22
# File 'lib/rspec_key_value/formatter.rb', line 19

def initialize(output)
  super(output)
  @groups = []
end

Instance Method Details

#dump_failures(notification) ⇒ Object



46
# File 'lib/rspec_key_value/formatter.rb', line 46

def dump_failures(notification); end

#dump_pending(notification) ⇒ Object



48
# File 'lib/rspec_key_value/formatter.rb', line 48

def dump_pending(notification); end

#dump_summary(summary) ⇒ Object



44
# File 'lib/rspec_key_value/formatter.rb', line 44

def dump_summary(summary); end

#example_failed(failure) ⇒ Object



40
41
42
# File 'lib/rspec_key_value/formatter.rb', line 40

def example_failed(failure)
  output.puts example_line(0, failure)
end

#example_group_finished(_notification) ⇒ Object



28
29
30
# File 'lib/rspec_key_value/formatter.rb', line 28

def example_group_finished(_notification)
  @groups.pop
end

#example_group_started(notification) ⇒ Object



24
25
26
# File 'lib/rspec_key_value/formatter.rb', line 24

def example_group_started(notification)
  @groups.push clean_string(notification.group.description)
end

#example_passed(passed) ⇒ Object



32
33
34
# File 'lib/rspec_key_value/formatter.rb', line 32

def example_passed(passed)
  output.puts example_line(1, passed)
end

#example_pending(pending) ⇒ Object



36
37
38
# File 'lib/rspec_key_value/formatter.rb', line 36

def example_pending(pending)
  output.puts example_line(-1, pending)
end

#seed(notification) ⇒ Object



50
# File 'lib/rspec_key_value/formatter.rb', line 50

def seed(notification); end