Class: TurboTests::DocumentationFormatter

Inherits:
BaseFormatter
  • Object
show all
Defined in:
lib/turbo_tests/documentation_formatter.rb

Overview

An RSpec formatter that prepends the process id to all messages

Instance Method Summary collapse

Methods inherited from BaseFormatter

#dump_summary

Instance Method Details

#example_failed(notification) ⇒ Object



46
47
48
49
50
51
52
53
54
55
# File 'lib/turbo_tests/documentation_formatter.rb', line 46

def example_failed(notification)
  output.puts RSpec::Core::Formatters::ConsoleCodes.wrap(
                "#{output_example(notification.example)} (FAILED - #{next_failure_index})",
                :failure,
              )

  output_activerecord_debug_logs(output, notification.example)

  output.flush
end

#example_passed(notification) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/turbo_tests/documentation_formatter.rb', line 24

def example_passed(notification)
  output.puts RSpec::Core::Formatters::ConsoleCodes.wrap(
                output_example(notification.example),
                :success,
              )

  output_activerecord_debug_logs(output, notification.example)

  output.flush
end

#example_pending(notification) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/turbo_tests/documentation_formatter.rb', line 35

def example_pending(notification)
  message = notification.example.execution_result.pending_message

  output.puts RSpec::Core::Formatters::ConsoleCodes.wrap(
                "#{output_example(notification.example)} (PENDING: #{message})",
                :pending,
              )

  output.flush
end

#start(*args) ⇒ Object



15
16
17
18
# File 'lib/turbo_tests/documentation_formatter.rb', line 15

def start(*args)
  super(*args)
  output.puts "::group:: Verbose turbo_spec output" if ENV["GITHUB_ACTIONS"]
end

#stop(*args) ⇒ Object



20
21
22
# File 'lib/turbo_tests/documentation_formatter.rb', line 20

def stop(*args)
  output.puts "::endgroup::" if ENV["GITHUB_ACTIONS"]
end