Skip to content

Instantly share code, notes, and snippets.

@mileszs
Created February 3, 2010 20:59
Show Gist options
  • Save mileszs/294014 to your computer and use it in GitHub Desktop.
Save mileszs/294014 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
module Test
module Unit
class Slow
attr_reader :test_name, :message
def initialize(test_name)
@test_name = test_name
@message = "Too slow."
end
def single_character_display
"☻"
end
def short_display
"#@test_name: #{@message}"
end
def long_display
short_display
end
def to_s
long_display
end
end
end
end
module Test
module Unit
module UI
module Console
class TestRunner
def test_started(name)
@individual_test_start_time = Time.now
output_single(name + ": ", VERBOSE)
end
def test_finished(name)
elapsed_test_time = Time.now - @individual_test_start_time
if elapsed_test_time > 1
add_fault(Test::Unit::Slow.new(name))
else
output_single(".", PROGRESS_ONLY) unless (@already_outputted)
nl(VERBOSE)
@already_outputted = false
end
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment