diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 51b31d90..b272a740 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -4958,7 +4958,7 @@ getJasmineRequireObj().interface = function(jasmine, env) { * @param {Function} factory - Factory function that returns the plan to be executed. */ jasmine.addSpyStrategy = function(name, factory) { - return env.addSpyStrategy(identifier, factory); + return env.addSpyStrategy(name, factory); }; return jasmineInterface; diff --git a/spec/core/SpyRegistrySpec.js b/spec/core/SpyRegistrySpec.js index 80eac687..92939f83 100644 --- a/spec/core/SpyRegistrySpec.js +++ b/spec/core/SpyRegistrySpec.js @@ -304,6 +304,7 @@ describe("SpyRegistry", function() { global = new FakeWindow(), spyRegistry = new jasmineUnderTest.SpyRegistry({ currentSpies: function() { return spies; }, + createSpy: createSpy, global: global }); diff --git a/spec/html/SpyRegistryHtmlSpec.js b/spec/html/SpyRegistryHtmlSpec.js index fd9a81fb..c51308b8 100644 --- a/spec/html/SpyRegistryHtmlSpec.js +++ b/spec/html/SpyRegistryHtmlSpec.js @@ -1,12 +1,17 @@ describe('Spy Registry browser-specific behavior', function() { + function createSpy(name, originalFn) { + return jasmineUnderTest.Spy(name, originalFn); + } + it('can spy on and unspy window.onerror', function() { requireWriteableOnerror(); var spies = [], spyRegistry = new jasmineUnderTest.SpyRegistry({ - currentSpies: function() { return spies; }, - global: window - }), + currentSpies: function() { return spies; }, + createSpy: createSpy, + global: window + }), originalHandler = window.onerror; try { diff --git a/src/core/requireInterface.js b/src/core/requireInterface.js index 52505ecd..62a5f073 100644 --- a/src/core/requireInterface.js +++ b/src/core/requireInterface.js @@ -290,7 +290,7 @@ getJasmineRequireObj().interface = function(jasmine, env) { * @param {Function} factory - Factory function that returns the plan to be executed. */ jasmine.addSpyStrategy = function(name, factory) { - return env.addSpyStrategy(identifier, factory); + return env.addSpyStrategy(name, factory); }; return jasmineInterface;