flavian
flavian

Reputation: 28511

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

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.

Upvotes: 1

Views: 594

Answers (0)

Related Questions