class TurboTest::RSpec::ExampleFormatter

Public Class Methods

new(packer) click to toggle source
# File lib/turbo_test/rspec/example_formatter.rb, line 31
def initialize(packer)
        @packer = packer
        
        @colorizer = ::RSpec::Core::Formatters::ConsoleCodes
end

Public Instance Methods

dump_summary(summary) click to toggle source
# File lib/turbo_test/rspec/example_formatter.rb, line 61
def dump_summary(summary)
        count = summary.examples.count
        
        @packer.write([:count, count])
        @packer.flush
end
example_failed(notification) click to toggle source
# File lib/turbo_test/rspec/example_formatter.rb, line 46
def example_failed(notification)
        example = notification.example
        
        presenter = ::RSpec::Core::Formatters::ExceptionPresenter.new(example.exception, example)
        
        message = {
                description: example.full_description,
                location: example.location_rerun_argument,
                report: presenter.fully_formatted(nil, @colorizer),
        }
        
        @packer.write([:failed, message])
        @packer.flush
end
example_finished(notification) click to toggle source
# File lib/turbo_test/rspec/example_formatter.rb, line 41
def example_finished(notification)
        @packer.write([:finished, notification.example.id])
        @packer.flush
end
output() click to toggle source
# File lib/turbo_test/rspec/example_formatter.rb, line 37
def output
        @packer
end