lundi 30 novembre 2015

How to specify a relative date in yaml fixtures for RoR unit tests

I'm writing unit test using fixtures in yaml for a ruby on rails project.

We have many tests for users being < or > to n year old. ex:

young_kid:
  id: 2
  firstname: Nano
  lastname: Shinonome
  email: imarobot@nichijou.jp
  birthdate: 2000-05-11

Is there a way to specify a relative date like 2.days.from_now So that our tests are not bound to fail once the threshold is reached ?

We're using vanilla RoR unit tests.

Aucun commentaire:

Enregistrer un commentaire