mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Passing through ignoreMethodDoesntExist parameter in jasmine.js, 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)
This commit is contained in:
parent
7bda1ecab6
commit
99099e8838
4
thirdparty/jasmine-ajax/lib/spec-helper.js
vendored
4
thirdparty/jasmine-ajax/lib/spec-helper.js
vendored
@ -1,7 +1,7 @@
|
|||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
|
||||||
if (typeof jQuery != 'undefined') {
|
if (typeof jQuery != 'undefined') {
|
||||||
spyOn(jQuery.ajaxSettings, 'xhr').andCallFake(function() {
|
spyOn(jQuery.ajaxSettings, 'xhr', true).andCallFake(function() {
|
||||||
var newXhr = new FakeXMLHttpRequest();
|
var newXhr = new FakeXMLHttpRequest();
|
||||||
ajaxRequests.push(newXhr);
|
ajaxRequests.push(newXhr);
|
||||||
return newXhr;
|
return newXhr;
|
||||||
@ -9,7 +9,7 @@ beforeEach(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof Prototype != 'undefined') {
|
if (typeof Prototype != 'undefined') {
|
||||||
spyOn(Ajax, "getTransport").andCallFake(function() {
|
spyOn(Ajax, "getTransport", true).andCallFake(function() {
|
||||||
return new FakeXMLHttpRequest();
|
return new FakeXMLHttpRequest();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
4
thirdparty/jasmine/lib/jasmine.js
vendored
4
thirdparty/jasmine/lib/jasmine.js
vendored
@ -440,8 +440,8 @@ jasmine.log = function() {
|
|||||||
* @param methodName
|
* @param methodName
|
||||||
* @returns a Jasmine spy that can be chained with all spy methods
|
* @returns a Jasmine spy that can be chained with all spy methods
|
||||||
*/
|
*/
|
||||||
var spyOn = function(obj, methodName) {
|
var spyOn = function(obj, methodName, ignoreMethodDoesntExist) {
|
||||||
return jasmine.getEnv().currentSpec.spyOn(obj, methodName);
|
return jasmine.getEnv().currentSpec.spyOn(obj, methodName, ignoreMethodDoesntExist);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user