RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: leifbladt
You're right. The Timecop version is more deterministic and that is what our tests should be.
But there maybe situations where you can't use Timecop and you don't need to test on milliseconds (with an increased delta to get a more robust test), then it might be a good solution too.
Testing with times involved is mostly no fun, particularly because I never heard of Timecop before :) But I found a way to manage it with RSpec matchers:
it "saves the time the password reset was sent" do