Skip to content

Instantly share code, notes, and snippets.

@ian-kent
Last active August 29, 2015 13:56
Show Gist options
  • Save ian-kent/9037772 to your computer and use it in GitHub Desktop.
Save ian-kent/9037772 to your computer and use it in GitHub Desktop.
Fix for "The play Cache is not alive (STATUS_SHUTDOWN)"
package ReactiveAPI
import org.specs2.mutable.Specification
import play.api.mvc.{Action, Results}
import play.api.test.{WithApplication, FakeApplication}
import play.api.cache.Cache
class ExampleSpec extends Specification with Results {
val appWithRoutes = () => FakeApplication(withRoutes = {
case ("GET", "/") => Action{ Ok }
})
"Example" should {
"do something" in new WithApplication(app = appWithRoutes()) {
// Access Cache here
}
"do something" in new WithApplication(app = appWithRoutes()) {
// Access Cache here
}
}
}
@shuninghuang
Copy link

Do you know what should I do if I use FlatSpec of scalatest and activateTest rather than WithApplication?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment