Search code examples
scalaimplicit-conversionimplicitspecs2

Is there any way to exclude implicit time convertions in org.spec2.time and use your own?


I'm trying to use specs2, and I have a problem with implicit conversions which are blended with those imported by me from scala.concurrent.duration._, is there any way to exclude implicite conversions from the scope?

import org.specs2.mutable.Specification
import scala.concurrent.duration._

class StatisticsSampleCacheSpec extends Specification {

    val map: Map[Long, Duration] = Map(
        1L -> 5.minute,
        3L -> 3.day,
        5L -> 5.day,
        7L -> 30.day)
}

Solution

  • It's quite common problem, try to mix-in org.specs2.time.NoTimeConversions trait:

    class StatisticsSampleCacheSpec extends Specification with NoTimeConversions