Displaying 1 result from an estimated 1 matches for "test_two_stubs".
2006 Sep 22
2
I''m misunderstanding how stubs works
We''re still just starting out with Mocha/Stubba, so please forgive any
newbie errors.
I''m using "stubs" to test some realtime functions, to control exactly which
time is returned from Time.now. I would expect the following test to pass:
def test_two_stubs
t = Time.now - 60
Time.stubs(:now).returns(t)
start_time = Time.now
t += 20
Time.stubs(:now).returns(t)
end_time = Time.now
assert_equal end_time - start_time, 20
end
But it fails with:
1) Failure:
test_two_stubs(MochaTest) [mochatest.rb:19]:
<0.0> expect...