Created
July 18, 2012 13:22
-
-
Save austinbv/3136187 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| ) 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) |
This file contains hidden or 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
| @getNouns: (callback) -> | |
| @_wordnik.randomWords( | |
| includePartOfSpeech: 'noun', | |
| (e, result) -> | |
| throw new Error('Wordnik Failed') if e | |
| process.nextTick -> | |
| callback(result) | |
| ) |
This file contains hidden or 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
| 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