I found it!
Here is a nice interface to setup an IT environment:
trait FakeServer {
def setup: Unit
def tearDown: Unit
}
object ITEnvironment extends FakeServer{
private val simplicators: Seq[FakeServer] = Seq(new FakeWebServer)
override def setup: Unit = simplicators foreach { server => server.setup}
override def tearDown: Unit = simplicators foreach { server => server.tearDown}
}
trait Specs2ITEnvironment { this: Specification =>
sequential
override def map(fs: =>Fragments) = Step( {ITEnvironment.setup} ) ^ fs ^ Step( {ITEnvironment.tearDown} )
}
class LoginIT extends SpecificationWithJUnit with Specs2ITEnvironment{
... your test here ...
}