Skip to content

Instantly share code, notes, and snippets.

@yangchenyun
Created July 29, 2012 15:41
Show Gist options
  • Save yangchenyun/3199577 to your computer and use it in GitHub Desktop.
Save yangchenyun/3199577 to your computer and use it in GitHub Desktop.
use spy to test calculator
describe "calculator", ->
it "should throw an error if no method is matched", ->
calculatorSpy = sinon.spy sample, 'calculator'
try
sample.calculator('non-exist-method', 1, 2)
catch e
sinon.assert.threw(calculatorSpy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment