0

I am trying to run the test of a project I cloned. I am new to Scala and Activator and I can not figure out what is happening

in the root folder I have the build.sbt

name := "xxxxx"

version := "2.0-SNAPSHOT"

scalaVersion := "2.11.5"

doc in Compile <<= target.map(_ / "none")

scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")

lazy val root = (project in file(".")).enablePlugins(PlayScala)

libraryDependencies ++= Seq(
  jdbc,
  anorm,
  cache,
  "org.scalatest" % "scalatest_2.11" % "2.2.4" % "test",
  "json-module" %% "json-module" % "2.0.0",
  )

instrumentSettings

ScoverageKeys.excludedPackages in ScoverageCompile := "<empty>;views*;views.*;views*html;Routes*;controllers*routes*;controllers*Reverse*;controllers*javascript*;controller*ref*"

ScoverageKeys.highlighting := true

This is an example file

class TestExampleSpec extends AbstractSpec {

  "TestExample#get(:testId)" must {
    val url = controllers.routes.TestExample.get(1, 1, 10).url

    "return 400 without X-Client-Id header" in {
      val fakeRequest = FakeRequest("GET", url).withTextBody("")

      val result: Future[Result] = controllers.TestExample.get(1, 1, 10)(fakeRequest)

      status(result) mustBe 400
      contentType(result) mustBe Some("application/json")
      val body = contentAsString(result)
      val bodyJson = Json.parse(body)

      (bodyJson \ "error").asOpt[Boolean] mustBe Some(true)
      (bodyJson \ "message").asOpt[String] mustBe Some("Missing X-Client-Id header")
    }

I tried this commands

$ activator reload
$ activator clean
$ activator test

But none of this worked I get this kind of messages

home/username/code/testing-project/test/TestExampleSpec.scala:10: value in is not a member of String
  "return 400 without X-Client-Id header" in {

Thank you

agusgambina
  • 6,229
  • 14
  • 54
  • 94

1 Answers1

0

I think the problem was related because the project was changed from play 2.2 to play 2.3.8

I added this dependency

"org.scalatestplus" %% "play" % "1.2.0" % "test"

Which seems did the trick.

agusgambina
  • 6,229
  • 14
  • 54
  • 94