Skip to content

Commit

Permalink
Check that spy.proxy is an actual spy before use
Browse files Browse the repository at this point in the history
This prevents problems when the object spied upon has a `proxy` method that isn't a spy.  For example, controllers from Spine.js.
  • Loading branch information
mikelovesrobots authored and domenic committed Jan 9, 2013
1 parent 6e8b56a commit 3d819a6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/sinon-chai.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
function getMessages(spy, action, nonNegatedSuffix, always, args) {
var verbPhrase = always ? "always have " : "have ";
nonNegatedSuffix = nonNegatedSuffix || "";
spy = spy.proxy || spy;
if (isSpy(spy.proxy)) {
spy = spy.proxy;
}

function printfArray(array) {
return spy.printf.apply(spy, array);
Expand Down

0 comments on commit 3d819a6

Please sign in to comment.