jasmine-core 1.3.1 → 2.0.0.rc2

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 (73) hide show
  1. data/lib/jasmine-core.rb +14 -1
  2. data/lib/jasmine-core/boot.js +131 -0
  3. data/lib/jasmine-core/boot/boot.js +109 -0
  4. data/lib/jasmine-core/example/spec/PlayerSpec.js +2 -2
  5. data/lib/jasmine-core/example/spec/SpecHelper.js +14 -8
  6. data/lib/jasmine-core/jasmine-html.js +289 -616
  7. data/lib/jasmine-core/jasmine.css +52 -80
  8. data/lib/jasmine-core/jasmine.js +1972 -2211
  9. data/lib/jasmine-core/spec/console/ConsoleReporterSpec.js +161 -386
  10. data/lib/jasmine-core/spec/core/AnySpec.js +45 -0
  11. data/lib/jasmine-core/spec/core/CallTrackerSpec.js +105 -0
  12. data/lib/jasmine-core/spec/core/ClockSpec.js +314 -0
  13. data/lib/jasmine-core/spec/core/CustomMatchersSpec.js +96 -97
  14. data/lib/jasmine-core/spec/core/DelayedFunctionSchedulerSpec.js +179 -0
  15. data/lib/jasmine-core/spec/core/EnvSpec.js +454 -102
  16. data/lib/jasmine-core/spec/core/ExceptionFormatterSpec.js +56 -0
  17. data/lib/jasmine-core/spec/core/ExceptionsSpec.js +15 -126
  18. data/lib/jasmine-core/spec/core/ExpectationResultSpec.js +61 -0
  19. data/lib/jasmine-core/spec/core/ExpectationSpec.js +320 -0
  20. data/lib/jasmine-core/spec/core/JsApiReporterSpec.js +150 -38
  21. data/lib/jasmine-core/spec/core/ObjectContainingSpec.js +64 -0
  22. data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +43 -42
  23. data/lib/jasmine-core/spec/core/QueueRunnerSpec.js +147 -0
  24. data/lib/jasmine-core/spec/core/ReportDispatcherSpec.js +40 -0
  25. data/lib/jasmine-core/spec/core/SpecRunningSpec.js +92 -1075
  26. data/lib/jasmine-core/spec/core/SpecSpec.js +215 -95
  27. data/lib/jasmine-core/spec/core/SpySpec.js +28 -196
  28. data/lib/jasmine-core/spec/core/SpyStrategySpec.js +101 -0
  29. data/lib/jasmine-core/spec/core/SuiteSpec.js +216 -106
  30. data/lib/jasmine-core/spec/core/TimerSpec.js +13 -0
  31. data/lib/jasmine-core/spec/core/UtilSpec.js +19 -30
  32. data/lib/jasmine-core/spec/core/matchers/matchersUtilSpec.js +219 -0
  33. data/lib/jasmine-core/spec/core/matchers/toBeCloseToSpec.js +51 -0
  34. data/lib/jasmine-core/spec/core/matchers/toBeDefinedSpec.js +18 -0
  35. data/lib/jasmine-core/spec/core/matchers/toBeFalsySpec.js +38 -0
  36. data/lib/jasmine-core/spec/core/matchers/toBeGreaterThanSpec.js +19 -0
  37. data/lib/jasmine-core/spec/core/matchers/toBeLessThanSpec.js +20 -0
  38. data/lib/jasmine-core/spec/core/matchers/toBeNaNSpec.js +36 -0
  39. data/lib/jasmine-core/spec/core/matchers/toBeNullSpec.js +17 -0
  40. data/lib/jasmine-core/spec/core/matchers/toBeSpec.js +17 -0
  41. data/lib/jasmine-core/spec/core/matchers/toBeTruthySpec.js +38 -0
  42. data/lib/jasmine-core/spec/core/matchers/toBeUndefinedSpec.js +17 -0
  43. data/lib/jasmine-core/spec/core/matchers/toContainSpec.js +24 -0
  44. data/lib/jasmine-core/spec/core/matchers/toEqualSpec.js +28 -0
  45. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledSpec.js +46 -0
  46. data/lib/jasmine-core/spec/core/matchers/toHaveBeenCalledWithSpec.js +57 -0
  47. data/lib/jasmine-core/spec/core/matchers/toMatchSpec.js +34 -0
  48. data/lib/jasmine-core/spec/core/matchers/toThrowErrorSpec.js +280 -0
  49. data/lib/jasmine-core/spec/core/matchers/toThrowSpec.js +98 -0
  50. data/lib/jasmine-core/spec/helpers/BrowserFlags.js +19 -0
  51. data/lib/jasmine-core/spec/html/HtmlReporterSpec.js +494 -0
  52. data/lib/jasmine-core/spec/html/HtmlSpecFilterSpec.js +18 -0
  53. data/lib/jasmine-core/spec/html/MatchersHtmlSpec.js +8 -8
  54. data/lib/jasmine-core/spec/html/PrettyPrintHtmlSpec.js +3 -3
  55. data/lib/jasmine-core/spec/html/QueryStringSpec.js +43 -0
  56. data/lib/jasmine-core/spec/html/ResultsNodeSpec.js +62 -0
  57. data/lib/jasmine-core/spec/node_suite.js +137 -79
  58. data/lib/jasmine-core/spec/performance/performance_test.js +10 -0
  59. data/lib/jasmine-core/spec/support/dev_boot.js +118 -0
  60. data/lib/jasmine-core/version.rb +5 -2
  61. metadata +47 -103
  62. data/lib/jasmine-core/example/SpecRunner.html +0 -54
  63. data/lib/jasmine-core/spec/core/BaseSpec.js +0 -27
  64. data/lib/jasmine-core/spec/core/MatchersSpec.js +0 -1157
  65. data/lib/jasmine-core/spec/core/MockClockSpec.js +0 -38
  66. data/lib/jasmine-core/spec/core/MultiReporterSpec.js +0 -45
  67. data/lib/jasmine-core/spec/core/NestedResultsSpec.js +0 -54
  68. data/lib/jasmine-core/spec/core/QueueSpec.js +0 -23
  69. data/lib/jasmine-core/spec/core/ReporterSpec.js +0 -56
  70. data/lib/jasmine-core/spec/core/RunnerSpec.js +0 -280
  71. data/lib/jasmine-core/spec/core/WaitsForBlockSpec.js +0 -118
  72. data/lib/jasmine-core/spec/html/HTMLReporterSpec.js +0 -209
  73. data/lib/jasmine-core/spec/html/TrivialReporterSpec.js +0 -239
