Skip to content

Instantly share code, notes, and snippets.

@mersanuzun
Created November 6, 2017 13:53
Show Gist options
  • Save mersanuzun/3db4a1fad1db9d5a98d8b78a3396bb16 to your computer and use it in GitHub Desktop.
Save mersanuzun/3db4a1fad1db9d5a98d8b78a3396bb16 to your computer and use it in GitHub Desktop.
Custom matcher for Result object in scala
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