From 170a6dce760f545a86df1667b10d8f42feae02e8 Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Wed, 10 Jan 2018 09:00:09 -0800 Subject: [PATCH] Made naming somewhat less confusing --- spec/core/SpyStrategySpec.js | 12 +++---- .../integration/CustomSpyStrategiesSpec.js | 36 +++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/spec/core/SpyStrategySpec.js b/spec/core/SpyStrategySpec.js index eed14801..10e4f583 100644 --- a/spec/core/SpyStrategySpec.js +++ b/spec/core/SpyStrategySpec.js @@ -111,23 +111,23 @@ describe("SpyStrategy", function() { }); it("allows a custom strategy to be used", function() { - var customStrategy = jasmine.createSpy('custom strategy') + var plan = jasmine.createSpy('custom strategy') .and.returnValue('custom strategy result'), - factory = jasmine.createSpy('custom strategy factory') - .and.returnValue(customStrategy), + customStrategy = jasmine.createSpy('custom strategy') + .and.returnValue(plan), originalFn = jasmine.createSpy('original'), spyStrategy = new jasmineUnderTest.SpyStrategy({ fn: originalFn, customStrategies: { - doSomething: factory + doSomething: customStrategy } }); spyStrategy.doSomething(1, 2, 3); - expect(factory).toHaveBeenCalledWith(1, 2, 3); + expect(customStrategy).toHaveBeenCalledWith(1, 2, 3); expect(spyStrategy.exec(null, ['some', 'args'])) .toEqual('custom strategy result'); - expect(customStrategy).toHaveBeenCalledWith('some', 'args'); + expect(plan).toHaveBeenCalledWith('some', 'args'); }); it("throws an error if a custom strategy doesn't return a function", function() { diff --git a/spec/core/integration/CustomSpyStrategiesSpec.js b/spec/core/integration/CustomSpyStrategiesSpec.js index dbfb76ed..59e3b380 100644 --- a/spec/core/integration/CustomSpyStrategiesSpec.js +++ b/spec/core/integration/CustomSpyStrategiesSpec.js @@ -7,21 +7,21 @@ describe('Custom Spy Strategies (Integration)', function() { }); it('allows adding more strategies local to a suite', function(done) { - var strategyInstance = jasmine.createSpy('custom strategy instance') + var plan = jasmine.createSpy('custom strategy plan') .and.returnValue(42); - var strategyFactory = jasmine.createSpy('custom strategy factory') - .and.returnValue(strategyInstance); + var strategy = jasmine.createSpy('custom strategy') + .and.returnValue(plan); env.describe('suite defining a custom spy strategy', function() { env.beforeEach(function() { - env.addSpyStrategy('frobnicate', strategyFactory); + env.addSpyStrategy('frobnicate', strategy); }); env.it('spec in the suite', function() { var spy = env.createSpy('something').and.frobnicate(17); expect(spy(1, 2, 3)).toEqual(42); - expect(strategyFactory).toHaveBeenCalledWith(17); - expect(strategyInstance).toHaveBeenCalledWith(1, 2, 3); + expect(strategy).toHaveBeenCalledWith(17); + expect(plan).toHaveBeenCalledWith(1, 2, 3); }); }); @@ -39,17 +39,17 @@ describe('Custom Spy Strategies (Integration)', function() { }); it('allows adding more strategies local to a spec', function(done) { - var strategyInstance = jasmine.createSpy('custom strategy instance') + var plan = jasmine.createSpy('custom strategy plan') .and.returnValue(42); - var strategyFactory = jasmine.createSpy('custom strategy factory') - .and.returnValue(strategyInstance); + var strategy = jasmine.createSpy('custom strategy') + .and.returnValue(plan); env.it('spec defining a custom spy strategy', function() { - env.addSpyStrategy('frobnicate', strategyFactory); + env.addSpyStrategy('frobnicate', strategy); var spy = env.createSpy('something').and.frobnicate(17); expect(spy(1, 2, 3)).toEqual(42); - expect(strategyFactory).toHaveBeenCalledWith(17); - expect(strategyInstance).toHaveBeenCalledWith(1, 2, 3); + expect(strategy).toHaveBeenCalledWith(17); + expect(plan).toHaveBeenCalledWith(1, 2, 3); }); env.it('spec without custom strategy defined', function() { @@ -66,21 +66,21 @@ describe('Custom Spy Strategies (Integration)', function() { }); it('allows using custom strategies on a per-argument basis', function(done) { - var strategyInstance = jasmine.createSpy('custom strategy instance') + var plan = jasmine.createSpy('custom strategy plan') .and.returnValue(42); - var strategyFactory = jasmine.createSpy('custom strategy factory') - .and.returnValue(strategyInstance); + var strategy = jasmine.createSpy('custom strategy') + .and.returnValue(plan); env.it('spec defining a custom spy strategy', function() { - env.addSpyStrategy('frobnicate', strategyFactory); + env.addSpyStrategy('frobnicate', strategy); var spy = env.createSpy('something') .and.returnValue('no args return') .withArgs(1, 2, 3).and.frobnicate(17); expect(spy()).toEqual('no args return'); - expect(strategyInstance).not.toHaveBeenCalled(); + expect(plan).not.toHaveBeenCalled(); expect(spy(1, 2, 3)).toEqual(42); - expect(strategyInstance).toHaveBeenCalledWith(1, 2, 3); + expect(plan).toHaveBeenCalledWith(1, 2, 3); }); env.it('spec without custom strategy defined', function() {