@@ -1,11 +1,11 @@
1
- describe('jasmine.jsApiReporter', function() {
2
- describe('results', function () {
3
- var reporter, spec1, spec2, spec3, expectedSpec1Results, expectedSpec2Results;
1
+ xdescribe('JsApiReporter (integration specs)', function() {
2
+ describe('results', function() {
3
+ var reporter, spec1, spec2;
4
4
  var env;
5
5
  var suite, nestedSuite, nestedSpec;
6
6
 
7
7
  beforeEach(function() {
8
- env = new jasmine.Env();
8
+ env = new j$.Env();
9
9
  env.updateInterval = 0;
10
10
 
11
11
  suite = env.describe("top-level suite", function() {
@@ -24,34 +24,24 @@ describe('jasmine.jsApiReporter', function() {
24
24
  });
25
25
  });
26
26
 
27
- spec3 = env.it("spec 3", function() {
28
- this.log('some debug message');
29
- });
30
27
  });
31
28
 
32
- reporter = new jasmine.JsApiReporter();
29
+ reporter = new j$.JsApiReporter({});
33
30
  env.addReporter(reporter);
34
31
 
35
32
  env.execute();
36
33
 
37
- expectedSpec1Results = {
38
- messages: spec1.results().getItems(),
39
- result: "passed"
40
- };
41
- expectedSpec2Results = {
42
- messages: spec2.results().getItems(),
43
- result: "failed"
44
- };
45
- });
46
-
47
- it('resultForSpec() should return the result for the given spec', function () {
48
- expect(reporter.resultsForSpec(spec1.id)).toEqual(expectedSpec1Results);
49
- expect(reporter.resultsForSpec(spec2.id)).toEqual(expectedSpec2Results);
50
34
  });
51
35
 
52
- it('results() should return a hash of all results, indexed by spec id', function () {
53
- expect(reporter.results()[spec1.id]).toEqual(expectedSpec1Results);
54
- expect(reporter.results()[spec2.id]).toEqual(expectedSpec2Results);
36
+ it('results() should return a hash of all results, indexed by spec id', function() {
37
+ var expectedSpec1Results = {
38
+ result: "passed"
39
+ },
40
+ expectedSpec2Results = {
41
+ result: "failed"
42
+ };
43
+ expect(reporter.results()[spec1.id].result).toEqual('passed');
44
+ expect(reporter.results()[spec2.id].result).toEqual('failed');
55
45
  });
56
46
 
57
47
  it("should return nested suites as children of their parents", function() {
@@ -65,7 +55,6 @@ describe('jasmine.jsApiReporter', function() {
65
55
  { id: 2, name: 'nested spec', type: 'spec', children: [ ] }
66
56
  ]
67
57
  },
68
- { id: 3, name: 'spec 3', type: 'spec', children: [ ] }
69
58
  ]
70
59
  }
71
60
  ]);
@@ -76,12 +65,7 @@ describe('jasmine.jsApiReporter', function() {
76
65
  var result = reporter.results()[spec1.id];
77
66
  var summarizedResult = reporter.summarizeResult_(result);
78
67
  expect(summarizedResult.result).toEqual('passed');
79
- expect(summarizedResult.messages.length).toEqual(1);
80
- expect(summarizedResult.messages[0].message).toEqual(result.messages[0].message);
81
- expect(summarizedResult.messages[0].passed).toBeTruthy();
82
- expect(summarizedResult.messages[0].type).toEqual('expect');
83
- expect(summarizedResult.messages[0].text).toBeUndefined();
84
- expect(summarizedResult.messages[0].trace.stack).toBeUndefined();
68
+ expect(summarizedResult.messages.length).toEqual(0);
85
69
  });
86
70
 
87
71
  it("should have a stack trace for failing specs", function() {
@@ -91,13 +75,141 @@ describe('jasmine.jsApiReporter', function() {
91
75
  expect(summarizedResult.messages[0].trace.stack).toEqual(result.messages[0].trace.stack);
92
76
  });
93
77
 
94
- it("should have messages for specs with messages", function() {
95
- var result = reporter.results()[spec3.id];
96
- var summarizedResult = reporter.summarizeResult_(result);
97
- expect(summarizedResult.result).toEqual('passed');
98
- expect(summarizedResult.messages[0].type).toEqual('log');
99
- expect(summarizedResult.messages[0].text).toEqual('some debug message');
78
+ });
79
+ });
80
+ });
81
+
82
+
83
+ describe("JsApiReporter", function() {
84
+
85
+ it("knows when a full environment is started", function() {
86
+ var reporter = new j$.JsApiReporter({});
87
+
88
+ expect(reporter.started).toBe(false);
89
+ expect(reporter.finished).toBe(false);
90
+
91
+ reporter.jasmineStarted();
92
+
93
+ expect(reporter.started).toBe(true);
94
+ expect(reporter.finished).toBe(false);
95
+ });
96
+
97
+ it("knows when a full environment is done", function() {
98
+ var reporter = new j$.JsApiReporter({});
99
+
100
+ expect(reporter.started).toBe(false);
101
+ expect(reporter.finished).toBe(false);
102
+
103
+ reporter.jasmineStarted();
104
+ reporter.jasmineDone({});
105
+
106
+ expect(reporter.finished).toBe(true);
107
+ });
108
+
109
+ it("defaults to 'loaded' status", function() {
110
+ var reporter = new j$.JsApiReporter({});
111
+
112
+ expect(reporter.status()).toEqual('loaded');
113
+ });
114
+
115
+ it("reports 'started' when Jasmine has started", function() {
116
+ var reporter = new j$.JsApiReporter({});
117
+
118
+ reporter.jasmineStarted();
119
+
120
+ expect(reporter.status()).toEqual('started');
121
+ });
122
+
123
+ it("reports 'done' when Jasmine is done", function() {
124
+ var reporter = new j$.JsApiReporter({});
125
+
126
+ reporter.jasmineDone({});
127
+
128
+ expect(reporter.status()).toEqual('done');
129
+ });
130
+
131
+ it("tracks a suite", function() {
132
+ var reporter = new j$.JsApiReporter({});
133
+
134
+ reporter.suiteStarted({
135
+ id: 123,
136
+ description: "A suite"
137
+ });
138
+
139
+ var suites = reporter.suites();
140
+
141
+ expect(suites).toEqual({123: {id: 123, description: "A suite"}});
142
+
143
+ reporter.suiteDone({
144
+ id: 123,
145
+ description: "A suite",
146
+ status: 'passed'
147
+ });
148
+
149
+ expect(suites).toEqual({123: {id: 123, description: "A suite", status: 'passed'}});
150
+ });
151
+
152
+ describe("#specResults", function() {
153
+ var reporter, specResult1, specResult2;
154
+ beforeEach(function() {
155
+ reporter = new j$.JsApiReporter({});
156
+ specResult1 = {
157
+ id: 1,
158
+ description: "A spec"
159
+ };
160
+ specResult2 = {
161
+ id: 2,
162
+ description: "Another spec"
163
+ };
164
+
165
+ reporter.specDone(specResult1);
166
+ reporter.specDone(specResult2);
167
+ });
168
+
169
+ it("should return a slice of results", function() {
170
+ expect(reporter.specResults(0, 1)).toEqual([specResult1]);
171
+ expect(reporter.specResults(1, 1)).toEqual([specResult2]);
172
+ });
173
+
174
+ describe("when the results do not exist", function() {
175
+ it("should return a slice of shorter length", function() {
176
+ expect(reporter.specResults(0, 3)).toEqual([specResult1, specResult2]);
177
+ expect(reporter.specResults(2, 3)).toEqual([]);
178
+ });
179
+ });
180
+ });
181
+
182
+ describe("#executionTime", function() {
183
+ it("should start the timer when jasmine starts", function() {
184
+ var timerSpy = jasmine.createSpyObj('timer', ['start', 'elapsed']),
185
+ reporter = new j$.JsApiReporter({
186
+ timer: timerSpy
187
+ });
188
+
189
+ reporter.jasmineStarted();
190
+ expect(timerSpy.start).toHaveBeenCalled();
191
+ });
192
+
193
+ it("should return the time it took the specs to run, in ms", function() {
194
+ var timerSpy = jasmine.createSpyObj('timer', ['start', 'elapsed']),
195
+ reporter = new j$.JsApiReporter({
196
+ timer: timerSpy
197
+ });
198
+
199
+ timerSpy.elapsed.and.callReturn(1000);
200
+ reporter.jasmineDone();
201
+ expect(reporter.executionTime()).toEqual(1000);
202
+ });
203
+
204
+ describe("when the specs haven't finished being run", function() {
205
+ it("should return undefined", function() {
206
+ var timerSpy = jasmine.createSpyObj('timer', ['start', 'elapsed']),
207
+ reporter = new j$.JsApiReporter({
208
+ timer: timerSpy
209
+ });
210
+
211
+ expect(reporter.executionTime()).toBeUndefined();
100
212
  });
101
213
  });
102
214
  });
103
- });
215
+ });
@@ -0,0 +1,64 @@
1
+ describe("ObjectContaining", function() {
2
+
3
+ it("matches any actual to an empty object", function() {
4
+ var containing = new j$.ObjectContaining({});
5
+
6
+ expect(containing.jasmineMatches("foo")).toBe(true);
7
+ });
8
+
9
+ it("does not match an empty object actual", function() {
10
+ var containing = new j$.ObjectContaining("foo");
11
+
12
+ expect(function() {
13
+ containing.jasmineMatches({})
14
+ }).toThrowError(/not 'foo'/)
15
+ });
16
+
17
+ it("matches when the key/value pair is present in the actual", function() {
18
+ var containing = new j$.ObjectContaining({foo: "fooVal"});
19
+
20
+ expect(containing.jasmineMatches({foo: "fooVal", bar: "barVal"})).toBe(true);
21
+ });
22
+
23
+ it("does not match when the key/value pair is not present in the actual", function() {
24
+ var containing = new j$.ObjectContaining({foo: "fooVal"});
25
+
26
+ expect(containing.jasmineMatches({bar: "barVal", quux: "quuxVal"})).toBe(false);
27
+ });
28
+
29
+ it("does not match when the key is present but the value is different in the actual", function() {
30
+ var containing = new j$.ObjectContaining({foo: "other"});
31
+
32
+ expect(containing.jasmineMatches({foo: "fooVal", bar: "barVal"})).toBe(false);
33
+ });
34
+
35
+ it("mismatchValues parameter must return array with mismatched reason", function() {
36
+ var containing = new j$.ObjectContaining({foo: "other"});
37
+
38
+ var mismatchKeys = [];
39
+ var mismatchValues = [];
40
+
41
+ containing.jasmineMatches({foo: "fooVal", bar: "barVal"}, mismatchKeys, mismatchValues);
42
+
43
+ expect(mismatchValues.length).toBe(1);
44
+ expect(mismatchValues[0]).toEqual("'foo' was 'fooVal' in actual, but was 'other' in expected.");
45
+ });
46
+
47
+ it("adds keys in expected but not actual to the mismatchKeys parameter", function() {
48
+ var containing = new j$.ObjectContaining({foo: "fooVal"});
49
+
50
+ var mismatchKeys = [];
51
+ var mismatchValues = [];
52
+
53
+ containing.jasmineMatches({bar: "barVal"}, mismatchKeys, mismatchValues);
54
+
55
+ expect(mismatchKeys.length).toBe(1);
56
+ expect(mismatchKeys[0]).toEqual("expected has key 'foo', but missing from actual.");
57
+ });
58
+
59
+ it("jasmineToString's itself", function() {
60
+ var containing = new j$.ObjectContaining({});
61
+
62
+ expect(containing.jasmineToString()).toMatch("<jasmine.objectContaining");
63
+ });
64
+ });
@@ -1,34 +1,34 @@
1
- describe("jasmine.pp", function () {
1
+ describe("j$.pp", function () {
2
2
  it("should wrap strings in single quotes", function() {
3
- expect(jasmine.pp("some string")).toEqual("'some string'");
4
- expect(jasmine.pp("som' string")).toEqual("'som' string'");
3
+ expect(j$.pp("some string")).toEqual("'some string'");
4
+ expect(j$.pp("som' string")).toEqual("'som' string'");
5
5
  });
6
6
 
7
7
  it("should stringify primitives properly", function() {
8
- expect(jasmine.pp(true)).toEqual("true");
9
- expect(jasmine.pp(false)).toEqual("false");
10
- expect(jasmine.pp(null)).toEqual("null");
11
- expect(jasmine.pp(jasmine.undefined)).toEqual("undefined");
12
- expect(jasmine.pp(3)).toEqual("3");
13
- expect(jasmine.pp(-3.14)).toEqual("-3.14");
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
14
  });
15
15
 
16
16
  it("should stringify arrays properly", function() {
17
- expect(jasmine.pp([1, 2])).toEqual("[ 1, 2 ]");
18
- expect(jasmine.pp([1, 'foo', {}, jasmine.undefined, null])).toEqual("[ 1, 'foo', { }, undefined, null ]");
17
+ expect(j$.pp([1, 2])).toEqual("[ 1, 2 ]");
18
+ expect(j$.pp([1, 'foo', {}, jasmine.undefined, null])).toEqual("[ 1, 'foo', { }, undefined, null ]");
19
19
  });
20
20
 
21
21
  it("should indicate circular array references", function() {
22
22
  var array1 = [1, 2];
23
23
  var array2 = [array1];
24
24
  array1.push(array2);
25
- expect(jasmine.pp(array1)).toEqual("[ 1, 2, [ <circular reference: Array> ] ]");
25
+ expect(j$.pp(array1)).toEqual("[ 1, 2, [ <circular reference: Array> ] ]");
26
26
  });
27
27
 
28
28
  it("should stringify objects properly", function() {
29
- expect(jasmine.pp({foo: 'bar'})).toEqual("{ foo : 'bar' }");
30
- expect(jasmine.pp({foo:'bar', baz:3, nullValue: null, undefinedValue: jasmine.undefined})).toEqual("{ foo : 'bar', baz : 3, nullValue : null, undefinedValue : undefined }");
31
- expect(jasmine.pp({foo: function () {
29
+ expect(j$.pp({foo: 'bar'})).toEqual("{ foo : 'bar' }");
30
+ expect(j$.pp({foo:'bar', baz:3, nullValue: null, undefinedValue: jasmine.undefined})).toEqual("{ foo : 'bar', baz : 3, nullValue : null, undefinedValue : undefined }");
31
+ expect(j$.pp({foo: function () {
32
32
  }, bar: [1, 2, 3]})).toEqual("{ foo : Function, bar : [ 1, 2, 3 ] }");
33
33
  });
34
34
 
@@ -37,39 +37,39 @@ describe("jasmine.pp", function () {
37
37
  SomeClass.prototype.foo = "inherited foo";
38
38
  var instance = new SomeClass();
39
39
  instance.bar = "my own bar";
40
- expect(jasmine.pp(instance)).toEqual("{ bar : 'my own bar' }");
40
+ expect(j$.pp(instance)).toEqual("{ bar : 'my own bar' }");
41
41
  });
42
42
 
43
- it("should not recurse objects and arrays more deeply than jasmine.MAX_PRETTY_PRINT_DEPTH", function() {
44
- var originalMaxDepth = jasmine.MAX_PRETTY_PRINT_DEPTH;
43
+ it("should not recurse objects and arrays more deeply than j$.MAX_PRETTY_PRINT_DEPTH", function() {
44
+ var originalMaxDepth = j$.MAX_PRETTY_PRINT_DEPTH;
45
45
  var nestedObject = { level1: { level2: { level3: { level4: "leaf" } } } };
46
46
  var nestedArray = [1, [2, [3, [4, "leaf"]]]];
47
47
 
48
48
  try {
49
- jasmine.MAX_PRETTY_PRINT_DEPTH = 2;
50
- expect(jasmine.pp(nestedObject)).toEqual("{ level1 : { level2 : Object } }");
51
- expect(jasmine.pp(nestedArray)).toEqual("[ 1, [ 2, Array ] ]");
49
+ j$.MAX_PRETTY_PRINT_DEPTH = 2;
50
+ expect(j$.pp(nestedObject)).toEqual("{ level1 : { level2 : Object } }");
51
+ expect(j$.pp(nestedArray)).toEqual("[ 1, [ 2, Array ] ]");
52
52
 
53
- jasmine.MAX_PRETTY_PRINT_DEPTH = 3;
54
- expect(jasmine.pp(nestedObject)).toEqual("{ level1 : { level2 : { level3 : Object } } }");
55
- expect(jasmine.pp(nestedArray)).toEqual("[ 1, [ 2, [ 3, Array ] ] ]");
53
+ j$.MAX_PRETTY_PRINT_DEPTH = 3;
54
+ expect(j$.pp(nestedObject)).toEqual("{ level1 : { level2 : { level3 : Object } } }");
55
+ expect(j$.pp(nestedArray)).toEqual("[ 1, [ 2, [ 3, Array ] ] ]");
56
56
 
57
- jasmine.MAX_PRETTY_PRINT_DEPTH = 4;
58
- expect(jasmine.pp(nestedObject)).toEqual("{ level1 : { level2 : { level3 : { level4 : 'leaf' } } } }");
59
- expect(jasmine.pp(nestedArray)).toEqual("[ 1, [ 2, [ 3, [ 4, 'leaf' ] ] ] ]");
57
+ j$.MAX_PRETTY_PRINT_DEPTH = 4;
58
+ expect(j$.pp(nestedObject)).toEqual("{ level1 : { level2 : { level3 : { level4 : 'leaf' } } } }");
59
+ expect(j$.pp(nestedArray)).toEqual("[ 1, [ 2, [ 3, [ 4, 'leaf' ] ] ] ]");
60
60
  } finally {
61
- jasmine.MAX_PRETTY_PRINT_DEPTH = originalMaxDepth;
61
+ j$.MAX_PRETTY_PRINT_DEPTH = originalMaxDepth;
62
62
  }
63
63
  });
64
64
 
65
65
  it("should stringify RegExp objects properly", function() {
66
- expect(jasmine.pp(/x|y|z/)).toEqual("/x|y|z/");
66
+ expect(j$.pp(/x|y|z/)).toEqual("/x|y|z/");
67
67
  });
68
68
 
69
69
  it("should indicate circular object references", function() {
70
70
  var sampleValue = {foo: 'hello'};
71
71
  sampleValue.nested = sampleValue;
72
- expect(jasmine.pp(sampleValue)).toEqual("{ foo : 'hello', nested : <circular reference: Object> }");
72
+ expect(j$.pp(sampleValue)).toEqual("{ foo : 'hello', nested : <circular reference: Object> }");
73
73
  });
74
74
 
75
75
  it("should indicate getters on objects as such", function() {
@@ -81,36 +81,37 @@ describe("jasmine.pp", function () {
81
81
  });
82
82
  }
83
83
  if (sampleValue.__defineGetter__) {
84
- expect(jasmine.pp(sampleValue)).toEqual("{ id : 1, calculatedValue : <getter> }");
84
+ expect(j$.pp(sampleValue)).toEqual("{ id : 1, calculatedValue : <getter> }");
85
85
  }
86
86
  else {
87
- expect(jasmine.pp(sampleValue)).toEqual("{ id : 1 }");
87
+ expect(j$.pp(sampleValue)).toEqual("{ id : 1 }");
88
88
  }
89
89
  });
90
90
 
91
91
 
92
92
  it('should not do HTML escaping of strings', function() {
93
- expect(jasmine.pp('some <b>html string</b> &', false)).toEqual('\'some <b>html string</b> &\'');
93
+ expect(j$.pp('some <b>html string</b> &', false)).toEqual('\'some <b>html string</b> &\'');
94
94
  });
95
95
 
96
96
  it("should abbreviate the global (usually window) object", function() {
97
- expect(jasmine.pp(jasmine.getGlobal())).toEqual("<global>");
97
+ expect(j$.pp(jasmine.getGlobal())).toEqual("<global>");
98
98
  });
99
99
 
100
100
  it("should stringify Date objects properly", function() {
101
101
  var now = new Date();
102
- expect(jasmine.pp(now)).toEqual("Date(" + now.toString() + ")");
102
+ expect(j$.pp(now)).toEqual("Date(" + now.toString() + ")");
103
103
  });
104
104
 
105
105
  it("should stringify spy objects properly", function() {
106
106
  var TestObject = {
107
- someFunction: function() {
108
- }
109
- };
110
- spyOn(TestObject, 'someFunction');
111
- expect(jasmine.pp(TestObject.someFunction)).toEqual("spy on someFunction");
107
+ someFunction: function() {}
108
+ },
109
+ env = new j$.Env();
110
+
111
+ env.spyOn(TestObject, 'someFunction');
112
+ expect(j$.pp(TestObject.someFunction)).toEqual("spy on someFunction");
112
113
 
113
- expect(jasmine.pp(jasmine.createSpy("something"))).toEqual("spy on something");
114
+ expect(j$.pp(j$.createSpy("something"))).toEqual("spy on something");
114
115
  });
115
116
 
116
117
  it("should stringify objects that implement jasmineToString", function () {
@@ -118,7 +119,7 @@ describe("jasmine.pp", function () {
118
119
  jasmineToString: function () { return "strung"; }
119
120
  };
120
121
 
121
- expect(jasmine.pp(obj)).toEqual("strung");
122
+ expect(j$.pp(obj)).toEqual("strung");
122
123
  });
123
124
  });
124
125