dsounded
dsounded

Reputation: 723

Failing spec in Scala/Play during insert into DB(slick)(json request)

I just try to write a simple spec like this:

"saves the record on create" in {
  val request = FakeRequest(POST, "/countries").withJsonBody(Json.parse("""{ "country": {"title":"Germany", "abbreviation":"GER"} }"""))
  val create = route(app, request).get

  status(create) mustBe OK
  contentType(create) mustBe Some("application/json")
  contentAsString(create) must include("country")
}

But on execution it throws such an error:

java.util.concurrent.RejectedExecutionException: Task slick.backend.DatabaseComponent$DatabaseDef$$anon$2@f456097 rejected from java.util.concurrent.ThreadPoolExecutor@6265d40c[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 1]

It works good for get request test for index page, any ideas how to workaround this ?

Upvotes: 0

Views: 76

Answers (1)

dsounded
dsounded

Reputation: 723

The problem was OneAppPerTest since problems with DB connections: just replacing it to OneAppPerSuitesolves the problem

Upvotes: 0

Related Questions