im.yagni.driveby.specs2.NakedDriveBySpecification.scala Maven / Gradle / Ivy
The newest version!
package im.yagni.driveby.specs2
import im.yagni.driveby.tracking.TrackingIds
import im.yagni.driveby.Specification
import org.specs2.mutable.SpecificationWithJUnit
import org.specs2.specification.{Step, Fragments}
trait NakedDriveBySpecification extends SpecificationWithJUnit with SpecificationAware {
val specification = Specification(this.getClass.getName, TrackingIds.nextSpecificationId)
def beforeSpecification: List[Function0[Unit]] = Nil
def afterSpecification: List[Function0[Unit]] = Nil
private def doBeforeSpecification() { beforeSpecification.reverse.foreach(_()) }
private def doAfterSpecification() { afterSpecification.foreach(_()) }
override def map(fs: => Fragments) = Step(doBeforeSpecification()) ^ fs ^ Step(doAfterSpecification())
}