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

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

Instance Method Summary collapse

Instance Method Details

#_faults_by_nameObject



63
64
65
# File 'lib/shoulda_list_runner.rb', line 63

def _faults_by_name
  @_faults_by_name ||= {}
end

#add_fault(fault) ⇒ Object



67
68
69
70
# File 'lib/shoulda_list_runner.rb', line 67

def add_fault(fault)
  @faults << fault
  _faults_by_name[fault.test_name] = fault
end

#is_fault?(name) ⇒ Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/shoulda_list_runner.rb', line 59

def is_fault?(name)
  !_faults_by_name[name].nil?
end

#test_finished(name) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/shoulda_list_runner.rb', line 43

def test_finished(name)
  if defined?(Test::Unit::Color)
    if is_fault?(name)
      output(name.gsub(/test: /, ""), Test::Unit::Color.new("red"))
    else
      output(name.gsub(/test: /, ""), Test::Unit::Color.new("green"))
    end
  else
    if is_fault?(name)
      output(ShouldaAddons::Color.red(name.gsub(/test: /, "")))
    else
      output(ShouldaAddons::Color.green(name.to_s.gsub(/test: /, "")))
    end
  end
end