module RSpec::Proverbs::DocumentationFormatter::InstanceMethods

Public Instance Methods

example_passed_with_steps(notification) click to toggle source
# File lib/proverbs/rspec/documentation_formatter.rb, line 64
def example_passed_with_steps(notification)
  example_passed_without_steps(notification) unless notification.example.metadata[:with_steps]
end
example_started(notification) click to toggle source
# File lib/proverbs/rspec/documentation_formatter.rb, line 19
def example_started(notification); end
example_started_with_steps(notification) click to toggle source
# File lib/proverbs/rspec/documentation_formatter.rb, line 56
def example_started_with_steps(notification)
  example_started_without_steps(notification)

  return unless notification.example.metadata[:with_steps]
  full_message = "#{current_indentation}#{notification.example.description}"
  output.puts Core::Formatters::ConsoleCodes.wrap(full_message, :default)
end
example_step_failed(notification) click to toggle source
# File lib/proverbs/rspec/documentation_formatter.rb, line 31
def example_step_failed(notification)
  no_keyword_display = %w(specify example it rule fact step test)
  keyword = notification.type.to_s

  full_message = "#{current_indentation}  #{keyword.capitalize} #{notification.message} (FAILED)" unless no_keyword_display.include?(keyword)
  full_message = "#{current_indentation}  #{notification.message} (FAILED)" if no_keyword_display.include?(keyword)

  output.puts Core::Formatters::ConsoleCodes.wrap(full_message, :failure)
end
example_step_passed(notification) click to toggle source
# File lib/proverbs/rspec/documentation_formatter.rb, line 21
def example_step_passed(notification)
  no_keyword_display = %w(specify example it rule fact step test)
  keyword = notification.type.to_s

  full_message = "#{current_indentation}  #{keyword.capitalize} #{notification.message}" unless no_keyword_display.include?(keyword)
  full_message = "#{current_indentation}  #{notification.message}" if no_keyword_display.include?(keyword)

  output.puts Core::Formatters::ConsoleCodes.wrap(full_message, :success)
end
example_step_pending(notification) click to toggle source
# File lib/proverbs/rspec/documentation_formatter.rb, line 41
def example_step_pending(notification)
  no_keyword_display = %w(specify example it rule fact step test)
  keyword = notification.type.to_s

  full_message = "#{current_indentation}  #{keyword.capitalize} #{notification.message}" unless no_keyword_display.include?(keyword)
  full_message = "#{current_indentation}  #{notification.message}" if no_keyword_display.include?(keyword)

  pending_check = notification.options[:pending] && notification.options[:pending]

  full_message << " (PENDING: #{notification.options[:pending]})" unless pending_check
  full_message << ' (PENDING)' if pending_check

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