class RSpec::LegacyFormatters::Adaptor

@private The `LegacyFormatter` is used to wrap older RSpec 2.x style formatters for the new 3.x implementation. It takes care of registering all the old notifications and translating them to the older formatter.

@see RSpec::Core::Formatters::BaseFormatter

Constants

NOTIFICATIONS

Attributes

formatter[R]

@api private

Public Class Methods

new(formatter_class, *args) click to toggle source

@api public

@param formatter_class [Class] formatter class to build @param args [Array<IO, Object>] arguments for the formatter, (usually IO but don't have to be)

# File lib/rspec/legacy_formatters/adaptor.rb, line 101
def initialize(formatter_class, *args)
  @formatter = formatter_class.new(*args)
end

Public Instance Methods

close(notification) click to toggle source

@api public

@param notification [NullNotification]

# File lib/rspec/legacy_formatters/adaptor.rb, line 224
def close(notification)
  @formatter.close
end
dump_failures(notification) click to toggle source

@api public

@param notification [NullNotification]

# File lib/rspec/legacy_formatters/adaptor.rb, line 188
def dump_failures(notification)
  @formatter.dump_failures
end
dump_pending(notification) click to toggle source

@api public

@param notification [NullNotification]

# File lib/rspec/legacy_formatters/adaptor.rb, line 203
def dump_pending(notification)
  @formatter.dump_pending
end
dump_profile(notification) click to toggle source

@api public

@param notification [NullNotification]

# File lib/rspec/legacy_formatters/adaptor.rb, line 210
def dump_profile(notification)
  @formatter.dump_profile
end
dump_summary(summary) click to toggle source

@api public

@param summary [Core::Notifications::SummaryNotification]

# File lib/rspec/legacy_formatters/adaptor.rb, line 195
def dump_summary(summary)
  @formatter.load_time = summary.load_time if @formatter.respond_to? :load_time
  @formatter.dump_summary summary.duration, summary.example_count, summary.failure_count, summary.pending_count
end
example_failed(notification) click to toggle source

@api public

@param notification [ExampleNotification] containing example subclass of `RSpec::Core::Example`

# File lib/rspec/legacy_formatters/adaptor.rb, line 160
def example_failed(notification)
  @formatter.example_failed notification.example
end
example_group_finished(notification) click to toggle source

@api public

@param notification [GroupNotification] containing example_group subclass of `RSpec::Core::ExampleGroup`

# File lib/rspec/legacy_formatters/adaptor.rb, line 132
def example_group_finished(notification)
  @formatter.example_group_finished notification.group
end
example_group_started(notification) click to toggle source

@api public

@param notification [GroupNotification] containing example_group subclass of `RSpec::Core::ExampleGroup`

# File lib/rspec/legacy_formatters/adaptor.rb, line 125
def example_group_started(notification)
  @formatter.example_group_started notification.group
end
example_passed(notification) click to toggle source

@api public

@param notification [ExampleNotification] containing example subclass of `RSpec::Core::Example`

# File lib/rspec/legacy_formatters/adaptor.rb, line 146
def example_passed(notification)
  @formatter.example_passed notification.example
end
example_pending(notification) click to toggle source

@api public

@param notification [ExampleNotification] containing example subclass of `RSpec::Core::Example`

# File lib/rspec/legacy_formatters/adaptor.rb, line 153
def example_pending(notification)
  @formatter.example_pending notification.example
end
example_started(notification) click to toggle source

@api public

@param notification [ExampleNotification] containing example subclass of `RSpec::Core::Example`

# File lib/rspec/legacy_formatters/adaptor.rb, line 139
def example_started(notification)
  @formatter.example_started notification.example
end
message(notification) click to toggle source

@api public

@param notification [MessageNotification] containing message

# File lib/rspec/legacy_formatters/adaptor.rb, line 167
def message(notification)
  @formatter.message notification.message
end
notifications() click to toggle source

@api public

This method is invoked during the setup phase to register a formatters with the reporter

@return [Array] notifications the legacy formatter implements

# File lib/rspec/legacy_formatters/adaptor.rb, line 111
def notifications
  @notifications ||= NOTIFICATIONS.select { |m| @formatter.respond_to? m }
end
output() click to toggle source

@api private

# File lib/rspec/legacy_formatters/adaptor.rb, line 93
def output
  formatter.output
end
seed(notification) click to toggle source

@api public

@param notification [SeedNotification] containing the seed

# File lib/rspec/legacy_formatters/adaptor.rb, line 217
def seed(notification)
  @formatter.seed notification.seed
end
start(notification) click to toggle source

@api public

@param notification [NullNotification]

# File lib/rspec/legacy_formatters/adaptor.rb, line 118
def start(notification)
  @formatter.start notification.count
end
start_dump(notification) click to toggle source

@api public

@param notification [NullNotification]

# File lib/rspec/legacy_formatters/adaptor.rb, line 181
def start_dump(notification)
  @formatter.start_dump
end
stop(notification) click to toggle source

@api public

@param notification [NullNotification]

# File lib/rspec/legacy_formatters/adaptor.rb, line 174
def stop(notification)
  @formatter.stop
end