Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: f0a56853de
Fetching contributors…

Cannot retrieve contributors at this time

24 lines (19 sloc) 0.569 kB
require 'test_helper'
class TimerTest < Test::Unit::TestCase
context "Timing the execution of a block" do
setup do
now = Time.now
invocations = 0
stub(Time).now do
invocations += 1
# not sure why we have to start at 1,
# but this seems to get called somewhere
invocations == 2 ? now : (now + 1.5)
end
@obj = Class.new { include Trample::Timer }.new
end
should "return the amount of time elapsed while the block was run" do
assert_equal(1.5, @obj.time {})
end
end
end
Jump to Line
Something went wrong with that request. Please try again.