Created
September 5, 2013 15:43
-
-
Save sam/6451952 to your computer and use it in GitHub Desktop.
Simple example of a Play Framework / ScalaTest spec using functional composition to keep the building of two similar Requests (only difference is the Request-Method) DRY.
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
"Delete" taggedAs(tag.RolesTag) in { | |
val request = (FakeRequest(_:String, "/admin/roles/role-bob")) andThen | |
withAdminCredentials andThen | |
(route(_:FakeRequest[AnyContentAsEmpty.type])) | |
for { result <- request(DELETE) } { | |
status(result) must equal(SEE_OTHER) | |
flash(result).data must contain key("deleted") | |
} | |
for { result <- request(GET) } { | |
status(result) must equal(NOT_FOUND) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment