Class: Test::Unit::UI::Console::TestRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/monkeyspecdoc.rb

Instance Method Summary collapse

Instance Method Details

#add_fault(fault) ⇒ Object



56
57
58
59
# File 'lib/monkeyspecdoc.rb', line 56

def add_fault(fault)
  @faults << fault
  @already_outputted = true
end

#test_finished(name) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/monkeyspecdoc.rb', line 61

def test_finished(name)
  # can cause issues if there's no test text.
  @current_test_text = ' ' if @current_test_text.empty? || @current_test_text.nil?
  if fault = @faults.find {|f| f.test_name == name}
    # Added ! to ERROR for length consistency
    fault_type = fault.is_a?(Test::Unit::Failure) ? "FAILED" : "ERROR!"
    # NOTE -- Concatenation because "\e[0m]" does funky stuff.
    output("[\e[0;31m#{fault_type}\e[0m" + "]#{@current_test_text} (#{@faults.length})")
  else
    # Added spaces on either side of OK for length consistency
    output("[  \e[0;32mOK\e[0m  ]#{@current_test_text}")
  end
  @already_outputted = false
end

#test_started(name) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/monkeyspecdoc.rb', line 41

def test_started(name)
  ctx, should = split_shoulda_names(name)
  unless ctx.nil? or should.nil?
    if ctx != @ctx
      nl
      output("#{ctx}:")
    end
    @ctx = ctx
    @current_test_text = " ==> #{should}"
    #output_single("- #{should}: ")
  else
    test_started_old(name)
  end
end

#test_started_oldObject



39
# File 'lib/monkeyspecdoc.rb', line 39

alias_method :test_started_old, :test_started