jasmine 1.0.2.1 → 1.1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile +0 -3
  3. data/README.markdown +7 -1
  4. data/Rakefile +10 -24
  5. data/generators/jasmine/templates/jasmine-example/SpecRunner.html +40 -13
  6. data/generators/jasmine/templates/jasmine-example/spec/SpecHelper.js +3 -3
  7. data/jasmine.gemspec +18 -8
  8. data/lib/generators/jasmine/templates/lib/tasks/jasmine.rake +8 -2
  9. data/lib/jasmine/base.rb +9 -6
  10. data/lib/jasmine/command_line_tool.rb +1 -1
  11. data/lib/jasmine/firebug/firebug-1.6.2.xpi +0 -0
  12. data/lib/jasmine/firebug/firebug-1.7.0.xpi +0 -0
  13. data/lib/jasmine/firebug/firebug-license.txt +30 -0
  14. data/lib/jasmine/firebug/firebug.rb +30 -0
  15. data/lib/jasmine/selenium_driver.rb +8 -2
  16. data/lib/jasmine/server.rb +4 -7
  17. data/lib/jasmine/tasks/jasmine.rake +15 -6
  18. data/lib/jasmine/version.rb +1 -1
  19. data/spec/fixture/Rakefile +4 -0
  20. data/spec/fixture/spec/example_spec.js +5 -0
  21. data/spec/fixture/src/example.js +3 -0
  22. data/spec/jasmine_command_line_tool_rakeless_spec.rb +20 -0
  23. data/spec/jasmine_rails2_spec.rb +1 -1
  24. data/spec/jasmine_self_test_config.rb +6 -2
  25. data/spec/jasmine_self_test_spec.rb +0 -1
  26. data/spec/server_spec.rb +12 -11
  27. metadata +39 -92
  28. data/.gitmodules +0 -3
  29. data/jasmine/Gemfile +0 -6
  30. data/jasmine/HowToRelease.markdown +0 -29
  31. data/jasmine/MIT.LICENSE +0 -20
  32. data/jasmine/README.markdown +0 -50
  33. data/jasmine/Rakefile +0 -166
  34. data/jasmine/cruise_config.rb +0 -21
  35. data/jasmine/example/SpecRunner.html +0 -27
  36. data/jasmine/example/spec/PlayerSpec.js +0 -58
  37. data/jasmine/example/spec/SpecHelper.js +0 -9
  38. data/jasmine/example/src/Player.js +0 -22
  39. data/jasmine/example/src/Song.js +0 -7
  40. data/jasmine/images/jasmine_favicon.png +0 -0
  41. data/jasmine/jsdoc-template/allclasses.tmpl +0 -17
  42. data/jasmine/jsdoc-template/allfiles.tmpl +0 -56
  43. data/jasmine/jsdoc-template/class.tmpl +0 -646
  44. data/jasmine/jsdoc-template/index.tmpl +0 -39
  45. data/jasmine/jsdoc-template/publish.js +0 -184
  46. data/jasmine/jsdoc-template/static/default.css +0 -162
  47. data/jasmine/jsdoc-template/static/header.html +0 -2
  48. data/jasmine/jsdoc-template/static/index.html +0 -19
  49. data/jasmine/jsdoc-template/symbol.tmpl +0 -35
  50. data/jasmine/jshint/jshint.js +0 -5919
  51. data/jasmine/jshint/run.js +0 -98
  52. data/jasmine/lib/jasmine-html.js +0 -190
  53. data/jasmine/lib/jasmine.css +0 -166
  54. data/jasmine/lib/jasmine.js +0 -2445
  55. data/jasmine/lib/json2.js +0 -478
  56. data/jasmine/spec/node_suite.js +0 -233
  57. data/jasmine/spec/runner.html +0 -82
  58. data/jasmine/spec/suites/BaseSpec.js +0 -27
  59. data/jasmine/spec/suites/CustomMatchersSpec.js +0 -97
  60. data/jasmine/spec/suites/EnvSpec.js +0 -158
  61. data/jasmine/spec/suites/ExceptionsSpec.js +0 -107
  62. data/jasmine/spec/suites/JsApiReporterSpec.js +0 -103
  63. data/jasmine/spec/suites/MatchersSpec.js +0 -795
  64. data/jasmine/spec/suites/MockClockSpec.js +0 -38
  65. data/jasmine/spec/suites/MultiReporterSpec.js +0 -45
  66. data/jasmine/spec/suites/NestedResultsSpec.js +0 -54
  67. data/jasmine/spec/suites/PrettyPrintSpec.js +0 -93
  68. data/jasmine/spec/suites/QueueSpec.js +0 -23
  69. data/jasmine/spec/suites/ReporterSpec.js +0 -56
  70. data/jasmine/spec/suites/RunnerSpec.js +0 -267
  71. data/jasmine/spec/suites/SpecRunningSpec.js +0 -1253
  72. data/jasmine/spec/suites/SpecSpec.js +0 -124
  73. data/jasmine/spec/suites/SpySpec.js +0 -201
  74. data/jasmine/spec/suites/SuiteSpec.js +0 -120
  75. data/jasmine/spec/suites/TrivialConsoleReporterSpec.js +0 -431
  76. data/jasmine/spec/suites/TrivialReporterSpec.js +0 -238
  77. data/jasmine/spec/suites/UtilSpec.js +0 -39
  78. data/jasmine/spec/suites/WaitsForBlockSpec.js +0 -118
  79. data/jasmine/src/Block.js +0 -22
  80. data/jasmine/src/Env.js +0 -264
  81. data/jasmine/src/JsApiReporter.js +0 -102
  82. data/jasmine/src/Matchers.js +0 -354
  83. data/jasmine/src/MultiReporter.js +0 -35
  84. data/jasmine/src/NestedResults.js +0 -80
  85. data/jasmine/src/PrettyPrinter.js +0 -123
  86. data/jasmine/src/Queue.js +0 -99
  87. data/jasmine/src/Reporter.js +0 -31
  88. data/jasmine/src/Runner.js +0 -77
  89. data/jasmine/src/Spec.js +0 -242
  90. data/jasmine/src/Suite.js +0 -82
  91. data/jasmine/src/WaitsBlock.js +0 -15
  92. data/jasmine/src/WaitsForBlock.js +0 -54
  93. data/jasmine/src/base.js +0 -608
  94. data/jasmine/src/console/TrivialConsoleReporter.js +0 -144
  95. data/jasmine/src/html/TrivialReporter.js +0 -190
  96. data/jasmine/src/html/jasmine.css +0 -166
  97. data/jasmine/src/mock-timeout.js +0 -183
  98. data/jasmine/src/util.js +0 -67
  99. data/jasmine/src/version.json +0 -5
