{"action":"created","issue":{"url":"https://api.github.com/repos/cjohansen/Sinon.JS/issues/643","labels_url":"https://api.github.com/repos/cjohansen/Sinon.JS/issues/643/labels{/name}","comments_url":"https://api.github.com/repos/cjohansen/Sinon.JS/issues/643/comments","events_url":"https://api.github.com/repos/cjohansen/Sinon.JS/issues/643/events","html_url":"https://github.com/cjohansen/Sinon.JS/issues/643","id":53482321,"number":643,"title":"Redefine stub behavior","user":{"login":"hurrymaplelad","id":1083040,"avatar_url":"https://avatars.githubusercontent.com/u/1083040?v=3","gravatar_id":"","url":"https://api.github.com/users/hurrymaplelad","html_url":"https://github.com/hurrymaplelad","followers_url":"https://api.github.com/users/hurrymaplelad/followers","following_url":"https://api.github.com/users/hurrymaplelad/following{/other_user}","gists_url":"https://api.github.com/users/hurrymaplelad/gists{/gist_id}","starred_url":"https://api.github.com/users/hurrymaplelad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hurrymaplelad/subscriptions","organizations_url":"https://api.github.com/users/hurrymaplelad/orgs","repos_url":"https://api.github.com/users/hurrymaplelad/repos","events_url":"https://api.github.com/users/hurrymaplelad/events{/privacy}","received_events_url":"https://api.github.com/users/hurrymaplelad/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-06T05:22:57Z","updated_at":"2015-01-06T21:43:26Z","closed_at":null,"body":"I sometimes like to enforce that at the suite level that included test must stub a behavior, like `$.ajax`.  With jasmine, I can \r\n\r\n    spyOn($, 'ajax').andCallFake(function() {throw new Error('...')})\r\n\r\nthen per spec\r\n\r\n    $.ajax.andReturn($.Deferred(...))\r\n\r\nI'd like to do the same with sinon:\r\n\r\n    before(function() {\r\n        sinon.stub($, 'ajax').throws(new Error('...'))\r\n    });\r\n\r\n    beforeEach(function() {\r\n        $.ajax.returns($.Deferred(...))\r\n    })\r\n\r\nBut the `returns` can't clobber the original `throws`.  Would you take a pull request to make this work?\r\n    });\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/cjohansen/Sinon.JS/issues/comments/68939243","html_url":"https://github.com/cjohansen/Sinon.JS/issues/643#issuecomment-68939243","issue_url":"https://api.github.com/repos/cjohansen/Sinon.JS/issues/643","id":68939243,"user":{"login":"mantoni","id":332271,"avatar_url":"https://avatars.githubusercontent.com/u/332271?v=3","gravatar_id":"","url":"https://api.github.com/users/mantoni","html_url":"https://github.com/mantoni","followers_url":"https://api.github.com/users/mantoni/followers","following_url":"https://api.github.com/users/mantoni/following{/other_user}","gists_url":"https://api.github.com/users/mantoni/gists{/gist_id}","starred_url":"https://api.github.com/users/mantoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mantoni/subscriptions","organizations_url":"https://api.github.com/users/mantoni/orgs","repos_url":"https://api.github.com/users/mantoni/repos","events_url":"https://api.github.com/users/mantoni/events{/privacy}","received_events_url":"https://api.github.com/users/mantoni/received_events","type":"User","site_admin":false},"created_at":"2015-01-06T21:43:26Z","updated_at":"2015-01-06T21:43:26Z","body":"Hm. There is `resetBehavior()`, a hidden \"feature\" of sorts. Would it make sense to use it in this case?"}}