Class: RspecNumberedDocumentation::Formatter

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

Overview

Rspec formatter which prefixes the documentation formatter with line numbers indicating the order of test execution.

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Formatter

Returns a new instance of Formatter.



10
11
12
13
# File 'lib/rspec_numbered_documentation/formatter.rb', line 10

def initialize(output)
  super(output)
  @example_number = 0
end

Instance Method Details

#example_started(_notification) ⇒ Object



15
16
17
18
# File 'lib/rspec_numbered_documentation/formatter.rb', line 15

def example_started(_notification)
  @example_number += 1
  output.print "#{@example_number}:    "
end