@@ -1,102 +0,0 @@
1
- /** JavaScript API reporter.
2
- *
3
- * @constructor
4
- */
5
- jasmine.JsApiReporter = function() {
6
- this.started = false;
7
- this.finished = false;
8
- this.suites_ = [];
9
- this.results_ = {};
10
- };
11
-
12
- jasmine.JsApiReporter.prototype.reportRunnerStarting = function(runner) {
13
- this.started = true;
14
- var suites = runner.topLevelSuites();
15
- for (var i = 0; i < suites.length; i++) {
16
- var suite = suites[i];
17
- this.suites_.push(this.summarize_(suite));
18
- }
19
- };
20
-
21
- jasmine.JsApiReporter.prototype.suites = function() {
22
- return this.suites_;
23
- };
24
-
25
- jasmine.JsApiReporter.prototype.summarize_ = function(suiteOrSpec) {
26
- var isSuite = suiteOrSpec instanceof jasmine.Suite;
27
- var summary = {
28
- id: suiteOrSpec.id,
29
- name: suiteOrSpec.description,
30
- type: isSuite ? 'suite' : 'spec',
31
- children: []
32
- };
33
-
34
- if (isSuite) {
35
- var children = suiteOrSpec.children();
36
- for (var i = 0; i < children.length; i++) {
37
- summary.children.push(this.summarize_(children[i]));
38
- }
39
- }
40
- return summary;
41
- };
42
-
43
- jasmine.JsApiReporter.prototype.results = function() {
44
- return this.results_;
45
- };
46
-
47
- jasmine.JsApiReporter.prototype.resultsForSpec = function(specId) {
48
- return this.results_[specId];
49
- };
50
-
51
- //noinspection JSUnusedLocalSymbols
52
- jasmine.JsApiReporter.prototype.reportRunnerResults = function(runner) {
53
- this.finished = true;
54
- };
55
-
56
- //noinspection JSUnusedLocalSymbols
57
- jasmine.JsApiReporter.prototype.reportSuiteResults = function(suite) {
58
- };
59
-
60
- //noinspection JSUnusedLocalSymbols
61
- jasmine.JsApiReporter.prototype.reportSpecResults = function(spec) {
62
- this.results_[spec.id] = {
63
- messages: spec.results().getItems(),
64
- result: spec.results().failedCount > 0 ? "failed" : "passed"
65
- };
66
- };
67
-
68
- //noinspection JSUnusedLocalSymbols
69
- jasmine.JsApiReporter.prototype.log = function(str) {
70
- };
71
-
72
- jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){
73
- var results = {};
74
- for (var i = 0; i < specIds.length; i++) {
75
- var specId = specIds[i];
76
- results[specId] = this.summarizeResult_(this.results_[specId]);
77
- }
78
- return results;
79
- };
80
-
81
- jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
82
- var summaryMessages = [];
83
- var messagesLength = result.messages.length;
84
- for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) {
85
- var resultMessage = result.messages[messageIndex];
86
- summaryMessages.push({
87
- text: resultMessage.type == 'log' ? resultMessage.toString() : jasmine.undefined,
88
- passed: resultMessage.passed ? resultMessage.passed() : true,
89
- type: resultMessage.type,
90
- message: resultMessage.message,
91
- trace: {
92
- stack: resultMessage.passed && !resultMessage.passed() ? resultMessage.trace.stack : jasmine.undefined
93
- }
94
- });
95
- }
96
-
97
- return {
98
- result : result.result,
99
- messages : summaryMessages
100
- };
101
- };
102
-
@@ -1,354 +0,0 @@
1
- /**
2
- * @constructor
3
- * @param {jasmine.Env} env
4
- * @param actual
5
- * @param {jasmine.Spec} spec
6
- */
7
- jasmine.Matchers = function(env, actual, spec, opt_isNot) {
8
- this.env = env;
9
- this.actual = actual;
10
- this.spec = spec;
11
- this.isNot = opt_isNot || false;
12
- this.reportWasCalled_ = false;
13
- };
14
-
15
- // todo: @deprecated as of Jasmine 0.11, remove soon [xw]
16
- jasmine.Matchers.pp = function(str) {
17
- throw new Error("jasmine.Matchers.pp() is no longer supported, please use jasmine.pp() instead!");
18
- };
19
-
20
- // todo: @deprecated Deprecated as of Jasmine 0.10. Rewrite your custom matchers to return true or false. [xw]
21
- jasmine.Matchers.prototype.report = function(result, failing_message, details) {
22
- throw new Error("As of jasmine 0.11, custom matchers must be implemented differently -- please see jasmine docs");
23
- };
24
-
25
- jasmine.Matchers.wrapInto_ = function(prototype, matchersClass) {
26
- for (var methodName in prototype) {
27
- if (methodName == 'report') continue;
28
- var orig = prototype[methodName];
29
- matchersClass.prototype[methodName] = jasmine.Matchers.matcherFn_(methodName, orig);
30
- }
31
- };
32
-
33
- jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) {
34
- return function() {
35
- var matcherArgs = jasmine.util.argsToArray(arguments);
36
- var result = matcherFunction.apply(this, arguments);
37
-
38
- if (this.isNot) {
39
- result = !result;
40
- }
41
-
42
- if (this.reportWasCalled_) return result;
43
-
44
- var message;
45
- if (!result) {
46
- if (this.message) {
47
- message = this.message.apply(this, arguments);
48
- if (jasmine.isArray_(message)) {
49
- message = message[this.isNot ? 1 : 0];
50
- }
51
- } else {
52
- var englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); });
53
- message = "Expected " + jasmine.pp(this.actual) + (this.isNot ? " not " : " ") + englishyPredicate;
54
- if (matcherArgs.length > 0) {
55
- for (var i = 0; i < matcherArgs.length; i++) {
56
- if (i > 0) message += ",";
57
- message += " " + jasmine.pp(matcherArgs[i]);
58
- }
59
- }
60
- message += ".";
61
- }
62
- }
63
- var expectationResult = new jasmine.ExpectationResult({
64
- matcherName: matcherName,
65
- passed: result,
66
- expected: matcherArgs.length > 1 ? matcherArgs : matcherArgs[0],
67
- actual: this.actual,
68
- message: message
69
- });
70
- this.spec.addMatcherResult(expectationResult);
71
- return jasmine.undefined;
72
- };
73
- };
74
-
75
-
76
-
77
-
78
- /**
79
- * toBe: compares the actual to the expected using ===
80
- * @param expected
81
- */
82
- jasmine.Matchers.prototype.toBe = function(expected) {
83
- return this.actual === expected;
84
- };
85
-
86
- /**
87
- * toNotBe: compares the actual to the expected using !==
88
- * @param expected
89
- * @deprecated as of 1.0. Use not.toBe() instead.
90
- */
91
- jasmine.Matchers.prototype.toNotBe = function(expected) {
92
- return this.actual !== expected;
93
- };
94
-
95
- /**
96
- * toEqual: compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc.
97
- *
98
- * @param expected
99
- */
100
- jasmine.Matchers.prototype.toEqual = function(expected) {
101
- return this.env.equals_(this.actual, expected);
102
- };
103
-
104
- /**
105
- * toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual
106
- * @param expected
107
- * @deprecated as of 1.0. Use not.toNotEqual() instead.
108
- */
109
- jasmine.Matchers.prototype.toNotEqual = function(expected) {
110
- return !this.env.equals_(this.actual, expected);
111
- };
112
-
113
- /**
114
- * Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes
115
- * a pattern or a String.
116
- *
117
- * @param expected
118
- */
119
- jasmine.Matchers.prototype.toMatch = function(expected) {
120
- return new RegExp(expected).test(this.actual);
121
- };
122
-
123
- /**
124
- * Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch
125
- * @param expected
126
- * @deprecated as of 1.0. Use not.toMatch() instead.
127
- */
128
- jasmine.Matchers.prototype.toNotMatch = function(expected) {
129
- return !(new RegExp(expected).test(this.actual));
130
- };
131
-
132
- /**
133
- * Matcher that compares the actual to jasmine.undefined.
134
- */
135
- jasmine.Matchers.prototype.toBeDefined = function() {
136
- return (this.actual !== jasmine.undefined);
137
- };
138
-
139
- /**
140
- * Matcher that compares the actual to jasmine.undefined.
141
- */
142
- jasmine.Matchers.prototype.toBeUndefined = function() {
143
- return (this.actual === jasmine.undefined);
144
- };
145
-
146
- /**
147
- * Matcher that compares the actual to null.
148
- */
149
- jasmine.Matchers.prototype.toBeNull = function() {
150
- return (this.actual === null);
151
- };
152
-
153
- /**
154
- * Matcher that boolean not-nots the actual.
155
- */
156
- jasmine.Matchers.prototype.toBeTruthy = function() {
157
- return !!this.actual;
158
- };
159
-
160
-
161
- /**
162
- * Matcher that boolean nots the actual.
163
- */
164
- jasmine.Matchers.prototype.toBeFalsy = function() {
165
- return !this.actual;
166
- };
167
-
168
-
169
- /**
170
- * Matcher that checks to see if the actual, a Jasmine spy, was called.
171
- */
172
- jasmine.Matchers.prototype.toHaveBeenCalled = function() {
173
- if (arguments.length > 0) {
174
- throw new Error('toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith');
175
- }
176
-
177
- if (!jasmine.isSpy(this.actual)) {
178
- throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
179
- }
180
-
181
- this.message = function() {
182
- return [
183
- "Expected spy " + this.actual.identity + " to have been called.",
184
- "Expected spy " + this.actual.identity + " not to have been called."
185
- ];
186
- };
187
-
188
- return this.actual.wasCalled;
189
- };
190
-
191
- /** @deprecated Use expect(xxx).toHaveBeenCalled() instead */
192
- jasmine.Matchers.prototype.wasCalled = jasmine.Matchers.prototype.toHaveBeenCalled;
193
-
194
- /**
195
- * Matcher that checks to see if the actual, a Jasmine spy, was not called.
196
- *
197
- * @deprecated Use expect(xxx).not.toHaveBeenCalled() instead
198
- */
199
- jasmine.Matchers.prototype.wasNotCalled = function() {
200
- if (arguments.length > 0) {
201
- throw new Error('wasNotCalled does not take arguments');
202
- }
203
-
204
- if (!jasmine.isSpy(this.actual)) {
205
- throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
206
- }
207
-
208
- this.message = function() {
209
- return [
210
- "Expected spy " + this.actual.identity + " to not have been called.",
211
- "Expected spy " + this.actual.identity + " to have been called."
212
- ];
213
- };
214
-
215
- return !this.actual.wasCalled;
216
- };
217
-
218
- /**
219
- * Matcher that checks to see if the actual, a Jasmine spy, was called with a set of parameters.
220
- *
221
- * @example
222
- *
223
- */
224
- jasmine.Matchers.prototype.toHaveBeenCalledWith = function() {
225
- var expectedArgs = jasmine.util.argsToArray(arguments);
226
- if (!jasmine.isSpy(this.actual)) {
227
- throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
228
- }
229
- this.message = function() {
230
- if (this.actual.callCount === 0) {
231
- // todo: what should the failure message for .not.toHaveBeenCalledWith() be? is this right? test better. [xw]
232
- return [
233
- "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.",
234
- "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was."
235
- ];
236
- } else {
237
- return [
238
- "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall),
239
- "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall)
240
- ];
241
- }
242
- };
243
-
244
- return this.env.contains_(this.actual.argsForCall, expectedArgs);
245
- };
246
-
247
- /** @deprecated Use expect(xxx).toHaveBeenCalledWith() instead */
248
- jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.prototype.toHaveBeenCalledWith;
249
-
250
- /** @deprecated Use expect(xxx).not.toHaveBeenCalledWith() instead */
251
- jasmine.Matchers.prototype.wasNotCalledWith = function() {
252
- var expectedArgs = jasmine.util.argsToArray(arguments);
253
- if (!jasmine.isSpy(this.actual)) {
254
- throw new Error('Expected a spy, but got ' + jasmine.pp(this.actual) + '.');
255
- }
256
-
257
- this.message = function() {
258
- return [
259
- "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was",
260
- "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was"
261
- ];
262
- };
263
-
264
- return !this.env.contains_(this.actual.argsForCall, expectedArgs);
265
- };
266
-
267
- /**
268
- * Matcher that checks that the expected item is an element in the actual Array.
269
- *
270
- * @param {Object} expected
271
- */
272
- jasmine.Matchers.prototype.toContain = function(expected) {
273
- return this.env.contains_(this.actual, expected);
274
- };
275
-
276
- /**
277
- * Matcher that checks that the expected item is NOT an element in the actual Array.
278
- *
279
- * @param {Object} expected
280
- * @deprecated as of 1.0. Use not.toNotContain() instead.
281
- */
282
- jasmine.Matchers.prototype.toNotContain = function(expected) {
283
- return !this.env.contains_(this.actual, expected);
284
- };
285
-
286
- jasmine.Matchers.prototype.toBeLessThan = function(expected) {
287
- return this.actual < expected;
288
- };
289
-
290
- jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
291
- return this.actual > expected;
292
- };
293
-
294
- /**
295
- * Matcher that checks that the expected exception was thrown by the actual.
296
- *
297
- * @param {String} expected
298
- */
299
- jasmine.Matchers.prototype.toThrow = function(expected) {
300
- var result = false;
301
- var exception;
302
- if (typeof this.actual != 'function') {
303
- throw new Error('Actual is not a function');
304
- }
305
- try {
306
- this.actual();
307
- } catch (e) {
308
- exception = e;
309
- }
310
- if (exception) {
311
- result = (expected === jasmine.undefined || this.env.equals_(exception.message || exception, expected.message || expected));
312
- }
313
-
314
- var not = this.isNot ? "not " : "";
315
-
316
- this.message = function() {
317
- if (exception && (expected === jasmine.undefined || !this.env.equals_(exception.message || exception, expected.message || expected))) {
318
- return ["Expected function " + not + "to throw", expected ? expected.message || expected : "an exception", ", but it threw", exception.message || exception].join(' ');
319
- } else {
320
- return "Expected function to throw an exception.";
321
- }
322
- };
323
-
324
- return result;
325
- };
326
-
327
- jasmine.Matchers.Any = function(expectedClass) {
328
- this.expectedClass = expectedClass;
329
- };
330
-
331
- jasmine.Matchers.Any.prototype.matches = function(other) {
332
- if (this.expectedClass == String) {
333
- return typeof other == 'string' || other instanceof String;
334
- }
335
-
336
- if (this.expectedClass == Number) {
337
- return typeof other == 'number' || other instanceof Number;
338
- }
339
-
340
- if (this.expectedClass == Function) {
341
- return typeof other == 'function' || other instanceof Function;
342
- }
343
-
344
- if (this.expectedClass == Object) {
345
- return typeof other == 'object';
346
- }
347
-
348
- return other instanceof this.expectedClass;
349
- };
350
-
351
- jasmine.Matchers.Any.prototype.toString = function() {
352
- return '<jasmine.any(' + this.expectedClass + ')>';
353
- };
354
-