strongloop/loopback-testing — pull request #16 by bajtos (2014-06-09 07:21:23+00:00)
Title: helpers: fix usage of mocha contexts

Mocha 1.19 introduced nested contexts, where each `describe` has its
own context inheriting from parent's context via prototype.

The helper `whenCalledRemotely` was reading `this.url` to allow
users to override the url. However, since `whenCalledRemotely` was
not clearing `this.url` properly at the end of the test, the override
worked for the first request only. Subsequent requests used the same
URL as provided in the helper parameters.

This commit fixes the problem by changing `this.url = undefined`
to `delete this.url`, so that the the sub-sequent calls can access
`this.__proto__.url` in the same way as the first call.

/cc @ritch @raymondfeng FYI