Skip to content

Instantly share code, notes, and snippets.

@imbaker
Last active July 21, 2016 09:45
Show Gist options
  • Save imbaker/5a5409fd5a991271d83454aec1c70046 to your computer and use it in GitHub Desktop.
Save imbaker/5a5409fd5a991271d83454aec1c70046 to your computer and use it in GitHub Desktop.
customMatchers =
toBeLowerCase: (util) ->
return compare: (actual) ->
result = new Object
result.pass = util.equals(actual, actual.toLowerCase())
result.message = if result.pass then "okay" else "Expected '" + actual + "' to be lower case"
return result
describe "customMatchers", () ->
beforeEach () ->
jasmine.addMatchers customMatchers
it "simple pass", () ->
expect("ab").toBeLowerCase()
it "simple fail", () ->
expect("AB").toBeLowerCase()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment