Created
November 6, 2017 13:53
-
-
Save mersanuzun/3db4a1fad1db9d5a98d8b78a3396bb16 to your computer and use it in GitHub Desktop.
Custom matcher for Result object in scala
This file contains 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
import org.scalatest.matchers.{MatchResult, Matcher} | |
import play.api.mvc.Result | |
trait CustomMatcher { | |
def beStatus(status: Int) = Matcher { obj: Result => | |
MatchResult( | |
obj.header.status == status, | |
s"${obj.header.status} was not equal $status", | |
s"${obj.header.status} was equal $status", | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment