Created
April 27, 2016 11:37
-
-
Save mielientiev/9cc4b8cc418e93e625990701f6260ee8 to your computer and use it in GitHub Desktop.
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
//Controller | |
import play.api.mvc.{Action, Controller} | |
class HelloWorldController extends Controller { | |
def helloWorld() = Action { | |
Ok("Hello World") | |
} | |
} | |
//Test | |
import org.scalatestplus.play.{OneAppPerTest, PlaySpec} | |
import play.api.test.FakeRequest | |
import play.api.test.Helpers._ | |
class HelloWorldSpec extends PlaySpec with OneAppPerTest { | |
"HelloWorld controller" should { | |
"return 'Hello World' string" in { | |
val page = route(app, FakeRequest(GET, "/")).get | |
status(page) mustBe OK | |
contentAsString(page) mustBe "Hello World" | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment