Class: RSpec::TestSpec::Formatter

Inherits:
Core::Formatters::DocumentationFormatter
  • Object
show all
Defined in:
lib/test_spec/rspec/formatter.rb

Instance Method Summary collapse

Instance Method Details

#example_passed(notification) ⇒ Object



20
21
22
# File 'lib/test_spec/rspec/formatter.rb', line 20

def example_passed(notification)
  super unless notification.example.[:with_steps]
end

#example_started(notification) ⇒ Object

rubocop:disable Metrics/LineLength



13
14
15
16
17
18
# File 'lib/test_spec/rspec/formatter.rb', line 13

def example_started(notification)
  return unless notification.example.[:with_steps]

  full_message = "#{current_indentation}#{notification.example.description}"
  output.puts Core::Formatters::ConsoleCodes.wrap(full_message, :default)
end

#example_step_failed(notification) ⇒ Object

rubocop:enable Metrics/AbcSize rubocop:enable Style/ConditionalAssignment



46
47
48
49
# File 'lib/test_spec/rspec/formatter.rb', line 46

def example_step_failed(notification)
  full_message = "#{current_indentation}  #{notification.type.to_s.capitalize} #{notification.message} (FAILED)"
  output.puts Core::Formatters::ConsoleCodes.wrap(full_message, :failure)
end

#example_step_passed(notification) ⇒ Object



24
25
26
27
# File 'lib/test_spec/rspec/formatter.rb', line 24

def example_step_passed(notification)
  full_message = "#{current_indentation}  #{notification.type.to_s.capitalize} #{notification.message}"
  output.puts Core::Formatters::ConsoleCodes.wrap(full_message, :success)
end

#example_step_pending(notification) ⇒ Object

rubocop:disable Metrics/AbcSize rubocop:disable Style/ConditionalAssignment



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/test_spec/rspec/formatter.rb', line 31

def example_step_pending(notification)
  full_message = "#{current_indentation}  #{notification.type.to_s.capitalize} #{notification.message}"

  if notification.options[:pending] &&
     notification.options[:pending] != true
    full_message << " (PENDING: #{notification.options[:pending]})"
  else
    full_message << " (PENDING)"
  end

  output.puts Core::Formatters::ConsoleCodes.wrap(full_message, :pending)
end