Frage

I have an interesting problem with testing using the WithApplication scope from Play 2.1.1.

Here is my code:

import play.api.test.{FakeApplication, WithApplication}
import org.specs2.mutable.Specification

class TestSpec extends Specification {

  "Test" should {
    "fail" in {
      true === false
    }

    "fail as well" in new WithApplication() {
      true === false
    }

    "fail with extreme prejudice" in new WithApplication(FakeApplication()) {
      true === false
    }
  }
}

I would expect all 3 of these to fail but in this case only the first one failed.

[info] Total for specification TestSpec
[info] Finished in 21 ms
[info] 3 examples, 1 failure, 0 error
[info]
[error] Failed: : Total 4, Failed 1, Errors 0, Passed 3, Skipped 0
[error] Failed tests:
[error] TestSpec

Is there some trick I'm missing here?

I'm using Scala 2.10.2, sbt 0.12.2, Play 2.1.1 and runnning on Java 7 U40.

Thanks in advance.

War es hilfreich?

Lösung

You should try a latest version of Play or the latest version of specs2 (2.2.3) where this issue has been fixed.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top