chaijs/chai — pull request #257 by ichernev (2014-04-23 00:53:04+00:00)
Title: Enable should interface attaching to arbitrary root object

I'm having problems using the `should` interface with [selenium-webdriver](http://code.google.com/p/selenium/wiki/WebDriverJs). I think the problem is that the whole library for some reason runs in its own vm context. Sort of speak it has a parallel object hierarchy, so the `Object` that should attaches to is not the one that all selenium objects (namely promises) inherit.

With this patch should can be attached to an arbitrary object, by calling `chai.should(obj)`. In the selenium use-case the object that did the trick was to do `chai.should(webdriver.promise.Promise)`, because all promises inherit from this one. I'm also using [chai-as-promised](https://github.com/domenic/chai-as-promised), but that is unrelated.

To check the selenium code go to the `_base.js` file inside the selenium-webdriver node package (I couldn't find a replica of that in a repository posted online, the official [webdriver repo](https://code.google.com/p/selenium/source/browse/) has nothing to do with the published tree...).