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.
Constants
- NOTIFICATIONS
Attributes
@api private
Public Class Methods
@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
@api public
@param notification [NullNotification]
# File lib/rspec/legacy_formatters/adaptor.rb, line 224 def close(notification) @formatter.close end
@api public
@param notification [NullNotification]
# File lib/rspec/legacy_formatters/adaptor.rb, line 188 def dump_failures(notification) @formatter.dump_failures end
@api public
@param notification [NullNotification]
# File lib/rspec/legacy_formatters/adaptor.rb, line 203 def dump_pending(notification) @formatter.dump_pending end
@api public
@param notification [NullNotification]
# File lib/rspec/legacy_formatters/adaptor.rb, line 210 def dump_profile(notification) @formatter.dump_profile end
@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
@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
@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
@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
@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
@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
@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
@api public
@param notification [MessageNotification] containing message
# File lib/rspec/legacy_formatters/adaptor.rb, line 167 def message(notification) @formatter.message notification.message end
@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
@api private
# File lib/rspec/legacy_formatters/adaptor.rb, line 93 def output formatter.output end
@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
@api public
@param notification [NullNotification]
# File lib/rspec/legacy_formatters/adaptor.rb, line 118 def start(notification) @formatter.start notification.count end
@api public
@param notification [NullNotification]
# File lib/rspec/legacy_formatters/adaptor.rb, line 181 def start_dump(notification) @formatter.start_dump end
@api public
@param notification [NullNotification]
# File lib/rspec/legacy_formatters/adaptor.rb, line 174 def stop(notification) @formatter.stop end