Class: RSpec::Queue::FailureFormatter

Inherits:
SimpleDelegator
  • Object
show all
Includes:
CI::Queue::OutputHelpers
Defined in:
lib/rspec/queue/failure_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(notification) ⇒ FailureFormatter

Returns a new instance of FailureFormatter.



10
11
12
13
# File 'lib/rspec/queue/failure_formatter.rb', line 10

def initialize(notification)
  @notification = notification
  super
end

Instance Method Details

#to_hObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rspec/queue/failure_formatter.rb', line 22

def to_h
  example = @notification.example
  {
    test_file: example.file_path,
    test_line: example.[:line_number],
    test_and_module_name: example.id,
    test_name: example.description,
    test_suite: example.example_group.description,
    error_class: @notification.exception.class.name,
    output: to_s,
  }
end

#to_sObject



15
16
17
18
19
20
# File 'lib/rspec/queue/failure_formatter.rb', line 15

def to_s
  [
    @notification.fully_formatted(nil),
    colorized_rerun_command(@notification.example)
  ].join("\n")
end