Skip to content

Instantly share code, notes, and snippets.

@austinbv
Created July 18, 2012 13:22
Show Gist options
  • Save austinbv/3136187 to your computer and use it in GitHub Desktop.
Save austinbv/3136187 to your computer and use it in GitHub Desktop.
) Wordlist .getNouns should call a callback with the response:
Error: done() called multiple times
at multiple (/Users/austinbv/Dropbox/Documents/Sites/poet_app/node_modules/mocha/lib/runnable.js:152:31)
at done (/Users/austinbv/Dropbox/Documents/Sites/poet_app/node_modules/mocha/lib/runnable.js:158:26)
at Runnable.run.duration (/Users/austinbv/Dropbox/Documents/Sites/poet_app/node_modules/mocha/lib/runnable.js:174:9)
at expect.have.been.calledWith.id (/Users/austinbv/Dropbox/Documents/Sites/poet_app/test/word_spec.coffee:44:11)
at Word.getNouns (/Users/austinbv/Dropbox/Documents/Sites/poet_app/models/word.coffee:34:18)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
2) Wordlist .getNouns should call a callback with the response:
Error: done() called multiple times
at multiple (/Users/austinbv/Dropbox/Documents/Sites/poet_app/node_modules/mocha/lib/runnable.js:152:31)
at done (/Users/austinbv/Dropbox/Documents/Sites/poet_app/node_modules/mocha/lib/runnable.js:158:26)
at Runnable.run.duration (/Users/austinbv/Dropbox/Documents/Sites/poet_app/node_modules/mocha/lib/runnable.js:174:9)
at expect.have.been.calledWith.id (/Users/austinbv/Dropbox/Documents/Sites/poet_app/test/word_spec.coffee:44:11)
at Word.getNouns (/Users/austinbv/Dropbox/Documents/Sites/poet_app/models/word.coffee:34:18)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
@getNouns: (callback) ->
@_wordnik.randomWords(
includePartOfSpeech: 'noun',
(e, result) ->
throw new Error('Wordnik Failed') if e
process.nextTick ->
callback(result)
)
it 'should call a callback with the response', (done) ->
sinon.stub(Word._wordnik, 'randomWords').yields(null, [
{id: 1234, word: "hello"},
{id: 2345, word: "foo"},
{id: 3456, word: "goodbye"}
]
)
spy = sinon.spy()
Word.getNouns (result) -> spy(result); done(); null
expect(spy).have.been.calledWith [
{id: 1234, word: "hello"},
{id: 2345, word: "foo"},
{id: 3456, word: "goodbye"}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment