-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for sinon sandboxes #15
Comments
@jniemin it should work... actually I always use sandbox. |
Here is complete the example @gaguirre. I'm using Mocha 3.2.0, sinon 2.1.0, and sinon-mongoose 1.3.0 roles.js
roles.spec.js
|
You're missing the sandbox creation. It should be
Tell me if it works! |
Ah, copy paste error, when I removed some of the business names etc. So sandbox.create() is in the actual test code. So still no luck |
Weird. There is a test using sandbox (https://github.com/underscopeio/sinon-mongoose/blob/master/test/index.js#L116). |
Seems that if I ran sinon-mongoose tests from master there it works. I wonder could it be sinon-mongoose using older versions of sinon (1.17.7) and mocha (2.5.3)? I'm running on my own project sinon 2.1.0 and mocha 3.2.0. |
Maybe... Could you try upgrading sinon for the tests and see if it fails. |
It definitely was then new version of Sinon that made the tests break. I created PR to add support for Sinon 2. |
Actual implementation was not totally proper. There is now new PR to fix that |
Seems that if creating mock through sandbox, the chainable is not assigned.
This example fails with error:
TypeError: Mock.expects(...).chain is not a function
Using sandbox is more convenient as you can easily just create as many mocks you like and then do
sandbox.restore
which will restore all mocks rather than restoring each mock separately.The text was updated successfully, but these errors were encountered: