Hi Karl,
It's going to be difficult to help you without more detail. What we
really need is a simple example of a test exhibiting the behaviour you
describe. One tactic for achieving this is to temporarily remove
irrelevant lines of code (from both test and code under test) a bit at
a time while trying to keep the same error occurring.
I've written a quick test [1] based on the information you've
supplied, but I don't see the error.
Otherwise the best I can offer is some questions that might help get
to the bottom of the problem :-
- Is there any logic in your code that relies on the value returned
from DateTime.now?
- What is the logic that controls the number of iterations of the loop?
- Is all of the code under test in the same thread as the test?
- How are you using Mocha e.g. gem, Rails plugin
- What version of Mocha are you using?
- What version of Ruby are you using?
Regards, James.