evergreen 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +15 -0
  2. data/README.rdoc +8 -6
  3. data/lib/evergreen.rb +8 -6
  4. data/lib/evergreen/application.rb +2 -5
  5. data/lib/evergreen/helper.rb +33 -0
  6. data/lib/evergreen/runner.rb +1 -1
  7. data/lib/evergreen/server.rb +1 -0
  8. data/lib/evergreen/suite.rb +6 -0
  9. data/lib/evergreen/version.rb +1 -1
  10. data/lib/evergreen/views/run.erb +16 -6
  11. data/lib/jasmine/Contribute.markdown +8 -7
  12. data/lib/jasmine/Gemfile +0 -1
  13. data/lib/jasmine/README.markdown +1 -8
  14. data/lib/jasmine/Rakefile +26 -15
  15. data/lib/jasmine/Release.markdown +8 -6
  16. data/lib/jasmine/config.rb +29 -0
  17. data/lib/jasmine/jasmine-core.gemspec +9 -2
  18. data/lib/jasmine/jasmine_dev.thor +1 -0
  19. data/lib/jasmine/jshint/run.js +1 -1
  20. data/lib/jasmine/lib/jasmine-core/jasmine-html.js +427 -1
  21. data/lib/jasmine/lib/jasmine-core/jasmine.css +81 -166
  22. data/lib/jasmine/lib/jasmine-core/jasmine.js +245 -192
  23. data/lib/jasmine/lib/jasmine-core/version.rb +1 -1
  24. data/lib/jasmine/spec/core/MatchersSpec.js +273 -0
  25. data/lib/jasmine/spec/core/PrettyPrintSpec.js +7 -0
  26. data/lib/jasmine/spec/html/HTMLReporterSpec.js +209 -0
  27. data/lib/jasmine/spec/node_suite.js +2 -2
  28. data/lib/jasmine/spec/runner.html +10 -3
  29. data/lib/jasmine/spec/spec_helper.rb +51 -0
  30. data/lib/jasmine/spec/tasks/build_distribution_spec.rb +33 -0
  31. data/lib/jasmine/spec/tasks/build_github_pages_spec.rb +69 -0
  32. data/lib/jasmine/spec/tasks/build_standalone_distribution_spec.rb +109 -0
  33. data/lib/jasmine/spec/tasks/build_standalone_runner_spec.rb +63 -0
  34. data/lib/jasmine/spec/tasks/count_specs_spec.rb +26 -0
  35. data/lib/jasmine/spec/tasks/execute_specs_spec.rb +81 -0
  36. data/lib/jasmine/spec/tasks/jshint_spec.rb +39 -0
  37. data/lib/jasmine/spec/tasks/release_spec.rb +39 -0
  38. data/lib/jasmine/spec/tasks/version_spec.rb +55 -0
  39. data/lib/jasmine/spec/templates/runner.html.erb +3 -3
  40. data/lib/jasmine/src/core/Env.js +10 -2
  41. data/lib/jasmine/src/core/Matchers.js +33 -4
  42. data/lib/jasmine/src/core/PrettyPrinter.js +2 -2
  43. data/lib/jasmine/src/core/base.js +15 -0
  44. data/lib/jasmine/src/core/mock-timeout.js +0 -0
  45. data/lib/jasmine/src/html/HtmlReporter.js +101 -0
  46. data/lib/jasmine/src/html/HtmlReporterHelpers.js +60 -0
  47. data/lib/jasmine/src/html/ReporterView.js +164 -0
  48. data/lib/jasmine/src/html/SpecView.js +79 -0
  49. data/lib/jasmine/src/html/SuiteView.js +22 -0
  50. data/lib/jasmine/src/html/TrivialReporter.js +3 -1
  51. data/lib/jasmine/src/html/_HTMLReporter.scss +302 -0
  52. data/lib/jasmine/src/html/_TrivialReporter.scss +169 -0
  53. data/lib/jasmine/src/html/jasmine.css +81 -166
  54. data/lib/jasmine/src/html/jasmine.scss +2 -0
  55. data/lib/jasmine/src/templates/version.js.erb +1 -0
  56. data/lib/jasmine/src/version.js +3 -2
  57. data/lib/jasmine/src/version.json +1 -1
  58. data/lib/jasmine/tasks/jasmine_dev.rb +18 -0
  59. data/lib/jasmine/tasks/jasmine_dev/base.rb +54 -0
  60. data/lib/jasmine/tasks/jasmine_dev/build_distribution.rb +53 -0
  61. data/lib/jasmine/tasks/jasmine_dev/build_github_pages.rb +31 -0
  62. data/lib/jasmine/tasks/jasmine_dev/build_standalone_distribution.rb +49 -0
  63. data/lib/jasmine/tasks/jasmine_dev/build_standalone_runner.rb +59 -0
  64. data/lib/jasmine/tasks/jasmine_dev/count_specs.rb +29 -0
  65. data/lib/jasmine/tasks/jasmine_dev/execute_specs.rb +52 -0
  66. data/lib/jasmine/tasks/jasmine_dev/js_hint.rb +13 -0
  67. data/lib/jasmine/tasks/jasmine_dev/release.rb +16 -0
  68. data/lib/jasmine/tasks/jasmine_dev/sources.rb +32 -0
  69. data/lib/jasmine/tasks/jasmine_dev/version.rb +62 -0
  70. data/spec/helper_spec.rb +25 -0
  71. data/spec/suite1/spec/javascripts/{spec_helper.coffee → helpers/spec_helper.coffee} +0 -0
  72. data/spec/suite1/spec/javascripts/{spec_helper.js → helpers/spec_helper.js} +0 -0
  73. data/spec/suite1/spec/javascripts/templates_spec.js +6 -6
  74. data/spec/suite2/spec/awesome_spec.js +1 -1
  75. data/spec/suite_spec.rb +6 -0
  76. metadata +116 -52
  77. data/lib/jasmine/src/SourcesList.json +0 -7
  78. data/lib/jasmine/tasks/build_dist.rb +0 -48
  79. data/lib/jasmine/tasks/build_specs.rb +0 -50
  80. data/lib/jasmine/tasks/helpers.rb +0 -50
  81. data/lib/jasmine/tasks/pages.rb +0 -13
  82. data/lib/jasmine/tasks/spec.rb +0 -37
  83. data/lib/jasmine/tasks/standalone.rb +0 -91
  84. data/lib/jasmine/tasks/version.rb +0 -5
@@ -1,166 +1,81 @@
1
- body {
2
- font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif;
3
- }
4
-
5
-
6
- .jasmine_reporter a:visited, .jasmine_reporter a {
7
- color: #303;
8
- }
9
-
10
- .jasmine_reporter a:hover, .jasmine_reporter a:active {
11
- color: blue;
12
- }
13
-
14
- .run_spec {
15
- float:right;
16
- padding-right: 5px;
17
- font-size: .8em;
18
- text-decoration: none;
19
- }
20
-
21
- .jasmine_reporter {
22
- margin: 0 5px;
23
- }
24
-
25
- .banner {
26
- color: #303;
27
- background-color: #fef;
28
- padding: 5px;
29
- }
30
-
31
- .logo {
32
- float: left;
33
- font-size: 1.1em;
34
- padding-left: 5px;
35
- }
36
-
37
- .logo .version {
38
- font-size: .6em;
39
- padding-left: 1em;
40
- }
41
-
42
- .runner.running {
43
- background-color: yellow;
44
- }
45
-
46
-
47
- .options {
48
- text-align: right;
49
- font-size: .8em;
50
- }
51
-
52
-
53
-
54
-
55
- .suite {
56
- border: 1px outset gray;
57
- margin: 5px 0;
58
- padding-left: 1em;
59
- }
60
-
61
- .suite .suite {
62
- margin: 5px;
63
- }
64
-
65
- .suite.passed {
66
- background-color: #dfd;
67
- }
68
-
69
- .suite.failed {
70
- background-color: #fdd;
71
- }
72
-
73
- .spec {
74
- margin: 5px;
75
- padding-left: 1em;
76
- clear: both;
77
- }
78
-
79
- .spec.failed, .spec.passed, .spec.skipped {
80
- padding-bottom: 5px;
81
- border: 1px solid gray;
82
- }
83
-
84
- .spec.failed {
85
- background-color: #fbb;
86
- border-color: red;
87
- }
88
-
89
- .spec.passed {
90
- background-color: #bfb;
91
- border-color: green;
92
- }
93
-
94
- .spec.skipped {
95
- background-color: #bbb;
96
- }
97
-
98
- .messages {
99
- border-left: 1px dashed gray;
100
- padding-left: 1em;
101
- padding-right: 1em;
102
- }
103
-
104
- .passed {
105
- background-color: #cfc;
106
- display: none;
107
- }
108
-
109
- .failed {
110
- background-color: #fbb;
111
- }
112
-
113
- .skipped {
114
- color: #777;
115
- background-color: #eee;
116
- display: none;
117
- }
118
-
119
-
120
- /*.resultMessage {*/
121
- /*white-space: pre;*/
122
- /*}*/
123
-
124
- .resultMessage span.result {
125
- display: block;
126
- line-height: 2em;
127
- color: black;
128
- }
129
-
130
- .resultMessage .mismatch {
131
- color: black;
132
- }
133
-
134
- .stackTrace {
135
- white-space: pre;
136
- font-size: .8em;
137
- margin-left: 10px;
138
- max-height: 5em;
139
- overflow: auto;
140
- border: 1px inset red;
141
- padding: 1em;
142
- background: #eef;
143
- }
144
-
145
- .finished-at {
146
- padding-left: 1em;
147
- font-size: .6em;
148
- }
149
-
150
- .show-passed .passed,
151
- .show-skipped .skipped {
152
- display: block;
153
- }
154
-
155
-
156
- #jasmine_content {
157
- position:fixed;
158
- right: 100%;
159
- }
160
-
161
- .runner {
162
- border: 1px solid gray;
163
- display: block;
164
- margin: 5px 0;
165
- padding: 2px 0 2px 10px;
166
- }
1
+ body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; }
2
+
3
+ #HTMLReporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; }
4
+ #HTMLReporter a { text-decoration: none; }
5
+ #HTMLReporter a:hover { text-decoration: underline; }
6
+ #HTMLReporter p, #HTMLReporter h1, #HTMLReporter h2, #HTMLReporter h3, #HTMLReporter h4, #HTMLReporter h5, #HTMLReporter h6 { margin: 0; line-height: 14px; }
7
+ #HTMLReporter .banner, #HTMLReporter .symbolSummary, #HTMLReporter .summary, #HTMLReporter .resultMessage, #HTMLReporter .specDetail .description, #HTMLReporter .alert .bar, #HTMLReporter .stackTrace { padding-left: 9px; padding-right: 9px; }
8
+ #HTMLReporter #jasmine_content { position: fixed; right: 100%; }
9
+ #HTMLReporter .version { color: #aaaaaa; }
10
+ #HTMLReporter .banner { margin-top: 14px; }
11
+ #HTMLReporter .duration { color: #aaaaaa; float: right; }
12
+ #HTMLReporter .symbolSummary { overflow: hidden; *zoom: 1; margin: 14px 0; }
13
+ #HTMLReporter .symbolSummary li { display: block; float: left; height: 7px; width: 14px; margin-bottom: 7px; font-size: 16px; }
14
+ #HTMLReporter .symbolSummary li.passed { font-size: 14px; }
15
+ #HTMLReporter .symbolSummary li.passed:before { color: #5e7d00; content: "\02022"; }
16
+ #HTMLReporter .symbolSummary li.failed { line-height: 9px; }
17
+ #HTMLReporter .symbolSummary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; }
18
+ #HTMLReporter .symbolSummary li.skipped { font-size: 14px; }
19
+ #HTMLReporter .symbolSummary li.skipped:before { color: #bababa; content: "\02022"; }
20
+ #HTMLReporter .symbolSummary li.pending { line-height: 11px; }
21
+ #HTMLReporter .symbolSummary li.pending:before { color: #aaaaaa; content: "-"; }
22
+ #HTMLReporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }
23
+ #HTMLReporter .runningAlert { background-color: #666666; }
24
+ #HTMLReporter .skippedAlert { background-color: #aaaaaa; }
25
+ #HTMLReporter .skippedAlert:first-child { background-color: #333333; }
26
+ #HTMLReporter .skippedAlert:hover { text-decoration: none; color: white; text-decoration: underline; }
27
+ #HTMLReporter .passingAlert { background-color: #a6b779; }
28
+ #HTMLReporter .passingAlert:first-child { background-color: #5e7d00; }
29
+ #HTMLReporter .failingAlert { background-color: #cf867e; }
30
+ #HTMLReporter .failingAlert:first-child { background-color: #b03911; }
31
+ #HTMLReporter .results { margin-top: 14px; }
32
+ #HTMLReporter #details { display: none; }
33
+ #HTMLReporter .resultsMenu, #HTMLReporter .resultsMenu a { background-color: #fff; color: #333333; }
34
+ #HTMLReporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; }
35
+ #HTMLReporter.showDetails .summaryMenuItem:hover { text-decoration: underline; }
36
+ #HTMLReporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; }
37
+ #HTMLReporter.showDetails .summary { display: none; }
38
+ #HTMLReporter.showDetails #details { display: block; }
39
+ #HTMLReporter .summaryMenuItem { font-weight: bold; text-decoration: underline; }
40
+ #HTMLReporter .summary { margin-top: 14px; }
41
+ #HTMLReporter .summary .suite .suite, #HTMLReporter .summary .specSummary { margin-left: 14px; }
42
+ #HTMLReporter .summary .specSummary.passed a { color: #5e7d00; }
43
+ #HTMLReporter .summary .specSummary.failed a { color: #b03911; }
44
+ #HTMLReporter .description + .suite { margin-top: 0; }
45
+ #HTMLReporter .suite { margin-top: 14px; }
46
+ #HTMLReporter .suite a { color: #333333; }
47
+ #HTMLReporter #details .specDetail { margin-bottom: 28px; }
48
+ #HTMLReporter #details .specDetail .description { display: block; color: white; background-color: #b03911; }
49
+ #HTMLReporter .resultMessage { padding-top: 14px; color: #333333; }
50
+ #HTMLReporter .resultMessage span.result { display: block; }
51
+ #HTMLReporter .stackTrace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; }
52
+
53
+ #TrivialReporter { padding: 8px 13px; position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow-y: scroll; background-color: white; font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; /*.resultMessage {*/ /*white-space: pre;*/ /*}*/ }
54
+ #TrivialReporter a:visited, #TrivialReporter a { color: #303; }
55
+ #TrivialReporter a:hover, #TrivialReporter a:active { color: blue; }
56
+ #TrivialReporter .run_spec { float: right; padding-right: 5px; font-size: .8em; text-decoration: none; }
57
+ #TrivialReporter .banner { color: #303; background-color: #fef; padding: 5px; }
58
+ #TrivialReporter .logo { float: left; font-size: 1.1em; padding-left: 5px; }
59
+ #TrivialReporter .logo .version { font-size: .6em; padding-left: 1em; }
60
+ #TrivialReporter .runner.running { background-color: yellow; }
61
+ #TrivialReporter .options { text-align: right; font-size: .8em; }
62
+ #TrivialReporter .suite { border: 1px outset gray; margin: 5px 0; padding-left: 1em; }
63
+ #TrivialReporter .suite .suite { margin: 5px; }
64
+ #TrivialReporter .suite.passed { background-color: #dfd; }
65
+ #TrivialReporter .suite.failed { background-color: #fdd; }
66
+ #TrivialReporter .spec { margin: 5px; padding-left: 1em; clear: both; }
67
+ #TrivialReporter .spec.failed, #TrivialReporter .spec.passed, #TrivialReporter .spec.skipped { padding-bottom: 5px; border: 1px solid gray; }
68
+ #TrivialReporter .spec.failed { background-color: #fbb; border-color: red; }
69
+ #TrivialReporter .spec.passed { background-color: #bfb; border-color: green; }
70
+ #TrivialReporter .spec.skipped { background-color: #bbb; }
71
+ #TrivialReporter .messages { border-left: 1px dashed gray; padding-left: 1em; padding-right: 1em; }
72
+ #TrivialReporter .passed { background-color: #cfc; display: none; }
73
+ #TrivialReporter .failed { background-color: #fbb; }
74
+ #TrivialReporter .skipped { color: #777; background-color: #eee; display: none; }
75
+ #TrivialReporter .resultMessage span.result { display: block; line-height: 2em; color: black; }
76
+ #TrivialReporter .resultMessage .mismatch { color: black; }
77
+ #TrivialReporter .stackTrace { white-space: pre; font-size: .8em; margin-left: 10px; max-height: 5em; overflow: auto; border: 1px inset red; padding: 1em; background: #eef; }
78
+ #TrivialReporter .finished-at { padding-left: 1em; font-size: .6em; }
79
+ #TrivialReporter.show-passed .passed, #TrivialReporter.show-skipped .skipped { display: block; }
80
+ #TrivialReporter #jasmine_content { position: fixed; right: 100%; }
81
+ #TrivialReporter .runner { border: 1px solid gray; display: block; margin: 5px 0; padding: 2px 0 2px 10px; }
@@ -196,6 +196,21 @@ jasmine.any = function(clazz) {
196
196
  return new jasmine.Matchers.Any(clazz);
197
197
  };
198
198
 
199
+ /**
200
+ * Returns a matchable subset of a JSON object. For use in expectations when you don't care about all of the
201
+ * attributes on the object.
202
+ *
203
+ * @example
204
+ * // don't care about any other attributes than foo.
205
+ * expect(mySpy).toHaveBeenCalledWith(jasmine.objectContaining({foo: "bar"});
206
+ *
207
+ * @param sample {Object} sample
208
+ * @returns matchable object for the sample
209
+ */
210
+ jasmine.objectContaining = function (sample) {
211
+ return new jasmine.Matchers.ObjectContaining(sample);
212
+ };
213
+
199
214
  /**
200
215
  * Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks.
201
216
  *
@@ -914,11 +929,19 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
914
929
  return a.getTime() == b.getTime();
915
930
  }
916
931
 
917
- if (a instanceof jasmine.Matchers.Any) {
932
+ if (a.jasmineMatches) {
933
+ return a.jasmineMatches(b);
934
+ }
935
+
936
+ if (b.jasmineMatches) {
937
+ return b.jasmineMatches(a);
938
+ }
939
+
940
+ if (a instanceof jasmine.Matchers.ObjectContaining) {
918
941
  return a.matches(b);
919
942
  }
920
943
 
921
- if (b instanceof jasmine.Matchers.Any) {
944
+ if (b instanceof jasmine.Matchers.ObjectContaining) {
922
945
  return b.matches(a);
923
946
  }
924
947
 
@@ -1212,7 +1235,7 @@ jasmine.Matchers.prototype.toEqual = function(expected) {
1212
1235
  /**
1213
1236
  * toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual
1214
1237
  * @param expected
1215
- * @deprecated as of 1.0. Use not.toNotEqual() instead.
1238
+ * @deprecated as of 1.0. Use not.toEqual() instead.
1216
1239
  */
