I am writing my specs on my model Thing which has a date field which should be after the date of creation, thus I use the validate_timeliness plugin like that
validate_date :date, :after Time.now
I want to be able to add some Things with an anterior date but validation fails. I want to bypass the validation when creating some Things with the machinist factory.
Any clue ?
Shouldn’t your validation ensure that the date is after the created_at attribute?? Rather than Time.now???
You shouldn’t be trying to use invalid data in your tests, what you probably should do instead is fudge the created at time.
The only reason to try and put a time in the past in your spec surely should be to test that the validation is indeed working ..
Is there a reason why you want to do this? What are you trying to test??