Permalink
Browse files

BUGFIX Passing through ignoreMethodDoesntExist parameter in jasmine.j…

…s, so we can use it in jasmine-ajax and avoid "xhr has already been spied upon" errors when executing tests through JSTestDriver (submitted patch to both projects)
  • Loading branch information...
1 parent 7bda1ec commit 99099e88382ad22cffd9038058bdf82da6cb99fb @chillu chillu committed Mar 9, 2011
Showing with 4 additions and 4 deletions.
  1. +2 −2 thirdparty/jasmine-ajax/lib/spec-helper.js
  2. +2 −2 thirdparty/jasmine/lib/jasmine.js
@@ -1,15 +1,15 @@
beforeEach(function() {
if (typeof jQuery != 'undefined') {
- spyOn(jQuery.ajaxSettings, 'xhr').andCallFake(function() {
+ spyOn(jQuery.ajaxSettings, 'xhr', true).andCallFake(function() {
var newXhr = new FakeXMLHttpRequest();
ajaxRequests.push(newXhr);
return newXhr;
});
}
if (typeof Prototype != 'undefined') {
- spyOn(Ajax, "getTransport").andCallFake(function() {
+ spyOn(Ajax, "getTransport", true).andCallFake(function() {
return new FakeXMLHttpRequest();
});
}
@@ -440,8 +440,8 @@ jasmine.log = function() {
* @param methodName
* @returns a Jasmine spy that can be chained with all spy methods
*/
-var spyOn = function(obj, methodName) {
- return jasmine.getEnv().currentSpec.spyOn(obj, methodName);
+var spyOn = function(obj, methodName, ignoreMethodDoesntExist) {
+ return jasmine.getEnv().currentSpec.spyOn(obj, methodName, ignoreMethodDoesntExist);
};
/**

0 comments on commit 99099e8

Please sign in to comment.