第一次将用户拉近撕开头发。
trait SampleService extends SimpleRoutingApp with JsonProtocol with SprayJsonSupport {
implicit val system: ActorSystem = ActorSystem("test")
implicit def context: ExecutionContext = system.dispatcher
startServer(interface = "localhost", port = 8888) {
path("test") { _ =>
get {
complete {
"test"
}
}
}
}
}
import org.scalatest.FlatSpec import spray.testkit.ScalatestRouteTest
class ApiSpec extends FlatSpec with ScalatestRouteTest with SampleService {
"The api service" should "return test" in {
Get("/test/") ~> check {
responseAs[String] === "test"
}
}
}
精彩的编译错误信息:
could not find implicit value for parameter ta: ApiSpec.this.TildeArrow[ApiSpec.this.RouteResult,Boolean]
[error] Get("/test/") ~> check {}
有谁能请我指出正确的方向?从spray-testkit
示例复制粘贴似乎失败了。