2Gunsおもしろかったー!
大好きなマーク・ウォールバーグとデンゼル・ワシントンの映画で、久しぶりに硬派な映画を観た気がするわあ。
今のところ今年入ってから観た映画で1位ですわ。
しかし、DVD化されるの早いね。
ちなみに、黒エビスがオトモでした。
最高のひととき(笑
$ play new myapp $ play run
$ git init $ git add . $ git commit -m "MyApp初回コミット" $ git remote add origin git@bitbucket.org:omiend/myapp.git $ git push -u origin --all
import org.specs2.mutable._ import org.specs2.runner._ import org.junit.runner._ import play.api.test._ import play.api.test.Helpers._ /** * Add your spec here. * You can mock out a whole application including requests, plugins etc. * For more information, consult the wiki. */ @RunWith(classOf[JUnitRunner]) class ApplicationSpec extends Specification { "Application" should { "send 404 on a bad request" in new WithApplication{ route(FakeRequest(GET, "/boum")) must beNone } "render the index page" in new WithApplication{ val home = route(FakeRequest(GET, "/")).get status(home) must equalTo(OK) contentType(home) must beSome.which(_ == "text/html") contentAsString(home) must contain ("Your new application is ready.") } "わざとテストNGになるケース" in new WithApplication{ val home = route(FakeRequest(GET, "/hoge")).get status(home) must equalTo(OK) contentType(home) must beSome.which(_ == "text/html") contentAsString(home) must contain ("Your new application is ready.") } } }
$ sbt test [info] Loading project definition from /Users/myapp/project [info] Set current project to myapp (in build file:/Users/myapp/) [info] Compiling 1 Scala source to /Users/myapp/target/scala-2.10/classes... [info] Compiling 1 Scala source to /Users/myapp/target/scala-2.10/test-classes... [info] IntegrationSpec [info] Application should [info] + work from within a browser [info] Total for specification IntegrationSpec [info] Finished in 8 seconds, 325 ms [info] 1 example, 0 failure, 0 error [info] ApplicationSpec [info] Application should [info] + send 404 on a bad request [info] + render the index page [info] ! わざとテストNGになるケース [error] NoSuchElementException: None.get (ApplicationSpec.scala:31) [error] ApplicationSpec$$anonfun$3$$anonfun$apply$6$$anon$3$delayedInit$body.apply(ApplicationSpec.scala:31) [error] play.api.test.WithApplication$$anonfun$around$1.apply(Specs.scala:20) [error] play.api.test.WithApplication$$anonfun$around$1.apply(Specs.scala:20) [error] play.api.test.PlayRunners$class.running(Helpers.scala:45) [error] play.api.test.Helpers$.running(Helpers.scala:364) [error] play.api.test.WithApplication.around(Specs.scala:20) [error] play.api.test.WithApplication.delayedInit(Specs.scala:17) [error] ApplicationSpec$$anonfun$3$$anonfun$apply$6$$anon$3.(ApplicationSpec.scala:30) [error] ApplicationSpec$$anonfun$3$$anonfun$apply$6.apply(ApplicationSpec.scala:30) [error] ApplicationSpec$$anonfun$3$$anonfun$apply$6.apply(ApplicationSpec.scala:30) [info] Total for specification ApplicationSpec [info] Finished in 805 ms [info] 3 examples, 0 failure, 1 error [error] Error: Total 4, Failed 0, Errors 1, Passed 3 [error] Error during tests: [error] ApplicationSpec [error] (test:test) sbt.TestsFailedException: Tests unsuccessful [error] Total time: 34 s, completed 2014/04/06 14:39:36