jasmine-core 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/console/console.js +26 -2
  3. data/lib/jasmine-core.js +31 -23
  4. data/lib/jasmine-core/boot.js +1 -1
  5. data/lib/jasmine-core/boot/boot.js +1 -1
  6. data/lib/jasmine-core/example/node_example/spec/PlayerSpec.js +2 -2
  7. data/lib/jasmine-core/jasmine-html.js +16 -2
  8. data/lib/jasmine-core/jasmine.css +11 -10
  9. data/lib/jasmine-core/jasmine.js +709 -395
  10. data/lib/jasmine-core/json2.js +73 -62
  11. data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +39 -8
  12. data/lib/jasmine-core/spec/core/ClockSpec.js +19 -1
  13. data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +13 -0
  14. data/lib/jasmine-core/spec/core/EnvSpec.js +0 -63
  15. data/lib/jasmine-core/spec/core/ExpectationSpec.js +15 -53
  16. data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +37 -0
  17. data/lib/jasmine-core/spec/core/MockDateSpec.js +1 -0
  18. data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +8 -2
  19. data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +91 -66
  20. data/lib/jasmine-core/spec/core/SpecSpec.js +25 -26
  21. data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +55 -0
  22. data/lib/jasmine-core/spec/core/SpySpec.js +10 -0
  23. data/lib/jasmine-core/spec/core/SpyStrategySpec.js +13 -0
  24. data/lib/jasmine-core/spec/core/SuiteSpec.js +108 -10
  25. data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +34 -32
  26. data/lib/jasmine-core/spec/core/integration/EnvSpec.js +950 -35
  27. data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +279 -3
  28. data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +10 -1
  29. data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +5 -5
  30. data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +30 -2
  31. data/lib/jasmine-core/spec/node_suite.js +195 -0
  32. data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +104 -0
  33. data/lib/jasmine-core/version.rb +1 -1
  34. metadata +6 -3
