Created
February 16, 2014 17:31
-
-
Save ian-kent/9037664 to your computer and use it in GitHub Desktop.
Fix for "The play Cache is not alive (STATUS_SHUTDOWN)"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { | |
Cache.get("foo").getOrElse("bar") should be equalTo "bar" | |
Cache.set("foo", "baz") | |
Cache.get("foo").getOrElse("bar") should be equalTo "baz" | |
} | |
"do something" in new WithApplication(app = appWithRoutes) { | |
Cache.get("qux").getOrElse("bar") should be equalTo "bar" | |
Cache.set("qux", "baz") | |
Cache.get("qux").getOrElse("bar") should be equalTo "baz" | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) { | |
Cache.get("foo").getOrElse("bar") should be equalTo "bar" | |
Cache.set("foo", "baz") | |
Cache.get("foo").getOrElse("bar") should be equalTo "baz" | |
} | |
"do something" in new WithApplication(app = appWithRoutes()) { | |
Cache.get("qux").getOrElse("bar") should be equalTo "bar" | |
Cache.set("qux", "baz") | |
Cache.get("qux").getOrElse("bar") should be equalTo "baz" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment