spray-testkit: could not find implicit value for parameter ta:

妖精的绣舞 提交于 2019-12-11 09:36:13

问题


First time spray user close to ripping hair out.

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"
    }
  }
}

And the wonderful compilation error message:

 could not find implicit value for parameter ta: ApiSpec.this.TildeArrow[ApiSpec.this.RouteResult,Boolean]
[error]     Get("/test/") ~> check {}

Could anyone please point me in the right direction? Copy pasting from spray-testkit examples seems to fail.

来源:https://stackoverflow.com/questions/28686789/spray-testkit-could-not-find-implicit-value-for-parameter-ta

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!