Topic: How to simulate time passage during tests?

The primary function of my rails app compares database date values to the current date. In order to test this functionality, I need to simulate time passing. I currently roll back date fields to trigger certain processes. This is becoming increasingly tedious as my application becomes more complex. I would love to artificially advance ActiveRecord datetime during my test to more naturally simulate the passage of time instead of tricking every field in my database into believing it. Anyone ever done this?

Re: How to simulate time passage during tests?

petermarks wrote:

Anyone ever done this?

Not me. I like the idea, but I wouldn't know how to do it.

Have you considered writing your code to make the more time-sensitive portions be more testable at the unit-testing level instead of the functional testing level?

- spike

Re: How to simulate time passage during tests?

Unfortunately I need to be able to test this functionality on the integration level. Fortunately, however, I've been pointed to this extension which looks to be exactly what I'm looking for:

http://geeksomnia.com/2007/11/07/timetravel_to/