Class: RSpec::TAP::Formatters::FlatCompact

Inherits:
Core::Formatters::BaseFormatter
  • Object
show all
Defined in:
lib/rspec/tap/formatters/flat_compact.rb

Overview

Flat compact TAP formatter

Constant Summary collapse

NOTIFICATIONS =

List of subscribed notifications

%i[
  seed
  start
  start_dump
  example_started
  example_passed
  example_failed
  example_pending
  message
  dump_failures
  dump_pending
  dump_summary
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ FlatCompact

Constructor

Parameters:

  • output (StringIO, File) —

    output stream



32
33
34
35
36
37
38
# File 'lib/rspec/tap/formatters/flat_compact.rb', line 32

def initialize(output)
  super

  @printer = Printer.new(output)
  @seed = nil
  @example_number = 0
end

Instance Method Details

#dump_failures(notification)

Failure examples notification

Parameters:

  • notification (ExamplesNotification)


118
119
120
# File 'lib/rspec/tap/formatters/flat_compact.rb', line 118

def dump_failures(notification)
  @printer.store_failed_examples_summary(notification)
end

#dump_pending(notification)

Pending examples notification

Parameters:

  • notification (ExamplesNotification)


125
126
127
# File 'lib/rspec/tap/formatters/flat_compact.rb', line 125

def dump_pending(notification)
  @printer.store_pending_examples_summary(notification)
end

#dump_summary(notification)

Examples summary notification

Parameters:

  • notification (SummaryNotification)


132
133
134
# File 'lib/rspec/tap/formatters/flat_compact.rb', line 132

def dump_summary(notification)
  @printer.summary_output(notification, @seed)
end

#example_failed(notification)

Failing example notification

Parameters:

  • notification (FailedExampleNotification)


85
86
87
88
89
90
91
92
# File 'lib/rspec/tap/formatters/flat_compact.rb', line 85

def example_failed(notification)
  @printer.example_progress_output(:failure)
  @printer.failure_output(
    notification.example.full_description.strip,
    @example_number,
    0
  )
end

#example_passed(notification)

Passing example notification

Parameters:

  • notification (ExampleNotification)


73
74
75
76
77
78
79
80
# File 'lib/rspec/tap/formatters/flat_compact.rb', line 73

def example_passed(notification)
  @printer.example_progress_output(:success)
  @printer.success_output(
    notification.example.full_description.strip,
    @example_number,
    0
  )
end

#example_pending(notification)

Pending example notification

Parameters:

  • notification (PendingExampleFailedAsExpectedNotification, SkippedExampleException)


98
99
100
101
102
103
104
105
106
# File 'lib/rspec/tap/formatters/flat_compact.rb', line 98

def example_pending(notification)
  @printer.example_progress_output(:pending)
  @printer.pending_output(
    notification,
    notification.example.full_description.strip,
    @example_number,
    0
  )
end

#example_started(_notification)

Example start notification

Parameters:

  • _notification (ExampleNotification)


66
67
68
# File 'lib/rspec/tap/formatters/flat_compact.rb', line 66

def example_started(_notification)
  @example_number += 1
end

#message(notification)

Failure outside of example notification

Parameters:

  • notification (MessageNotification)


111
112
113
# File 'lib/rspec/tap/formatters/flat_compact.rb', line 111

def message(notification)
  @printer.message_output(notification)
end

#seed(notification)

Seed notification

Parameters:

  • notification (SeedNotification)


43
44
45
# File 'lib/rspec/tap/formatters/flat_compact.rb', line 43

def seed(notification)
  @seed = notification.seed if notification.seed_used?
end

#start(notification)

Start notification

Parameters:

  • notification (StartNotification)


50
51
52
53
54
# File 'lib/rspec/tap/formatters/flat_compact.rb', line 50

def start(notification)
  super

  @printer.start_output
end

#start_dump(_notification)

Execution finished notification

Parameters:

  • _notification (NullNotification)


59
60
61
# File 'lib/rspec/tap/formatters/flat_compact.rb', line 59

def start_dump(_notification)
  @printer.example_progress_dump
end