I'm getting a done() called multiple times error when I'm testing a restler call. It doesn't error if I only make the restler call onece, however it errors if I call the same method twice in one test run.
Here is the simplified version of the test
myModule = require 'myModule'
describe 'foo', ->
describe 'bar', ->
it "should hi", (done) ->
myModule.hi done
it "should hi again", (done) ->
myModule.hi done
and here is myModule
rest = require 'restler'
exports.hi = (done) ->
rest.get('http://google.com'
).on "complete", (data, response) ->
console.log 'getting called once'
done null, data
Should I be worried about async multiple requests with restler? What is causing this error?
console log output when I add
◦ should hi: getting called once
✓ should hi (221ms)
◦ should hi again: getting called once
1) should hi
getting called once
✓ should hi again (211ms)
Looks like it's an issue with Restler not being updated to be compatible with node 0.10.x
https://github.com/danwrong/restler/pull/113/files
Restler will call the callback multiple times, but there is a pull request that fixes the issue.