@@ -1,14 +1,14 @@
1
1
  describe("Expectation", function() {
2
- it(".addMatchers makes matchers available to any expectation", function() {
2
+ it("makes custom matchers available to this expectation", function() {
3
3
  var matchers = {
4
4
  toFoo: function() {},
5
5
  toBar: function() {}
6
6
  },
7
7
  expectation;
8
8
 
9
- j$.Expectation.addMatchers(matchers);
10
-
11
- expectation = new j$.Expectation({});
9
+ expectation = new j$.Expectation({
10
+ customMatchers: matchers
11
+ });
12
12
 
13
13
  expect(expectation.toFoo).toBeDefined();
14
14
  expect(expectation.toBar).toBeDefined();
@@ -27,25 +27,6 @@ describe("Expectation", function() {
27
27
  expect(expectation.toQuux).toBeDefined();
28
28
  });
29
29
 
30
- it(".resetMatchers should keep only core matchers", function() {
31
- var matchers = {
32
- toFoo: function() {}
33
- },
34
- coreMatchers = {
35
- toQuux: function() {}
36
- },
37
- expectation;
38
-
39
- j$.Expectation.addCoreMatchers(coreMatchers);
40
- j$.Expectation.addMatchers(matchers);
41
- j$.Expectation.resetMatchers();
42
-
43
- expectation = new j$.Expectation({});
44
-
45
- expect(expectation.toQuux).toBeDefined();
46
- expect(expectation.toFoo).toBeUndefined();
47
- });
48
-
49
30
  it("Factory builds an expectation/negative expectation", function() {
50
31
  var builtExpectation = j$.Expectation.Factory();
51
32
 
@@ -65,10 +46,9 @@ describe("Expectation", function() {
65
46
  addExpectationResult = jasmine.createSpy("addExpectationResult"),
66
47
  expectation;
67
48
 
68
- j$.Expectation.addMatchers(matchers);
69
-
70
49
  expectation = new j$.Expectation({
71
50
  util: util,
51
+ customMatchers: matchers,
72
52
  customEqualityTesters: customEqualityTesters,
73
53
  actual: "an actual",
74
54
  addExpectationResult: addExpectationResult
@@ -94,10 +74,9 @@ describe("Expectation", function() {
94
74
  addExpectationResult = jasmine.createSpy("addExpectationResult"),
95
75
  expectation;
96
76
 
97
- j$.Expectation.addMatchers(matchers);
98
-
99
77
  expectation = new j$.Expectation({
100
78
  util: util,
79
+ customMatchers: matchers,
101
80
  actual: "an actual",
102
81
  addExpectationResult: addExpectationResult
103
82
  });
@@ -121,10 +100,8 @@ describe("Expectation", function() {
121
100
  addExpectationResult = jasmine.createSpy("addExpectationResult"),
122
101
  expectation;
123
102
 
124
- j$.Expectation.addMatchers(matchers);
125
-
126
103
  expectation = new j$.Expectation({
127
- matchers: matchers,
104
+ customMatchers: matchers,
128
105
  util: util,
129
106
  actual: "an actual",
130
107
  addExpectationResult: addExpectationResult
@@ -155,10 +132,8 @@ describe("Expectation", function() {
155
132
  addExpectationResult = jasmine.createSpy("addExpectationResult"),
156
133
  expectation;
157
134
 
158
- j$.Expectation.addMatchers(matchers);
159
-
160
135
  expectation = new j$.Expectation({
161
- matchers: matchers,
136
+ customMatchers: matchers,
162
137
  util: util,
163
138
  actual: "an actual",
164
139
  addExpectationResult: addExpectationResult
@@ -191,10 +166,9 @@ describe("Expectation", function() {
191
166
  addExpectationResult = jasmine.createSpy("addExpectationResult"),
192
167
  expectation;
193
168
 
194
- j$.Expectation.addMatchers(matchers);
195
-
196
169
  expectation = new j$.Expectation({
197
170
  actual: "an actual",
171
+ customMatchers: matchers,
198
172
  addExpectationResult: addExpectationResult
199
173
  });
200
174
 
@@ -225,10 +199,8 @@ describe("Expectation", function() {
225
199
  addExpectationResult = jasmine.createSpy("addExpectationResult"),
226
200
  expectation;
227
201
 
228
- j$.Expectation.addMatchers(matchers);
229
-
230
202
  expectation = new j$.Expectation({
231
- matchers: matchers,
203
+ customMatchers: matchers,
232
204
  actual: "an actual",
233
205
  addExpectationResult: addExpectationResult
234
206
  });
@@ -259,10 +231,8 @@ describe("Expectation", function() {
259
231
  actual = "an actual",
260
232
  expectation;
261
233
 
262
- j$.Expectation.addMatchers(matchers);
263
-
264
234
  expectation = new j$.Expectation({
265
- matchers: matchers,
235
+ customMatchers: matchers,
266
236
  actual: "an actual",
267
237
  addExpectationResult: addExpectationResult,
268
238
  isNot: true
@@ -294,10 +264,8 @@ describe("Expectation", function() {
294
264
  actual = "an actual",
295
265
  expectation;
296
266
 
297
- j$.Expectation.addMatchers(matchers);
298
-
299
267
  expectation = new j$.Expectation({
300
- matchers: matchers,
268
+ customMatchers: matchers,
301
269
  actual: "an actual",
302
270
  util: util,
303
271
  addExpectationResult: addExpectationResult,
@@ -332,10 +300,8 @@ describe("Expectation", function() {
332
300
  actual = "an actual",
333
301
  expectation;
334
302
 
335
- j$.Expectation.addMatchers(matchers);
336
-
337
303
  expectation = new j$.Expectation({
338
- matchers: matchers,
304
+ customMatchers: matchers,
339
305
  actual: "an actual",
340
306
  addExpectationResult: addExpectationResult,
341
307
  isNot: true
@@ -365,10 +331,8 @@ describe("Expectation", function() {
365
331
  actual = "an actual",
366
332
  expectation;
367
333
 
368
- j$.Expectation.addMatchers(matchers);
369
-
370
334
  expectation = new j$.Expectation({
371
- matchers: matchers,
335
+ customMatchers: matchers,
372
336
  actual: "an actual",
373
337
  addExpectationResult: addExpectationResult,
374
338
  isNot: true
@@ -403,10 +367,8 @@ describe("Expectation", function() {
403
367
  actual = "an actual",
404
368
  expectation;
405
369
 
406
- j$.Expectation.addMatchers(matchers);
407
-
408
370
  expectation = new j$.Expectation({
409
- matchers: matchers,
371
+ customMatchers: matchers,
410
372
  actual: "an actual",
411
373
  addExpectationResult: addExpectationResult,
412
374
  isNot: true
@@ -178,6 +178,43 @@ describe("JsApiReporter", function() {
178
178
  });
179
179
  });
180
180
 
181
+ describe("#suiteResults", function(){
182
+ var reporter, suiteResult1, suiteResult2;
183
+ beforeEach(function() {
184
+ reporter = new j$.JsApiReporter({});
185
+ suiteStarted1 = {
186
+ id: 1
187
+ };
188
+ suiteResult1 = {
189
+ id: 1,
190
+ status: 'failed',
191
+ failedExpectations: [{ message: 'My After All Exception' }]
192
+ };
193
+ suiteResult2 = {
194
+ id: 2,
195
+ status: 'finished'
196
+ };
197
+
198
+ reporter.suiteStarted(suiteStarted1);
199
+ reporter.suiteDone(suiteResult1);
200
+ reporter.suiteDone(suiteResult2);
201
+ });
202
+
203
+ it('should not include suite starts', function(){
204
+ expect(reporter.suiteResults(0,3).length).toEqual(2);
205
+ });
206
+
207
+ it("should return a slice of results", function() {
208
+ expect(reporter.suiteResults(0, 1)).toEqual([suiteResult1]);
209
+ expect(reporter.suiteResults(1, 1)).toEqual([suiteResult2]);
210
+ });
211
+
212
+ it("returns nothing for out of bounds indicies", function() {
213
+ expect(reporter.suiteResults(0, 3)).toEqual([suiteResult1, suiteResult2]);
214
+ expect(reporter.suiteResults(2, 3)).toEqual([]);
215
+ });
216
+ });
217
+
181
218
  describe("#executionTime", function() {
182
219
  it("should start the timer when jasmine starts", function() {
183
220
  var timerSpy = jasmine.createSpyObj('timer', ['start', 'elapsed']),
@@ -75,6 +75,7 @@ describe("FakeDate", function() {
75
75
 
76
76
  mockDate.install();
77
77
  expect(new fakeGlobal.Date()).toEqual(jasmine.any(Date));
78
+ expect(new fakeGlobal.Date() instanceof fakeGlobal.Date).toBe(true);
78
79
  });
79
80
 
80
81
  it("fakes current time when using Date.now()", function() {
@@ -26,6 +26,11 @@ describe("j$.pp", function () {
26
26
  expect(j$.pp(array1)).toEqual("[ 1, 2, [ <circular reference: Array> ] ]");
27
27
  });
28
28
 
29
+ it("should not indicate circular references incorrectly", function() {
30
+ var array = [ [1] ];
31
+ expect(j$.pp(array)).toEqual("[ [ 1 ] ]");
32
+ });
33
+
29
34
  it("should stringify objects properly", function() {
30
35
  expect(j$.pp({foo: 'bar'})).toEqual("{ foo: 'bar' }");
31
36
  expect(j$.pp({foo:'bar', baz:3, nullValue: null, undefinedValue: jasmine.undefined})).toEqual("{ foo: 'bar', baz: 3, nullValue: null, undefinedValue: undefined }");
@@ -130,7 +135,9 @@ describe("j$.pp", function () {
130
135
  },
131
136
  env = new j$.Env();
132
137
 
133
- env.spyOn(TestObject, 'someFunction');
138
+ var spyRegistry = new j$.SpyRegistry({currentSpies: function() {return [];}});
139
+
140
+ spyRegistry.spyOn(TestObject, 'someFunction');
134
141
  expect(j$.pp(TestObject.someFunction)).toEqual("spy on someFunction");
135
142
 
136
143
  expect(j$.pp(j$.createSpy("something"))).toEqual("spy on something");
@@ -153,4 +160,3 @@ describe("j$.pp", function () {
153
160
  expect(j$.pp(obj)).toEqual("{ foo: 'bar' }");
154
161
  });
155
162
  });
156
-
@@ -2,15 +2,15 @@ describe("QueueRunner", function() {
2
2
 
3
3
  it("runs all the functions it's passed", function() {
4
4
  var calls = [],
5
- fn1 = jasmine.createSpy('fn1'),
6
- fn2 = jasmine.createSpy('fn2'),
5
+ queueableFn1 = { fn: jasmine.createSpy('fn1') },
6
+ queueableFn2 = { fn: jasmine.createSpy('fn2') },
7
7
  queueRunner = new j$.QueueRunner({
8
- fns: [fn1, fn2]
8
+ queueableFns: [queueableFn1, queueableFn2]
9
9
  });
10
- fn1.and.callFake(function() {
10
+ queueableFn1.fn.and.callFake(function() {
11
11
  calls.push('fn1');
12
12
  });
13
- fn2.and.callFake(function() {
13
+ queueableFn2.fn.and.callFake(function() {
14
14
  calls.push('fn2');
15
15
  });
16
16
 
@@ -20,19 +20,19 @@ describe("QueueRunner", function() {
20
20
  });
21
21
 
22
22
  it("calls each function with a consistent 'this'-- an empty object", function() {
23
- var fn1 = jasmine.createSpy('fn1'),
24
- fn2 = jasmine.createSpy('fn2'),
25
- fn3 = function(done) { asyncContext = this; done(); },
23
+ var queueableFn1 = { fn: jasmine.createSpy('fn1') },
24
+ queueableFn2 = { fn: jasmine.createSpy('fn2') },
25
+ queueableFn3 = { fn: function(done) { asyncContext = this; done(); } },
26
26
  queueRunner = new j$.QueueRunner({
27
- fns: [fn1, fn2, fn3]
27
+ queueableFns: [queueableFn1, queueableFn2, queueableFn3]
28
28
  }),
29
29
  asyncContext;
30
30
 
31
31
  queueRunner.execute();
32
32
 
33
- var context = fn1.calls.first().object;
33
+ var context = queueableFn1.fn.calls.first().object;
34
34
  expect(context).toEqual({});
35
- expect(fn2.calls.first().object).toBe(context);
35
+ expect(queueableFn2.fn.calls.first().object).toBe(context);
36
36
  expect(asyncContext).toBe(context);
37
37
  });
38
38
 
@@ -53,20 +53,20 @@ describe("QueueRunner", function() {
53
53
  beforeCallback = jasmine.createSpy('beforeCallback'),
54
54
  fnCallback = jasmine.createSpy('fnCallback'),
55
55
  afterCallback = jasmine.createSpy('afterCallback'),
56
- fn1 = function(done) {
56
+ queueableFn1 = { fn: function(done) {
57
57
  beforeCallback();
58
58
  setTimeout(done, 100);
59
- },
60
- fn2 = function(done) {
59
+ } },
60
+ queueableFn2 = { fn: function(done) {
61
61
  fnCallback();
62
62
  setTimeout(done, 100);
63
- },
64
- fn3 = function(done) {
63
+ } },
64
+ queueableFn3 = { fn: function(done) {
65
65
  afterCallback();
66
66
  setTimeout(done, 100);
67
- },
67
+ } },
68
68
  queueRunner = new j$.QueueRunner({
69
- fns: [fn1, fn2, fn3],
69
+ queueableFns: [queueableFn1, queueableFn2, queueableFn3],
70
70
  onComplete: onComplete
71
71
  });
72
72
 
@@ -93,55 +93,77 @@ describe("QueueRunner", function() {
93
93
  expect(onComplete).toHaveBeenCalled();
94
94
  });
95
95
 
96
+ it("explicitly fails an async function with a provided fail function and moves to the next function", function() {
97
+ var queueableFn1 = { fn: function(done) {
98
+ setTimeout(function() { done.fail('foo'); }, 100);
99
+ } },
100
+ queueableFn2 = { fn: jasmine.createSpy('fn2') },
101
+ failFn = jasmine.createSpy('fail'),
102
+ queueRunner = new j$.QueueRunner({
103
+ queueableFns: [queueableFn1, queueableFn2],
104
+ fail: failFn
105
+ });
106
+
107
+ queueRunner.execute();
108
+
109
+ expect(failFn).not.toHaveBeenCalled();
110
+ expect(queueableFn2.fn).not.toHaveBeenCalled();
111
+
112
+ jasmine.clock().tick(100);
113
+
114
+ expect(failFn).toHaveBeenCalledWith('foo');
115
+ expect(queueableFn2.fn).toHaveBeenCalled();
116
+ });
117
+
96
118
  it("sets a timeout if requested for asynchronous functions so they don't go on forever", function() {
97
- var beforeFn = function(done) { },
98
- fn = jasmine.createSpy('fn'),
119
+ var timeout = 3,
120
+ beforeFn = { fn: function(done) { }, type: 'before', timeout: function() { return timeout; } },
121
+ queueableFn = { fn: jasmine.createSpy('fn'), type: 'queueable' },
99
122
  onComplete = jasmine.createSpy('onComplete'),
100
123
  onException = jasmine.createSpy('onException'),
101
124
  queueRunner = new j$.QueueRunner({
102
- fns: [beforeFn, fn],
125
+ queueableFns: [beforeFn, queueableFn],
103
126
  onComplete: onComplete,
104
- onException: onException,
105
- enforceTimeout: function() { return true; }
127
+ onException: onException
106
128
  });
107
129
 
108
130
  queueRunner.execute();
109
- expect(fn).not.toHaveBeenCalled();
131
+ expect(queueableFn.fn).not.toHaveBeenCalled();
110
132
 
111
- jasmine.clock().tick(j$.DEFAULT_TIMEOUT_INTERVAL);
133
+ jasmine.clock().tick(timeout);
112
134
 
113
135
  expect(onException).toHaveBeenCalledWith(jasmine.any(Error));
114
- expect(fn).toHaveBeenCalled();
136
+ expect(queueableFn.fn).toHaveBeenCalled();
115
137
  expect(onComplete).toHaveBeenCalled();
116
138
  });
117
139
 
118
140
  it("by default does not set a timeout for asynchronous functions", function() {
119
- var beforeFn = function(done) { },
120
- fn = jasmine.createSpy('fn'),
141
+ var beforeFn = { fn: function(done) { } },
142
+ queueableFn = { fn: jasmine.createSpy('fn') },
121
143
  onComplete = jasmine.createSpy('onComplete'),
122
144
  onException = jasmine.createSpy('onException'),
123
145
  queueRunner = new j$.QueueRunner({
124
- fns: [beforeFn, fn],
146
+ queueableFns: [beforeFn, queueableFn],
125
147
  onComplete: onComplete,
126
148
  onException: onException,
127
149
  });
128
150
 
129
151
  queueRunner.execute();
130
- expect(fn).not.toHaveBeenCalled();
152
+ expect(queueableFn.fn).not.toHaveBeenCalled();
131
153
 
132
154
  jasmine.clock().tick(j$.DEFAULT_TIMEOUT_INTERVAL);
133
155
 
134
156
  expect(onException).not.toHaveBeenCalled();
135
- expect(fn).not.toHaveBeenCalled();
157
+ expect(queueableFn.fn).not.toHaveBeenCalled();
136
158
  expect(onComplete).not.toHaveBeenCalled();
137
159
  });
138
160
 
139
- it("clears the timeout when an async function throws an exception, to prevent additional onException calls", function() {
140
- var fn = function(done) { throw new Error("error!"); },
161
+ it("clears the timeout when an async function throws an exception, to prevent additional exception reporting", function() {
162
+ var queueableFn = { fn: function(done) { throw new Error("error!"); } },
141
163
  onComplete = jasmine.createSpy('onComplete'),
142
164
  onException = jasmine.createSpy('onException'),
143
165
  queueRunner = new j$.QueueRunner({
144
- fns: [fn],
166
+ queueableFns: [queueableFn],
145
167
  onComplete: onComplete,
146
168
  onException: onException
147
169
  });
@@ -156,11 +178,11 @@ describe("QueueRunner", function() {
156
178
  });
157
179
 
158
180
  it("clears the timeout when the done callback is called", function() {
159
- var fn = function(done) { done(); },
181
+ var queueableFn = { fn: function(done) { done(); } },
160
182
  onComplete = jasmine.createSpy('onComplete'),
161
183
  onException = jasmine.createSpy('onException'),
162
184
  queueRunner = new j$.QueueRunner({
163
- fns: [fn],
185
+ queueableFns: [queueableFn],
164
186
  onComplete: onComplete,
165
187
  onException: onException
166
188
  });
@@ -174,75 +196,78 @@ describe("QueueRunner", function() {
174
196
  });
175
197
 
176
198
  it("only moves to the next spec the first time you call done", function() {
177
- var fn = function(done) {done(); done();},
178
- nextFn = jasmine.createSpy('nextFn');
199
+ var queueableFn = { fn: function(done) {done(); done();} },
200
+ nextQueueableFn = { fn: jasmine.createSpy('nextFn') };
179
201
  queueRunner = new j$.QueueRunner({
180
- fns: [fn, nextFn]
202
+ queueableFns: [queueableFn, nextQueueableFn]
181
203
  });
182
204
 
183
205
  queueRunner.execute();
184
- expect(nextFn.calls.count()).toEqual(1);
206
+ expect(nextQueueableFn.fn.calls.count()).toEqual(1);
185
207
  });
186
208
 
187
209
  it("does not move to the next spec if done is called after an exception has ended the spec", function() {
188
- var fn = function(done) {
210
+ var queueableFn = { fn: function(done) {
189
211
  setTimeout(done, 1);
190
212
  throw new Error('error!');
191
- },
192
- nextFn = jasmine.createSpy('nextFn');
213
+ } },
214
+ nextQueueableFn = { fn: jasmine.createSpy('nextFn') };
193
215
  queueRunner = new j$.QueueRunner({
194
- fns: [fn, nextFn]
216
+ queueableFns: [queueableFn, nextQueueableFn]
195
217
  });
196
218
 
197
219
  queueRunner.execute();
198
220
  jasmine.clock().tick(1);
199
- expect(nextFn.calls.count()).toEqual(1);
221
+ expect(nextQueueableFn.fn.calls.count()).toEqual(1);
200
222
  });
201
223
  });
202
224
 
203
- it("calls an exception handler when an exception is thrown in a fn", function() {
204
- var fn = function() {
225
+ it("calls exception handlers when an exception is thrown in a fn", function() {
226
+ var queueableFn = { type: 'queueable',
227
+ fn: function() {
205
228
  throw new Error('fake error');
206
- },
207
- exceptionCallback = jasmine.createSpy('exception callback'),
229
+ } },
230
+ onExceptionCallback = jasmine.createSpy('on exception callback'),
208
231
  queueRunner = new j$.QueueRunner({
209
- fns: [fn],
210
- onException: exceptionCallback
232
+ queueableFns: [queueableFn],
233
+ onException: onExceptionCallback
211
234
  });
212
235
 
213
236
  queueRunner.execute();
214
237
 
215
- expect(exceptionCallback).toHaveBeenCalledWith(jasmine.any(Error));
238
+ expect(onExceptionCallback).toHaveBeenCalledWith(jasmine.any(Error));
216
239
  });
217
240
 
218
241
  it("rethrows an exception if told to", function() {
219
- var fn = function() {
242
+ var queueableFn = { fn: function() {
220
243
  throw new Error('fake error');
221
- },
244
+ } },
222
245
  queueRunner = new j$.QueueRunner({
223
- fns: [fn],
246
+ queueableFns: [queueableFn],
224
247
  catchException: function(e) { return false; }
225
248
  });
226
249
 
227
- expect(queueRunner.execute).toThrow();
250
+ expect(function() {
251
+ queueRunner.execute();
252
+ }).toThrowError('fake error');
228
253
  });
229
254
 
230
255
  it("continues running the functions even after an exception is thrown in an async spec", function() {
231
- var fn = function(done) { throw new Error("error"); },
232
- nextFn = jasmine.createSpy("nextFunction"),
256
+ var queueableFn = { fn: function(done) { throw new Error("error"); } },
257
+ nextQueueableFn = { fn: jasmine.createSpy("nextFunction") },
233
258
  queueRunner = new j$.QueueRunner({
234
- fns: [fn, nextFn]
259
+ queueableFns: [queueableFn, nextQueueableFn]
235
260
  });
236
261
 
237
262
  queueRunner.execute();
238
- expect(nextFn).toHaveBeenCalled();
263
+ expect(nextQueueableFn.fn).toHaveBeenCalled();
239
264
  });
240
265
 
241
266
  it("calls a provided complete callback when done", function() {
242
- var fn = jasmine.createSpy('fn'),
267
+ var queueableFn = { fn: jasmine.createSpy('fn') },
243
268
  completeCallback = jasmine.createSpy('completeCallback'),
244
269
  queueRunner = new j$.QueueRunner({
245
- fns: [fn],
270
+ queueableFns: [queueableFn],
246
271
  onComplete: completeCallback
247
272
  });
248
273
 
@@ -252,12 +277,12 @@ describe("QueueRunner", function() {
252
277
  });
253
278
 
254
279
  it("calls a provided stack clearing function when done", function() {
255
- var asyncFn = function(done) { done() },
256
- afterFn = jasmine.createSpy('afterFn'),
280
+ var asyncFn = { fn: function(done) { done() } },
281
+ afterFn = { fn: jasmine.createSpy('afterFn') },
257
282
  completeCallback = jasmine.createSpy('completeCallback'),
258
283
  clearStack = jasmine.createSpy('clearStack'),
259
284
  queueRunner = new j$.QueueRunner({
260
- fns: [asyncFn, afterFn],
285
+ queueableFns: [asyncFn, afterFn],
261
286
  clearStack: clearStack,
262
287
  onComplete: completeCallback
263
288
  });
@@ -265,7 +290,7 @@ describe("QueueRunner", function() {
265
290
  clearStack.and.callFake(function(fn) { fn(); });
266
291
 
267
292
  queueRunner.execute();
268
- expect(afterFn).toHaveBeenCalled();
293
+ expect(afterFn.fn).toHaveBeenCalled();
269
294
  expect(clearStack).toHaveBeenCalledWith(completeCallback);
270
295
  });
271
296
  });