I would like to test the behavior of a function that has different behaviors depending on which it is being executed, is there a way to define/simulate the date in specs2
?
Example how would I test the following?
def dateDependingFunction:Boolean = currentDate > aSetDate
I would like to be able to write something like
"My Date depending functions" should{
// here somehow set a date fulfilling `currentDate > aSetDate`
"return true" in {
dateDependingFunction:Boolean must beBeEqualTo(true)
}
// here somehow set a date fulfilling `currentDate < aSetDate`
"return false" in {
dateDependingFunction:Boolean must beBeEqualTo(false)
}
}
Aucun commentaire:
Enregistrer un commentaire