Module: RSpec::ExampleSteps::DocumentationFormatter::InstanceMethods

Defined in:
lib/rspec/example_steps/documentation_formatter.rb

Instance Method Summary collapse

Instance Method Details

#example_passed_with_steps(notification) ⇒ Object



29
30
31
# File 'lib/rspec/example_steps/documentation_formatter.rb', line 29

def example_passed_with_steps(notification)
  example_passed_without_steps(notification.example) unless notification.example.[:with_steps]
end

#example_started(notification) ⇒ Object



17
18
# File 'lib/rspec/example_steps/documentation_formatter.rb', line 17

def example_started(notification)
end

#example_started_with_steps(notification) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/rspec/example_steps/documentation_formatter.rb', line 20

def example_started_with_steps(notification)
  example_started_without_steps(notification)

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

#example_step_failed(notification) ⇒ Object



50
51
52
53
# File 'lib/rspec/example_steps/documentation_formatter.rb', line 50

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



33
34
35
36
# File 'lib/rspec/example_steps/documentation_formatter.rb', line 33

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



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rspec/example_steps/documentation_formatter.rb', line 38

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