File: json_ext_formatter.rb

package info (click to toggle)
ruby-mongo 2.21.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 14,764 kB
  • sloc: ruby: 108,806; makefile: 5; sh: 2
file content (16 lines) | stat: -rw-r--r-- 649 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true
# rubocop:todo all

class JsonExtFormatter < RSpec::Core::Formatters::JsonFormatter
  RSpec::Core::Formatters.register self, :message,
    :dump_summary, :dump_profile, :stop, :seed, :close

  def format_example(example)
    super.tap do |hash|
      # Time format is chosen to be the same as driver's log entries
      hash[:started_at] = example.execution_result.started_at.strftime('%Y-%m-%d %H:%M:%S.%L %z')
      hash[:finished_at] = example.execution_result.finished_at.strftime('%Y-%m-%d %H:%M:%S.%L %z')
      hash[:sdam_log_entries] = SdamFormatterIntegration.example_log_entries(example.id)
    end
  end
end