次のようにルートをテストしたいScalatestRouteTest
:
trait MyRoutes extends Directives {
self: Api with ExecutionContextProvider =>
val myRoutes: Route =
pathPrefix("api") {
path("") {
(get & entity(as[MyState])) {
request => {
complete(doSomething(request.operation))
}
}
}
}
}
}
class RoutesSpec extends WordSpecLike with Api with ScalatestRouteTest
with Matchers with MyRoutes with MockitoSugar {
"The Routes" should {
"return status code success" in {
Get() ~> myRoutes ~> check {
status shouldEqual StatusCodes.Success
}
}
}
}
テストを実行すると、ランタイム エラーが発生します。
テスト MyRoutesSpec を実行できませんでした: org.jboss.netty.channel.ChannelException: バインドに失敗しました: /127.0.0.1:2552
ローカルホストにバインドしたくありません。これはどのように達成できますか?