1217
1240
  jasmine.Matchers.prototype.toNotEqual = function(expected) {
1218
1241
  return !this.env.equals_(this.actual, expected);
@@ -1385,7 +1408,7 @@ jasmine.Matchers.prototype.toContain = function(expected) {
1385
1408
  * Matcher that checks that the expected item is NOT an element in the actual Array.
1386
1409
  *
1387
1410
  * @param {Object} expected
1388
- * @deprecated as of 1.0. Use not.toNotContain() instead.
1411
+ * @deprecated as of 1.0. Use not.toContain() instead.
1389
1412
  */
1390
1413
  jasmine.Matchers.prototype.toNotContain = function(expected) {
1391
1414
  return !this.env.contains_(this.actual, expected);
@@ -1453,7 +1476,7 @@ jasmine.Matchers.Any = function(expectedClass) {
1453
1476
  this.expectedClass = expectedClass;
1454
1477
  };
1455
1478
 
1456
- jasmine.Matchers.Any.prototype.matches = function(other) {
1479
+ jasmine.Matchers.Any.prototype.jasmineMatches = function(other) {
1457
1480
  if (this.expectedClass == String) {
1458
1481
  return typeof other == 'string' || other instanceof String;
1459
1482
  }
@@ -1473,10 +1496,222 @@ jasmine.Matchers.Any.prototype.matches = function(other) {
1473
1496
  return other instanceof this.expectedClass;
1474
1497
  };
1475
1498
 
1476
- jasmine.Matchers.Any.prototype.toString = function() {
1499
+ jasmine.Matchers.Any.prototype.jasmineToString = function() {
1477
1500
  return '<jasmine.any(' + this.expectedClass + ')>';
1478
1501
  };
1479
1502
 
1503
+ jasmine.Matchers.ObjectContaining = function (sample) {
1504
+ this.sample = sample;
1505
+ };
1506
+
1507
+ jasmine.Matchers.ObjectContaining.prototype.jasmineMatches = function(other, mismatchKeys, mismatchValues) {
1508
+ mismatchKeys = mismatchKeys || [];
1509
+ mismatchValues = mismatchValues || [];
1510
+
1511
+ var env = jasmine.getEnv();
1512
+
1513
+ var hasKey = function(obj, keyName) {
1514
+ return obj != null && obj[keyName] !== jasmine.undefined;
1515
+ };
1516
+
1517
+ for (var property in this.sample) {
1518
+ if (!hasKey(other, property) && hasKey(this.sample, property)) {
1519
+ mismatchKeys.push("expected has key '" + property + "', but missing from actual.");
1520
+ }
1521
+ else if (!env.equals_(this.sample[property], other[property], mismatchKeys, mismatchValues)) {
1522
+ mismatchValues.push("'" + property + "' was '" + (other[property] ? jasmine.util.htmlEscape(other[property].toString()) : other[property]) + "' in expected, but was '" + (this.sample[property] ? jasmine.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + "' in actual.");
1523
+ }
1524
+ }
1525
+
1526
+ return (mismatchKeys.length === 0 && mismatchValues.length === 0);
1527
+ };
1528
+
1529
+ jasmine.Matchers.ObjectContaining.prototype.jasmineToString = function () {
1530
+ return "<jasmine.objectContaining(" + jasmine.pp(this.sample) + ")>";
1531
+ };
1532
+ // Mock setTimeout, clearTimeout
1533
+ // Contributed by Pivotal Computer Systems, www.pivotalsf.com
1534
+
1535
+ jasmine.FakeTimer = function() {
1536
+ this.reset();
1537
+
1538
+ var self = this;
1539
+ self.setTimeout = function(funcToCall, millis) {
1540
+ self.timeoutsMade++;
1541
+ self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
1542
+ return self.timeoutsMade;
1543
+ };
1544
+
1545
+ self.setInterval = function(funcToCall, millis) {
1546
+ self.timeoutsMade++;
1547
+ self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
1548
+ return self.timeoutsMade;
1549
+ };
1550
+
1551
+ self.clearTimeout = function(timeoutKey) {
1552
+ self.scheduledFunctions[timeoutKey] = jasmine.undefined;
1553
+ };
1554
+
1555
+ self.clearInterval = function(timeoutKey) {
1556
+ self.scheduledFunctions[timeoutKey] = jasmine.undefined;
1557
+ };
1558
+
1559
+ };
1560
+
1561
+ jasmine.FakeTimer.prototype.reset = function() {
1562
+ this.timeoutsMade = 0;
1563
+ this.scheduledFunctions = {};
1564
+ this.nowMillis = 0;
1565
+ };
1566
+
1567
+ jasmine.FakeTimer.prototype.tick = function(millis) {
1568
+ var oldMillis = this.nowMillis;
1569
+ var newMillis = oldMillis + millis;
1570
+ this.runFunctionsWithinRange(oldMillis, newMillis);
1571
+ this.nowMillis = newMillis;
1572
+ };
1573
+
1574
+ jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
1575
+ var scheduledFunc;
1576
+ var funcsToRun = [];
1577
+ for (var timeoutKey in this.scheduledFunctions) {
1578
+ scheduledFunc = this.scheduledFunctions[timeoutKey];
1579
+ if (scheduledFunc != jasmine.undefined &&
1580
+ scheduledFunc.runAtMillis >= oldMillis &&
1581
+ scheduledFunc.runAtMillis <= nowMillis) {
1582
+ funcsToRun.push(scheduledFunc);
1583
+ this.scheduledFunctions[timeoutKey] = jasmine.undefined;
1584
+ }
1585
+ }
1586
+
1587
+ if (funcsToRun.length > 0) {
1588
+ funcsToRun.sort(function(a, b) {
1589
+ return a.runAtMillis - b.runAtMillis;
1590
+ });
1591
+ for (var i = 0; i < funcsToRun.length; ++i) {
1592
+ try {
1593
+ var funcToRun = funcsToRun[i];
1594
+ this.nowMillis = funcToRun.runAtMillis;
1595
+ funcToRun.funcToCall();
1596
+ if (funcToRun.recurring) {
1597
+ this.scheduleFunction(funcToRun.timeoutKey,
1598
+ funcToRun.funcToCall,
1599
+ funcToRun.millis,
1600
+ true);
1601
+ }
1602
+ } catch(e) {
1603
+ }
1604
+ }
1605
+ this.runFunctionsWithinRange(oldMillis, nowMillis);
1606
+ }
1607
+ };
1608
+
1609
+ jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
1610
+ this.scheduledFunctions[timeoutKey] = {
1611
+ runAtMillis: this.nowMillis + millis,
1612
+ funcToCall: funcToCall,
1613
+ recurring: recurring,
1614
+ timeoutKey: timeoutKey,
1615
+ millis: millis
1616
+ };
1617
+ };
1618
+
1619
+ /**
1620
+ * @namespace
1621
+ */
1622
+ jasmine.Clock = {
1623
+ defaultFakeTimer: new jasmine.FakeTimer(),
1624
+
1625
+ reset: function() {
1626
+ jasmine.Clock.assertInstalled();
1627
+ jasmine.Clock.defaultFakeTimer.reset();
1628
+ },
1629
+
1630
+ tick: function(millis) {
1631
+ jasmine.Clock.assertInstalled();
1632
+ jasmine.Clock.defaultFakeTimer.tick(millis);
1633
+ },
1634
+
1635
+ runFunctionsWithinRange: function(oldMillis, nowMillis) {
1636
+ jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
1637
+ },
1638
+
1639
+ scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
1640
+ jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
1641
+ },
1642
+
1643
+ useMock: function() {
1644
+ if (!jasmine.Clock.isInstalled()) {
1645
+ var spec = jasmine.getEnv().currentSpec;
1646
+ spec.after(jasmine.Clock.uninstallMock);
1647
+
1648
+ jasmine.Clock.installMock();
1649
+ }
1650
+ },
1651
+
1652
+ installMock: function() {
1653
+ jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
1654
+ },
1655
+
1656
+ uninstallMock: function() {
1657
+ jasmine.Clock.assertInstalled();
1658
+ jasmine.Clock.installed = jasmine.Clock.real;
1659
+ },
1660
+
1661
+ real: {
1662
+ setTimeout: jasmine.getGlobal().setTimeout,
1663
+ clearTimeout: jasmine.getGlobal().clearTimeout,
1664
+ setInterval: jasmine.getGlobal().setInterval,
1665
+ clearInterval: jasmine.getGlobal().clearInterval
1666
+ },
1667
+
1668
+ assertInstalled: function() {
1669
+ if (!jasmine.Clock.isInstalled()) {
1670
+ throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
1671
+ }
1672
+ },
1673
+
1674
+ isInstalled: function() {
1675
+ return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer;
1676
+ },
1677
+
1678
+ installed: null
1679
+ };
1680
+ jasmine.Clock.installed = jasmine.Clock.real;
1681
+
1682
+ //else for IE support
1683
+ jasmine.getGlobal().setTimeout = function(funcToCall, millis) {
1684
+ if (jasmine.Clock.installed.setTimeout.apply) {
1685
+ return jasmine.Clock.installed.setTimeout.apply(this, arguments);
1686
+ } else {
1687
+ return jasmine.Clock.installed.setTimeout(funcToCall, millis);
1688
+ }
1689
+ };
1690
+
1691
+ jasmine.getGlobal().setInterval = function(funcToCall, millis) {
1692
+ if (jasmine.Clock.installed.setInterval.apply) {
1693
+ return jasmine.Clock.installed.setInterval.apply(this, arguments);
1694
+ } else {
1695
+ return jasmine.Clock.installed.setInterval(funcToCall, millis);
1696
+ }
1697
+ };
1698
+
1699
+ jasmine.getGlobal().clearTimeout = function(timeoutKey) {
1700
+ if (jasmine.Clock.installed.clearTimeout.apply) {
1701
+ return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
1702
+ } else {
1703
+ return jasmine.Clock.installed.clearTimeout(timeoutKey);
1704
+ }
1705
+ };
1706
+
1707
+ jasmine.getGlobal().clearInterval = function(timeoutKey) {
1708
+ if (jasmine.Clock.installed.clearTimeout.apply) {
1709
+ return jasmine.Clock.installed.clearInterval.apply(this, arguments);
1710
+ } else {
1711
+ return jasmine.Clock.installed.clearInterval(timeoutKey);
1712
+ }
1713
+ };
1714
+
1480
1715
  /**
1481
1716
  * @constructor
1482
1717
  */
@@ -1617,8 +1852,8 @@ jasmine.PrettyPrinter.prototype.format = function(value) {
1617
1852
  this.emitScalar('null');
1618
1853
  } else if (value === jasmine.getGlobal()) {
1619
1854
  this.emitScalar('<global>');
1620
- } else if (value instanceof jasmine.Matchers.Any) {
1621
- this.emitScalar(value.toString());
1855
+ } else if (value.jasmineToString) {
1856
+ this.emitScalar(value.jasmineToString());
1622
1857
  } else if (typeof value === 'string') {
1623
1858
  this.emitString(value);
1624
1859
  } else if (jasmine.isSpy(value)) {
@@ -2285,192 +2520,10 @@ jasmine.WaitsForBlock.prototype.execute = function(onComplete) {
2285
2520
  }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT);
2286
2521
  }
2287
2522
  };
2288
- // Mock setTimeout, clearTimeout
2289
- // Contributed by Pivotal Computer Systems, www.pivotalsf.com
2290
-
2291
- jasmine.FakeTimer = function() {
2292
- this.reset();
2293
-
2294
- var self = this;
2295
- self.setTimeout = function(funcToCall, millis) {
2296
- self.timeoutsMade++;
2297
- self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
2298
- return self.timeoutsMade;
2299
- };
2300
-
2301
- self.setInterval = function(funcToCall, millis) {
2302
- self.timeoutsMade++;
2303
- self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
2304
- return self.timeoutsMade;
2305
- };
2306
-
2307
- self.clearTimeout = function(timeoutKey) {
2308
- self.scheduledFunctions[timeoutKey] = jasmine.undefined;
2309
- };
2310
-
2311
- self.clearInterval = function(timeoutKey) {
2312
- self.scheduledFunctions[timeoutKey] = jasmine.undefined;
2313
- };
2314
-
2315
- };
2316
-
2317
- jasmine.FakeTimer.prototype.reset = function() {
2318
- this.timeoutsMade = 0;
2319
- this.scheduledFunctions = {};
2320
- this.nowMillis = 0;
2321
- };
2322
-
2323
- jasmine.FakeTimer.prototype.tick = function(millis) {
2324
- var oldMillis = this.nowMillis;
2325
- var newMillis = oldMillis + millis;
2326
- this.runFunctionsWithinRange(oldMillis, newMillis);
2327
- this.nowMillis = newMillis;
2328
- };
2329
-
2330
- jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
2331
- var scheduledFunc;
2332
- var funcsToRun = [];
2333
- for (var timeoutKey in this.scheduledFunctions) {
2334
- scheduledFunc = this.scheduledFunctions[timeoutKey];
2335
- if (scheduledFunc != jasmine.undefined &&
2336
- scheduledFunc.runAtMillis >= oldMillis &&
2337
- scheduledFunc.runAtMillis <= nowMillis) {
2338
- funcsToRun.push(scheduledFunc);
2339
- this.scheduledFunctions[timeoutKey] = jasmine.undefined;
2340
- }
2341
- }
2342
-
2343
- if (funcsToRun.length > 0) {
2344
- funcsToRun.sort(function(a, b) {
2345
- return a.runAtMillis - b.runAtMillis;
2346
- });
2347
- for (var i = 0; i < funcsToRun.length; ++i) {
2348
- try {
2349
- var funcToRun = funcsToRun[i];
2350
- this.nowMillis = funcToRun.runAtMillis;
2351
- funcToRun.funcToCall();
2352
- if (funcToRun.recurring) {
2353
- this.scheduleFunction(funcToRun.timeoutKey,
2354
- funcToRun.funcToCall,
2355
- funcToRun.millis,
2356
- true);
2357
- }
2358
- } catch(e) {
2359
- }
2360
- }
2361
- this.runFunctionsWithinRange(oldMillis, nowMillis);
2362
- }
2363
- };
2364
-
2365
- jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
2366
- this.scheduledFunctions[timeoutKey] = {
2367
- runAtMillis: this.nowMillis + millis,
2368
- funcToCall: funcToCall,
2369
- recurring: recurring,
2370
- timeoutKey: timeoutKey,
2371
- millis: millis
2372
- };
2373
- };
2374
-
2375
- /**
2376
- * @namespace
2377
- */
2378
- jasmine.Clock = {
2379
- defaultFakeTimer: new jasmine.FakeTimer(),
2380
-
2381
- reset: function() {
2382
- jasmine.Clock.assertInstalled();
2383
- jasmine.Clock.defaultFakeTimer.reset();
2384
- },
2385
-
2386
- tick: function(millis) {
2387
- jasmine.Clock.assertInstalled();
2388
- jasmine.Clock.defaultFakeTimer.tick(millis);
2389
- },
2390
-
2391
- runFunctionsWithinRange: function(oldMillis, nowMillis) {
2392
- jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
2393
- },
2394
-
2395
- scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
2396
- jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
2397
- },
2398
-
2399
- useMock: function() {
2400
- if (!jasmine.Clock.isInstalled()) {
2401
- var spec = jasmine.getEnv().currentSpec;
2402
- spec.after(jasmine.Clock.uninstallMock);
2403
-
2404
- jasmine.Clock.installMock();
2405
- }
2406
- },
2407
-
2408
- installMock: function() {
2409
- jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
2410
- },
2411
-
2412
- uninstallMock: function() {
2413
- jasmine.Clock.assertInstalled();
2414
- jasmine.Clock.installed = jasmine.Clock.real;
2415
- },
2416
-
2417
- real: {
2418
- setTimeout: jasmine.getGlobal().setTimeout,
2419
- clearTimeout: jasmine.getGlobal().clearTimeout,
2420
- setInterval: jasmine.getGlobal().setInterval,
2421
- clearInterval: jasmine.getGlobal().clearInterval
2422
- },
2423
-
2424
- assertInstalled: function() {
2425
- if (!jasmine.Clock.isInstalled()) {
2426
- throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
2427
- }
2428
- },
2429
-
2430
- isInstalled: function() {
2431
- return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer;
2432
- },
2433
-
2434
- installed: null
2435
- };
2436
- jasmine.Clock.installed = jasmine.Clock.real;
2437
-
2438
- //else for IE support
2439
- jasmine.getGlobal().setTimeout = function(funcToCall, millis) {
2440
- if (jasmine.Clock.installed.setTimeout.apply) {
2441
- return jasmine.Clock.installed.setTimeout.apply(this, arguments);
2442
- } else {
2443
- return jasmine.Clock.installed.setTimeout(funcToCall, millis);
2444
- }
2445
- };
2446
-
2447
- jasmine.getGlobal().setInterval = function(funcToCall, millis) {
2448
- if (jasmine.Clock.installed.setInterval.apply) {
2449
- return jasmine.Clock.installed.setInterval.apply(this, arguments);
2450
- } else {
2451
- return jasmine.Clock.installed.setInterval(funcToCall, millis);
2452
- }
2453
- };
2454
-
2455
- jasmine.getGlobal().clearTimeout = function(timeoutKey) {
2456
- if (jasmine.Clock.installed.clearTimeout.apply) {
2457
- return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
2458
- } else {
2459
- return jasmine.Clock.installed.clearTimeout(timeoutKey);
2460
- }
2461
- };
2462
-
2463
- jasmine.getGlobal().clearInterval = function(timeoutKey) {
2464
- if (jasmine.Clock.installed.clearTimeout.apply) {
2465
- return jasmine.Clock.installed.clearInterval.apply(this, arguments);
2466
- } else {
2467
- return jasmine.Clock.installed.clearInterval(timeoutKey);
2468
- }
2469
- };
2470
2523
 
2471
2524
  jasmine.version_= {
2472
2525
  "major": 1,
2473
- "minor": 1,
2526
+ "minor": 2,
2474
2527
  "build": 0,
2475
- "revision": 1315677058
2528
+ "revision": 1337005947
2476
2529
  };