jasmine-core 2.4.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/lib/console/console.js +1 -1
  3. data/lib/jasmine-core/boot.js +1 -1
  4. data/lib/jasmine-core/jasmine-html.js +15 -7
  5. data/lib/jasmine-core/jasmine.js +261 -82
  6. data/lib/jasmine-core/node_boot.js +1 -1
  7. data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +16 -16
  8. data/lib/jasmine-core/spec/core/CallTrackerSpec.js +26 -11
  9. data/lib/jasmine-core/spec/core/ClockSpec.js +61 -42
  10. data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +28 -15
  11. data/lib/jasmine-core/spec/core/EnvSpec.js +8 -8
  12. data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +6 -6
  13. data/lib/jasmine-core/spec/core/ExceptionsSpec.js +1 -1
  14. data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +8 -8
  15. data/lib/jasmine-core/spec/core/ExpectationSpec.js +17 -17
  16. data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +14 -14
  17. data/lib/jasmine-core/spec/core/MockDateSpec.js +14 -14
  18. data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +65 -56
  19. data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +32 -18
  20. data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +27 -3
  21. data/lib/jasmine-core/spec/core/SpecSpec.js +37 -37
  22. data/lib/jasmine-core/spec/core/SpyRegistrySpec.js +46 -7
  23. data/lib/jasmine-core/spec/core/SpySpec.js +11 -11
  24. data/lib/jasmine-core/spec/core/SpyStrategySpec.js +25 -13
  25. data/lib/jasmine-core/spec/core/SuiteSpec.js +25 -25
  26. data/lib/jasmine-core/spec/core/TimerSpec.js +2 -2
  27. data/lib/jasmine-core/spec/core/TreeProcessorSpec.js +26 -26
  28. data/lib/jasmine-core/spec/core/UtilSpec.js +12 -12
  29. data/lib/jasmine-core/spec/core/asymmetric_equality/AnySpec.js +8 -8
  30. data/lib/jasmine-core/spec/core/asymmetric_equality/AnythingSpec.js +7 -7
  31. data/lib/jasmine-core/spec/core/asymmetric_equality/ArrayContainingSpec.js +6 -6
  32. data/lib/jasmine-core/spec/core/asymmetric_equality/ObjectContainingSpec.js +11 -11
  33. data/lib/jasmine-core/spec/core/asymmetric_equality/StringMatchingSpec.js +4 -4
  34. data/lib/jasmine-core/spec/core/formatErrorMsgSpec.js +13 -0
  35. data/lib/jasmine-core/spec/core/integration/CustomMatchersSpec.js +2 -2
  36. data/lib/jasmine-core/spec/core/integration/EnvSpec.js +195 -76
  37. data/lib/jasmine-core/spec/core/integration/SpecRunningSpec.js +20 -21
  38. data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +164 -114
  39. data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +4 -4
  40. data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +2 -2
  41. data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +2 -2
  42. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanOrEqualSpec.js +29 -0
  43. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +2 -2
  44. data/lib/jasmine-core/spec/core/matchers/toBeLessThanOrEqualSpec.js +29 -0
  45. data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +2 -2
  46. data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +3 -3
  47. data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +2 -2
  48. data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +2 -2
  49. data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +2 -2
  50. data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +2 -2
  51. data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +4 -4
  52. data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +2 -2
  53. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +11 -11
  54. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledTimesSpec.js +22 -17
  55. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +11 -10
  56. data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +7 -6
  57. data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +24 -24
  58. data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +9 -8
  59. data/lib/jasmine-core/spec/helpers/defineJasmineUnderTest.js +3 -3
  60. data/lib/jasmine-core/spec/helpers/nodeDefineJasmineUnderTest.js +5 -5
  61. data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +95 -59
  62. data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +3 -3
  63. data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +1 -1
  64. data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +4 -4
  65. data/lib/jasmine-core/spec/html/QueryStringSpec.js +5 -5
  66. data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +4 -4
  67. data/lib/jasmine-core/spec/npmPackage/npmPackageSpec.js +2 -2
  68. data/lib/jasmine-core/spec/performance/large_object_test.js +1 -1
  69. data/lib/jasmine-core/version.rb +1 -1
  70. metadata +5 -3
  71. data/lib/jasmine-core/spec/node_suite.js +0 -195
@@ -1,7 +1,7 @@
1
1
  describe("FakeDate", function() {
2
2
  it("does not fail if no global date is found", function() {
3
3
  var fakeGlobal = {},
4
- mockDate = new j$.MockDate(fakeGlobal);
4
+ mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
5
5
 
6
6
  expect(function() {
7
7
  mockDate.install();
@@ -17,7 +17,7 @@ describe("FakeDate", function() {
17
17
  }
18
18
  }),
19
19
  fakeGlobal = { Date: globalDate },
20
- mockDate = new j$.MockDate(fakeGlobal);
20
+ mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
21
21
 
22
22
  expect(fakeGlobal.Date).toEqual(globalDate);
23
23
  mockDate.install();
@@ -32,7 +32,7 @@ describe("FakeDate", function() {
32
32
  }
33
33
  }),
34
34
  fakeGlobal = { Date: globalDate },
35
- mockDate = new j$.MockDate(fakeGlobal);
35
+ mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
36
36
 
37
37
  mockDate.install();
38
38
  mockDate.uninstall();
@@ -49,7 +49,7 @@ describe("FakeDate", function() {
49
49
  }
50
50
  }),
51
51
  fakeGlobal = { Date: globalDate },
52
- mockDate = new j$.MockDate(fakeGlobal);
52
+ mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
53
53
 
54
54
  mockDate.install();
55
55
 
@@ -60,7 +60,7 @@ describe("FakeDate", function() {
60
60
 
61
61
  it("can accept a date as time base when installing", function() {
62
62
  var fakeGlobal = { Date: Date },
63
- mockDate = new j$.MockDate(fakeGlobal),
63
+ mockDate = new jasmineUnderTest.MockDate(fakeGlobal),
64
64
  baseDate = new Date();
65
65
 
66
66
  spyOn(baseDate, 'getTime').and.returnValue(123);
@@ -71,7 +71,7 @@ describe("FakeDate", function() {
71
71
 
72
72
  it("makes real dates", function() {
73
73
  var fakeGlobal = { Date: Date },
74
- mockDate = new j$.MockDate(fakeGlobal);
74
+ mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
75
75
 
76
76
  mockDate.install();
77
77
  expect(new fakeGlobal.Date()).toEqual(jasmine.any(Date));
@@ -89,7 +89,7 @@ describe("FakeDate", function() {
89
89
  fakeGlobal = { Date: globalDate };
90
90
 
91
91
  globalDate.now = function() {};
92
- var mockDate = new j$.MockDate(fakeGlobal);
92
+ var mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
93
93
 
94
94
  mockDate.install();
95
95
 
@@ -105,7 +105,7 @@ describe("FakeDate", function() {
105
105
  }
106
106
  }),
107
107
  fakeGlobal = { Date: globalDate },
108
- mockDate = new j$.MockDate(fakeGlobal);
108
+ mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
109
109
 
110
110
  mockDate.install();
111
111
 
@@ -123,7 +123,7 @@ describe("FakeDate", function() {
123
123
  fakeGlobal = { Date: globalDate };
124
124
 
125
125
  globalDate.now = function() {};
126
- var mockDate = new j$.MockDate(fakeGlobal);
126
+ var mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
127
127
 
128
128
  mockDate.install();
129
129
 
@@ -147,7 +147,7 @@ describe("FakeDate", function() {
147
147
  fakeGlobal = { Date: globalDate };
148
148
 
149
149
  globalDate.now = function() {};
150
- var mockDate = new j$.MockDate(fakeGlobal);
150
+ var mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
151
151
 
152
152
  mockDate.install();
153
153
 
@@ -160,7 +160,7 @@ describe("FakeDate", function() {
160
160
 
161
161
  it("allows creation of a Date in a different time than the mocked time", function() {
162
162
  var fakeGlobal = { Date: Date },
163
- mockDate = new j$.MockDate(fakeGlobal);
163
+ mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
164
164
 
165
165
  mockDate.install();
166
166
 
@@ -170,7 +170,7 @@ describe("FakeDate", function() {
170
170
 
171
171
  it("allows creation of a Date that isn't fully specified", function() {
172
172
  var fakeGlobal = { Date: Date },
173
- mockDate = new j$.MockDate(fakeGlobal);
173
+ mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
174
174
 
175
175
  mockDate.install();
176
176
 
@@ -180,7 +180,7 @@ describe("FakeDate", function() {
180
180
 
181
181
  it('allows creation of a Date with millis', function() {
182
182
  var fakeGlobal = { Date: Date },
183
- mockDate = new j$.MockDate(fakeGlobal),
183
+ mockDate = new jasmineUnderTest.MockDate(fakeGlobal),
184
184
  now = new Date(2014, 3, 15).getTime();
185
185
 
186
186
  mockDate.install();
@@ -191,7 +191,7 @@ describe("FakeDate", function() {
191
191
 
192
192
  it("copies all Date properties to the mocked date", function() {
193
193
  var fakeGlobal = { Date: Date },
194
- mockDate = new j$.MockDate(fakeGlobal);
194
+ mockDate = new jasmineUnderTest.MockDate(fakeGlobal);
195
195
 
196
196
  mockDate.install();
197
197
 
@@ -1,34 +1,34 @@
1
- describe("j$.pp", function () {
1
+ describe("jasmineUnderTest.pp", function () {
2
2
  it("should wrap strings in single quotes", function() {
3
- expect(j$.pp("some string")).toEqual("'some string'");
4
- expect(j$.pp("som' string")).toEqual("'som' string'");
3
+ expect(jasmineUnderTest.pp("some string")).toEqual("'some string'");
4
+ expect(jasmineUnderTest.pp("som' string")).toEqual("'som' string'");
5
5
  });
6
6
 
7
7
  it("should stringify primitives properly", function() {
8
- expect(j$.pp(true)).toEqual("true");
9
- expect(j$.pp(false)).toEqual("false");
10
- expect(j$.pp(null)).toEqual("null");
11
- expect(j$.pp(jasmine.undefined)).toEqual("undefined");
12
- expect(j$.pp(3)).toEqual("3");
13
- expect(j$.pp(-3.14)).toEqual("-3.14");
14
- expect(j$.pp(-0)).toEqual("-0");
8
+ expect(jasmineUnderTest.pp(true)).toEqual("true");
9
+ expect(jasmineUnderTest.pp(false)).toEqual("false");
10
+ expect(jasmineUnderTest.pp(null)).toEqual("null");
11
+ expect(jasmineUnderTest.pp(jasmine.undefined)).toEqual("undefined");
12
+ expect(jasmineUnderTest.pp(3)).toEqual("3");
13
+ expect(jasmineUnderTest.pp(-3.14)).toEqual("-3.14");
14
+ expect(jasmineUnderTest.pp(-0)).toEqual("-0");
15
15
  });
16
16
 
17
17
  describe('stringify arrays', function() {
18
18
  it("should stringify arrays properly", function() {
19
- expect(j$.pp([1, 2])).toEqual("[ 1, 2 ]");
20
- expect(j$.pp([1, 'foo', {}, jasmine.undefined, null])).toEqual("[ 1, 'foo', Object({ }), undefined, null ]");
19
+ expect(jasmineUnderTest.pp([1, 2])).toEqual("[ 1, 2 ]");
20
+ expect(jasmineUnderTest.pp([1, 'foo', {}, jasmine.undefined, null])).toEqual("[ 1, 'foo', Object({ }), undefined, null ]");
21
21
  });
22
22
 
23
- it("should truncate arrays that are longer than j$.MAX_PRETTY_PRINT_ARRAY_LENGTH", function() {
24
- var originalMaxLength = j$.MAX_PRETTY_PRINT_ARRAY_LENGTH;
23
+ it("should truncate arrays that are longer than jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH", function() {
24
+ var originalMaxLength = jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH;
25
25
  var array = [1, 2, 3];
26
26
 
27
27
  try {
28
- j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 2;
29
- expect(j$.pp(array)).toEqual("[ 1, 2, ... ]");
28
+ jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH = 2;
29
+ expect(jasmineUnderTest.pp(array)).toEqual("[ 1, 2, ... ]");
30
30
  } finally {
31
- j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = originalMaxLength;
31
+ jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH = originalMaxLength;
32
32
  }
33
33
  });
34
34
 
@@ -36,27 +36,27 @@ describe("j$.pp", function () {
36
36
  var arr = [1, 2];
37
37
  arr.foo = 'bar';
38
38
  arr.baz = {};
39
- expect(j$.pp(arr)).toEqual("[ 1, 2, foo: 'bar', baz: Object({ }) ]");
39
+ expect(jasmineUnderTest.pp(arr)).toEqual("[ 1, 2, foo: 'bar', baz: Object({ }) ]");
40
40
  });
41
41
 
42
42
  it("should stringify empty arrays with properties properly", function() {
43
43
  var empty = [];
44
44
  empty.foo = 'bar';
45
45
  empty.baz = {};
46
- expect(j$.pp(empty)).toEqual("[ foo: 'bar', baz: Object({ }) ]");
46
+ expect(jasmineUnderTest.pp(empty)).toEqual("[ foo: 'bar', baz: Object({ }) ]");
47
47
  });
48
48
 
49
49
  it("should stringify long arrays with properties properly", function() {
50
- var originalMaxLength = j$.MAX_PRETTY_PRINT_ARRAY_LENGTH;
50
+ var originalMaxLength = jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH;
51
51
  var long = [1,2,3];
52
52
  long.foo = 'bar';
53
53
  long.baz = {};
54
54
 
55
55
  try {
56
- j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 2;
57
- expect(j$.pp(long)).toEqual("[ 1, 2, ..., foo: 'bar', baz: Object({ }) ]");
56
+ jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH = 2;
57
+ expect(jasmineUnderTest.pp(long)).toEqual("[ 1, 2, ..., foo: 'bar', baz: Object({ }) ]");
58
58
  } finally {
59
- j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = originalMaxLength;
59
+ jasmineUnderTest.MAX_PRETTY_PRINT_ARRAY_LENGTH = originalMaxLength;
60
60
  }
61
61
  });
62
62
 
@@ -64,19 +64,19 @@ describe("j$.pp", function () {
64
64
  var array1 = [1, 2];
65
65
  var array2 = [array1];
66
66
  array1.push(array2);
67
- expect(j$.pp(array1)).toEqual("[ 1, 2, [ <circular reference: Array> ] ]");
67
+ expect(jasmineUnderTest.pp(array1)).toEqual("[ 1, 2, [ <circular reference: Array> ] ]");
68
68
  });
69
69
 
70
70
  it("should not indicate circular references incorrectly", function() {
71
71
  var array = [ [1] ];
72
- expect(j$.pp(array)).toEqual("[ [ 1 ] ]");
72
+ expect(jasmineUnderTest.pp(array)).toEqual("[ [ 1 ] ]");
73
73
  });
74
74
  });
75
75
 
76
76
  it("should stringify objects properly", function() {
77
- expect(j$.pp({foo: 'bar'})).toEqual("Object({ foo: 'bar' })");
78
- expect(j$.pp({foo:'bar', baz:3, nullValue: null, undefinedValue: jasmine.undefined})).toEqual("Object({ foo: 'bar', baz: 3, nullValue: null, undefinedValue: undefined })");
79
- expect(j$.pp({foo: function () {
77
+ expect(jasmineUnderTest.pp({foo: 'bar'})).toEqual("Object({ foo: 'bar' })");
78
+ expect(jasmineUnderTest.pp({foo:'bar', baz:3, nullValue: null, undefinedValue: jasmine.undefined})).toEqual("Object({ foo: 'bar', baz: 3, nullValue: null, undefinedValue: undefined })");
79
+ expect(jasmineUnderTest.pp({foo: function () {
80
80
  }, bar: [1, 2, 3]})).toEqual("Object({ foo: Function, bar: [ 1, 2, 3 ] })");
81
81
  });
82
82
 
@@ -85,28 +85,28 @@ describe("j$.pp", function () {
85
85
  SomeClass.prototype.foo = "inherited foo";
86
86
  var instance = new SomeClass();
87
87
  instance.bar = "my own bar";
88
- expect(j$.pp(instance)).toEqual("SomeClass({ bar: 'my own bar' })");
88
+ expect(jasmineUnderTest.pp(instance)).toEqual("SomeClass({ bar: 'my own bar' })");
89
89
  });
90
90
 
91
- it("should not recurse objects and arrays more deeply than j$.MAX_PRETTY_PRINT_DEPTH", function() {
92
- var originalMaxDepth = j$.MAX_PRETTY_PRINT_DEPTH;
91
+ it("should not recurse objects and arrays more deeply than jasmineUnderTest.MAX_PRETTY_PRINT_DEPTH", function() {
92
+ var originalMaxDepth = jasmineUnderTest.MAX_PRETTY_PRINT_DEPTH;
93
93
  var nestedObject = { level1: { level2: { level3: { level4: "leaf" } } } };
94
94
  var nestedArray = [1, [2, [3, [4, "leaf"]]]];
95
95
 
96
96
  try {
97
- j$.MAX_PRETTY_PRINT_DEPTH = 2;
98
- expect(j$.pp(nestedObject)).toEqual("Object({ level1: Object({ level2: Object }) })");
99
- expect(j$.pp(nestedArray)).toEqual("[ 1, [ 2, Array ] ]");
97
+ jasmineUnderTest.MAX_PRETTY_PRINT_DEPTH = 2;
98
+ expect(jasmineUnderTest.pp(nestedObject)).toEqual("Object({ level1: Object({ level2: Object }) })");
99
+ expect(jasmineUnderTest.pp(nestedArray)).toEqual("[ 1, [ 2, Array ] ]");
100
100
 
101
- j$.MAX_PRETTY_PRINT_DEPTH = 3;
102
- expect(j$.pp(nestedObject)).toEqual("Object({ level1: Object({ level2: Object({ level3: Object }) }) })");
103
- expect(j$.pp(nestedArray)).toEqual("[ 1, [ 2, [ 3, Array ] ] ]");
101
+ jasmineUnderTest.MAX_PRETTY_PRINT_DEPTH = 3;
102
+ expect(jasmineUnderTest.pp(nestedObject)).toEqual("Object({ level1: Object({ level2: Object({ level3: Object }) }) })");
103
+ expect(jasmineUnderTest.pp(nestedArray)).toEqual("[ 1, [ 2, [ 3, Array ] ] ]");
104
104
 
105
- j$.MAX_PRETTY_PRINT_DEPTH = 4;
106
- expect(j$.pp(nestedObject)).toEqual("Object({ level1: Object({ level2: Object({ level3: Object({ level4: 'leaf' }) }) }) })");
107
- expect(j$.pp(nestedArray)).toEqual("[ 1, [ 2, [ 3, [ 4, 'leaf' ] ] ] ]");
105
+ jasmineUnderTest.MAX_PRETTY_PRINT_DEPTH = 4;
106
+ expect(jasmineUnderTest.pp(nestedObject)).toEqual("Object({ level1: Object({ level2: Object({ level3: Object({ level4: 'leaf' }) }) }) })");
107
+ expect(jasmineUnderTest.pp(nestedArray)).toEqual("[ 1, [ 2, [ 3, [ 4, 'leaf' ] ] ] ]");
108
108
  } finally {
109
- j$.MAX_PRETTY_PRINT_DEPTH = originalMaxDepth;
109
+ jasmineUnderTest.MAX_PRETTY_PRINT_DEPTH = originalMaxDepth;
110
110
  }
111
111
  });
112
112
 
@@ -115,18 +115,18 @@ describe("j$.pp", function () {
115
115
  var frozenObject = {foo: {bar: 'baz'}};
116
116
  frozenObject.circular = frozenObject;
117
117
  frozenObject = Object.freeze(frozenObject);
118
- expect(j$.pp(frozenObject)).toEqual("Object({ foo: Object({ bar: 'baz' }), circular: <circular reference: Object> })");
118
+ expect(jasmineUnderTest.pp(frozenObject)).toEqual("Object({ foo: Object({ bar: 'baz' }), circular: <circular reference: Object> })");
119
119
  }
120
120
  });
121
121
 
122
122
  it("should stringify RegExp objects properly", function() {
123
- expect(j$.pp(/x|y|z/)).toEqual("/x|y|z/");
123
+ expect(jasmineUnderTest.pp(/x|y|z/)).toEqual("/x|y|z/");
124
124
  });
125
125
 
126
126
  it("should indicate circular object references", function() {
127
127
  var sampleValue = {foo: 'hello'};
128
128
  sampleValue.nested = sampleValue;
129
- expect(j$.pp(sampleValue)).toEqual("Object({ foo: 'hello', nested: <circular reference: Object> })");
129
+ expect(jasmineUnderTest.pp(sampleValue)).toEqual("Object({ foo: 'hello', nested: <circular reference: Object> })");
130
130
  });
131
131
 
132
132
  it("should indicate getters on objects as such", function() {
@@ -138,39 +138,39 @@ describe("j$.pp", function () {
138
138
  });
139
139
  }
140
140
  if (sampleValue.__defineGetter__) {
141
- expect(j$.pp(sampleValue)).toEqual("Object({ id: 1, calculatedValue: <getter> })");
141
+ expect(jasmineUnderTest.pp(sampleValue)).toEqual("Object({ id: 1, calculatedValue: <getter> })");
142
142
  }
143
143
  else {
144
- expect(j$.pp(sampleValue)).toEqual("Object({ id: 1 })");
144
+ expect(jasmineUnderTest.pp(sampleValue)).toEqual("Object({ id: 1 })");
145
145
  }
146
146
  });
147
147
 
148
148
 
149
149
  it('should not do HTML escaping of strings', function() {
150
- expect(j$.pp('some <b>html string</b> &', false)).toEqual('\'some <b>html string</b> &\'');
150
+ expect(jasmineUnderTest.pp('some <b>html string</b> &', false)).toEqual('\'some <b>html string</b> &\'');
151
151
  });
152
152
 
153
153
  it("should abbreviate the global (usually window) object", function() {
154
- expect(j$.pp(jasmine.getGlobal())).toEqual("<global>");
154
+ expect(jasmineUnderTest.pp(jasmine.getGlobal())).toEqual("<global>");
155
155
  });
156
156
 
157
157
  it("should stringify Date objects properly", function() {
158
158
  var now = new Date();
159
- expect(j$.pp(now)).toEqual("Date(" + now.toString() + ")");
159
+ expect(jasmineUnderTest.pp(now)).toEqual("Date(" + now.toString() + ")");
160
160
  });
161
161
 
162
162
  it("should stringify spy objects properly", function() {
163
163
  var TestObject = {
164
164
  someFunction: function() {}
165
165
  },
166
- env = new j$.Env();
166
+ env = new jasmineUnderTest.Env();
167
167
 
168
- var spyRegistry = new j$.SpyRegistry({currentSpies: function() {return [];}});
168
+ var spyRegistry = new jasmineUnderTest.SpyRegistry({currentSpies: function() {return [];}});
169
169
 
170
170
  spyRegistry.spyOn(TestObject, 'someFunction');
171
- expect(j$.pp(TestObject.someFunction)).toEqual("spy on someFunction");
171
+ expect(jasmineUnderTest.pp(TestObject.someFunction)).toEqual("spy on someFunction");
172
172
 
173
- expect(j$.pp(j$.createSpy("something"))).toEqual("spy on something");
173
+ expect(jasmineUnderTest.pp(jasmineUnderTest.createSpy("something"))).toEqual("spy on something");
174
174
  });
175
175
 
176
176
  it("should stringify objects that implement jasmineToString", function () {
@@ -178,7 +178,7 @@ describe("j$.pp", function () {
178
178
  jasmineToString: function () { return "strung"; }
179
179
  };
180
180
 
181
- expect(j$.pp(obj)).toEqual("strung");
181
+ expect(jasmineUnderTest.pp(obj)).toEqual("strung");
182
182
  });
183
183
 
184
184
  it("should stringify objects that implement custom toString", function () {
@@ -186,7 +186,16 @@ describe("j$.pp", function () {
186
186
  toString: function () { return "my toString"; }
187
187
  };
188
188
 
189
- expect(j$.pp(obj)).toEqual("my toString");
189
+ expect(jasmineUnderTest.pp(obj)).toEqual("my toString");
190
+ });
191
+
192
+ it("should stringify objects from anonymous constructors with custom toString", function () {
193
+ var MyAnonymousConstructor = (function() { return function () {}; })();
194
+ MyAnonymousConstructor.toString = function () { return ''; };
195
+
196
+ var a = new MyAnonymousConstructor();
197
+
198
+ expect(jasmineUnderTest.pp(a)).toEqual("<anonymous>({ })");
190
199
  });
191
200
 
192
201
  it("should handle objects with null prototype", function() {
@@ -195,6 +204,6 @@ describe("j$.pp", function () {
195
204
  var obj = Object.create(null);
196
205
  obj.foo = 'bar';
197
206
 
198
- expect(j$.pp(obj)).toEqual("null({ foo: 'bar' })");
207
+ expect(jasmineUnderTest.pp(obj)).toEqual("null({ foo: 'bar' })");
199
208
  });
200
209
  });
@@ -4,7 +4,7 @@ describe("QueueRunner", function() {
4
4
  var calls = [],
5
5
  queueableFn1 = { fn: jasmine.createSpy('fn1') },
6
6
  queueableFn2 = { fn: jasmine.createSpy('fn2') },
7
- queueRunner = new j$.QueueRunner({
7
+ queueRunner = new jasmineUnderTest.QueueRunner({
8
8
  queueableFns: [queueableFn1, queueableFn2]
9
9
  });
10
10
  queueableFn1.fn.and.callFake(function() {
@@ -23,7 +23,7 @@ describe("QueueRunner", function() {
23
23
  var queueableFn1 = { fn: jasmine.createSpy('fn1') },
24
24
  queueableFn2 = { fn: jasmine.createSpy('fn2') },
25
25
  queueableFn3 = { fn: function(done) { asyncContext = this; done(); } },
26
- queueRunner = new j$.QueueRunner({
26
+ queueRunner = new jasmineUnderTest.QueueRunner({
27
27
  queueableFns: [queueableFn1, queueableFn2, queueableFn3]
28
28
  }),
29
29
  asyncContext;
@@ -65,7 +65,7 @@ describe("QueueRunner", function() {
65
65
  afterCallback();
66
66
  setTimeout(done, 100);
67
67
  } },
68
- queueRunner = new j$.QueueRunner({
68
+ queueRunner = new jasmineUnderTest.QueueRunner({
69
69
  queueableFns: [queueableFn1, queueableFn2, queueableFn3],
70
70
  onComplete: onComplete
71
71
  });
@@ -99,7 +99,7 @@ describe("QueueRunner", function() {
99
99
  } },
100
100
  queueableFn2 = { fn: jasmine.createSpy('fn2') },
101
101
  failFn = jasmine.createSpy('fail'),
102
- queueRunner = new j$.QueueRunner({
102
+ queueRunner = new jasmineUnderTest.QueueRunner({
103
103
  queueableFns: [queueableFn1, queueableFn2],
104
104
  fail: failFn
105
105
  });
@@ -121,7 +121,7 @@ describe("QueueRunner", function() {
121
121
  queueableFn = { fn: jasmine.createSpy('fn'), type: 'queueable' },
122
122
  onComplete = jasmine.createSpy('onComplete'),
123
123
  onException = jasmine.createSpy('onException'),
124
- queueRunner = new j$.QueueRunner({
124
+ queueRunner = new jasmineUnderTest.QueueRunner({
125
125
  queueableFns: [beforeFn, queueableFn],
126
126
  onComplete: onComplete,
127
127
  onException: onException
@@ -142,7 +142,7 @@ describe("QueueRunner", function() {
142
142
  queueableFn = { fn: jasmine.createSpy('fn') },
143
143
  onComplete = jasmine.createSpy('onComplete'),
144
144
  onException = jasmine.createSpy('onException'),
145
- queueRunner = new j$.QueueRunner({
145
+ queueRunner = new jasmineUnderTest.QueueRunner({
146
146
  queueableFns: [beforeFn, queueableFn],
147
147
  onComplete: onComplete,
148
148
  onException: onException,
@@ -151,7 +151,7 @@ describe("QueueRunner", function() {
151
151
  queueRunner.execute();
152
152
  expect(queueableFn.fn).not.toHaveBeenCalled();
153
153
 
154
- jasmine.clock().tick(j$.DEFAULT_TIMEOUT_INTERVAL);
154
+ jasmine.clock().tick(jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL);
155
155
 
156
156
  expect(onException).not.toHaveBeenCalled();
157
157
  expect(queueableFn.fn).not.toHaveBeenCalled();
@@ -162,7 +162,7 @@ describe("QueueRunner", function() {
162
162
  var queueableFn = { fn: function(done) { throw new Error("error!"); } },
163
163
  onComplete = jasmine.createSpy('onComplete'),
164
164
  onException = jasmine.createSpy('onException'),
165
- queueRunner = new j$.QueueRunner({
165
+ queueRunner = new jasmineUnderTest.QueueRunner({
166
166
  queueableFns: [queueableFn],
167
167
  onComplete: onComplete,
168
168
  onException: onException
@@ -173,7 +173,7 @@ describe("QueueRunner", function() {
173
173
  expect(onComplete).toHaveBeenCalled();
174
174
  expect(onException).toHaveBeenCalled();
175
175
 
176
- jasmine.clock().tick(j$.DEFAULT_TIMEOUT_INTERVAL);
176
+ jasmine.clock().tick(jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL);
177
177
  expect(onException.calls.count()).toEqual(1);
178
178
  });
179
179
 
@@ -181,7 +181,7 @@ describe("QueueRunner", function() {
181
181
  var queueableFn = { fn: function(done) { done(); } },
182
182
  onComplete = jasmine.createSpy('onComplete'),
183
183
  onException = jasmine.createSpy('onException'),
184
- queueRunner = new j$.QueueRunner({
184
+ queueRunner = new jasmineUnderTest.QueueRunner({
185
185
  queueableFns: [queueableFn],
186
186
  onComplete: onComplete,
187
187
  onException: onException
@@ -191,14 +191,14 @@ describe("QueueRunner", function() {
191
191
 
192
192
  expect(onComplete).toHaveBeenCalled();
193
193
 
194
- jasmine.clock().tick(j$.DEFAULT_TIMEOUT_INTERVAL);
194
+ jasmine.clock().tick(jasmineUnderTest.DEFAULT_TIMEOUT_INTERVAL);
195
195
  expect(onException).not.toHaveBeenCalled();
196
196
  });
197
197
 
198
198
  it("only moves to the next spec the first time you call done", function() {
199
199
  var queueableFn = { fn: function(done) {done(); done();} },
200
200
  nextQueueableFn = { fn: jasmine.createSpy('nextFn') };
201
- queueRunner = new j$.QueueRunner({
201
+ queueRunner = new jasmineUnderTest.QueueRunner({
202
202
  queueableFns: [queueableFn, nextQueueableFn]
203
203
  });
204
204
 
@@ -212,7 +212,7 @@ describe("QueueRunner", function() {
212
212
  throw new Error('error!');
213
213
  } },
214
214
  nextQueueableFn = { fn: jasmine.createSpy('nextFn') };
215
- queueRunner = new j$.QueueRunner({
215
+ queueRunner = new jasmineUnderTest.QueueRunner({
216
216
  queueableFns: [queueableFn, nextQueueableFn]
217
217
  });
218
218
 
@@ -220,6 +220,20 @@ describe("QueueRunner", function() {
220
220
  jasmine.clock().tick(1);
221
221
  expect(nextQueueableFn.fn.calls.count()).toEqual(1);
222
222
  });
223
+
224
+ it("should return a null when you call done", function () {
225
+ // Some promises want handlers to return anything but undefined to help catch "forgotten returns".
226
+ var doneReturn,
227
+ queueableFn = { fn: function(done) {
228
+ doneReturn = done();
229
+ } },
230
+ queueRunner = new jasmineUnderTest.QueueRunner({
231
+ queueableFns: [queueableFn]
232
+ });
233
+
234
+ queueRunner.execute();
235
+ expect(doneReturn).toBe(null);
236
+ });
223
237
  });
224
238
 
225
239
  it("calls exception handlers when an exception is thrown in a fn", function() {
@@ -228,7 +242,7 @@ describe("QueueRunner", function() {
228
242
  throw new Error('fake error');
229
243
  } },
230
244
  onExceptionCallback = jasmine.createSpy('on exception callback'),
231
- queueRunner = new j$.QueueRunner({
245
+ queueRunner = new jasmineUnderTest.QueueRunner({
232
246
  queueableFns: [queueableFn],
233
247
  onException: onExceptionCallback
234
248
  });
@@ -242,7 +256,7 @@ describe("QueueRunner", function() {
242
256
  var queueableFn = { fn: function() {
243
257
  throw new Error('fake error');
244
258
  } },
245
- queueRunner = new j$.QueueRunner({
259
+ queueRunner = new jasmineUnderTest.QueueRunner({
246
260
  queueableFns: [queueableFn],
247
261
  catchException: function(e) { return false; }
248
262
  });
@@ -255,7 +269,7 @@ describe("QueueRunner", function() {
255
269
  it("continues running the functions even after an exception is thrown in an async spec", function() {
256
270
  var queueableFn = { fn: function(done) { throw new Error("error"); } },
257
271
  nextQueueableFn = { fn: jasmine.createSpy("nextFunction") },
258
- queueRunner = new j$.QueueRunner({
272
+ queueRunner = new jasmineUnderTest.QueueRunner({
259
273
  queueableFns: [queueableFn, nextQueueableFn]
260
274
  });
261
275
 
@@ -266,7 +280,7 @@ describe("QueueRunner", function() {
266
280
  it("calls a provided complete callback when done", function() {
267
281
  var queueableFn = { fn: jasmine.createSpy('fn') },
268
282
  completeCallback = jasmine.createSpy('completeCallback'),
269
- queueRunner = new j$.QueueRunner({
283
+ queueRunner = new jasmineUnderTest.QueueRunner({
270
284
  queueableFns: [queueableFn],
271
285
  onComplete: completeCallback
272
286
  });
@@ -281,7 +295,7 @@ describe("QueueRunner", function() {
281
295
  afterFn = { fn: jasmine.createSpy('afterFn') },
282
296
  completeCallback = jasmine.createSpy('completeCallback'),
283
297
  clearStack = jasmine.createSpy('clearStack'),
284
- queueRunner = new j$.QueueRunner({
298
+ queueRunner = new jasmineUnderTest.QueueRunner({
285
299
  queueableFns: [asyncFn, afterFn],
286
300
  clearStack: clearStack,
287
301
  onComplete: completeCallback