class RSpec::Longrun::Formatter

Public Class Methods

new(output) click to toggle source
Calls superclass method
# File lib/rspec/longrun/formatter.rb, line 8
def initialize(output)
  super(output)
  @blocks = [Block.new(true)]
end

Protected Class Methods

alias_missing_method(method_name, fallback_method_name) click to toggle source
# File lib/rspec/longrun/formatter.rb, line 53
def self.alias_missing_method(method_name, fallback_method_name)
  unless method_defined?(method_name)
    alias_method method_name, fallback_method_name
  end
end

Public Instance Methods

example_failed(example) click to toggle source
Calls superclass method
# File lib/rspec/longrun/formatter.rb, line 38
def example_failed(example)
  super(example)
  end_block(failure_color("FAILED"))
end
example_group_finished(example_group) click to toggle source
Calls superclass method
# File lib/rspec/longrun/formatter.rb, line 18
def example_group_finished(example_group)
  super(example_group)
  end_block
end
example_group_started(example_group) click to toggle source
Calls superclass method
# File lib/rspec/longrun/formatter.rb, line 13
def example_group_started(example_group)
  super(example_group)
  begin_block(example_group.description)
end
example_passed(example) click to toggle source
Calls superclass method
# File lib/rspec/longrun/formatter.rb, line 28
def example_passed(example)
  super(example)
  end_block(success_color("OK"))
end
example_pending(example) click to toggle source
Calls superclass method
# File lib/rspec/longrun/formatter.rb, line 33
def example_pending(example)
  super(example)
  end_block(pending_color("PENDING: " + example.execution_result[:pending_message]))
end
example_started(example) click to toggle source
Calls superclass method
# File lib/rspec/longrun/formatter.rb, line 23
def example_started(example)
  super(example)
  begin_block(detail_color(example.description))
end
step_finished(description) click to toggle source
# File lib/rspec/longrun/formatter.rb, line 47
def step_finished(description)
  end_block
end
step_started(description) click to toggle source
# File lib/rspec/longrun/formatter.rb, line 43
def step_started(description)
  begin_block(description)
end

Private Instance Methods

begin_block(message) click to toggle source
# File lib/rspec/longrun/formatter.rb, line 70
def begin_block(message)
  unless current_block.nested?
    output << faint("{\n")
    current_block.nested!
  end
  output << current_indentation
  output << message.strip
  output << ' '
  @blocks.push(Block.new)
end
current_block() click to toggle source
# File lib/rspec/longrun/formatter.rb, line 66
def current_block
  @blocks.last
end
current_indentation() click to toggle source
# File lib/rspec/longrun/formatter.rb, line 96
def current_indentation
  '  ' * (@blocks.size - 1)
end
end_block(message = nil) click to toggle source
# File lib/rspec/longrun/formatter.rb, line 81
def end_block(message = nil)
  block = @blocks.pop
  block.finished!
  if block.nested?
    output << current_indentation
    output << faint('} ')
  end
  if message
    output << message.strip
    output << ' '
  end
  output << faint('(' + block.timing + ')')
  output << "\n"
end
faint(text) click to toggle source
# File lib/rspec/longrun/formatter.rb, line 100
def faint(text)
  color(text, "\e[2m")
end