Class: RSpec::Core::Formatters::BaseFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/core/formatters/base_formatter.rb

Overview

RSpec's built-in formatters are all subclasses of RSpec::Core::Formatters::BaseTextFormatter.

See Also:

Direct Known Subclasses

BaseTextFormatter

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (BaseFormatter) initialize(output)

Returns a new instance of BaseFormatter

Parameters:

  • output (IO)

    the formatter output

See Also:



22
23
24
25
# File 'lib/rspec/core/formatters/base_formatter.rb', line 22

def initialize(output)
  @output = output || StringIO.new
  @example_group = nil
end

Instance Attribute Details

- (void) example_group

Returns the value of attribute example_group



16
17
18
# File 'lib/rspec/core/formatters/base_formatter.rb', line 16

def example_group
  @example_group
end

- (void) output (readonly)

Returns the value of attribute output



17
18
19
# File 'lib/rspec/core/formatters/base_formatter.rb', line 17

def output
  @output
end

Instance Method Details

- (void) close(notification)

Parameters:

  • notification (NullNotification)

See Also:



48
49
50
# File 'lib/rspec/core/formatters/base_formatter.rb', line 48

def close(notification)
  restore_sync_output
end

- (void) example_group_started(notification)

Parameters:

  • notification (GroupNotification)

    containing example_group subclass of RSpec::Core::ExampleGroup

See Also:



40
41
42
# File 'lib/rspec/core/formatters/base_formatter.rb', line 40

def example_group_started(notification)
  @example_group = notification.group
end

- (void) start(notification)

Parameters:

  • notification (StartNotification)

See Also:



31
32
33
34
# File 'lib/rspec/core/formatters/base_formatter.rb', line 31

def start(notification)
  start_sync_output
  @example_count = notification.count
end