class Rfc::Announce

Public Class Methods

new(output) click to toggle source
Calls superclass method
# File lib/rfc/announce.rb, line 12
def initialize(output)
  super
  @group_level = 0
end

Public Instance Methods

example_failed(failure) click to toggle source
# File lib/rfc/announce.rb, line 43
def example_failed(failure)
  output.puts failure_output(failure.example)
end
example_group_finished(_notification) click to toggle source
# File lib/rfc/announce.rb, line 24
def example_group_finished(_notification)
  @group_level -= 1 if @group_level > 0
end
example_group_started(notification) click to toggle source
# File lib/rfc/announce.rb, line 17
def example_group_started(notification)
  output.puts if @group_level == 0
  output.puts "#{current_indentation}#{notification.group.description.strip}"

  @group_level += 1
end
example_passed(passed) click to toggle source
# File lib/rfc/announce.rb, line 34
def example_passed(passed)
  output.puts passed_output(passed.example)
end
example_pending(pending) click to toggle source
# File lib/rfc/announce.rb, line 38
def example_pending(pending)
  output.puts pending_output(pending.example,
                             pending.example.execution_result.pending_message)
end
example_started(notification) click to toggle source
# File lib/rfc/announce.rb, line 28
def example_started(notification)
  example = notification.example
  output.puts(RSpec::Core::Formatters::ConsoleCodes.wrap(
    "#{current_indentation}#{example.description.strip}: #{notification.example.id}", :blue))
end

Private Instance Methods

current_indentation() click to toggle source
# File lib/rfc/announce.rb, line 73
def current_indentation
  '  ' * @group_level
end
failure_output(example) click to toggle source
# File lib/rfc/announce.rb, line 61
def failure_output(example)
  RSpec::Core::Formatters::ConsoleCodes.wrap(
    "#{current_indentation}" \
    "  FAILED - #{next_failure_index}",
    :failure)
end
next_failure_index() click to toggle source
# File lib/rfc/announce.rb, line 68
def next_failure_index
  @next_failure_index ||= 0
  @next_failure_index += 1
end
passed_output(example) click to toggle source
# File lib/rfc/announce.rb, line 49
def passed_output(example)
  RSpec::Core::Formatters::ConsoleCodes.wrap(
    "#{current_indentation}  passed", :success)
end
pending_output(example, message) click to toggle source
# File lib/rfc/announce.rb, line 54
def pending_output(example, message)
  RSpec::Core::Formatters::ConsoleCodes.wrap(
    "#{current_indentation}" \
    "  PENDING: #{message}",
    :pending)
end