teaspoon 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT.LICENSE +1 -1
- data/README.md +46 -377
- data/app/assets/javascripts/teaspoon-jasmine.js +200 -194
- data/app/assets/javascripts/teaspoon-mocha.js +183 -185
- data/app/assets/javascripts/teaspoon-qunit.js +201 -193
- data/app/assets/javascripts/teaspoon-teaspoon.js +10 -10
- data/app/assets/javascripts/teaspoon/base/fixture.coffee +0 -1
- data/app/assets/javascripts/teaspoon/base/hook.coffee +7 -6
- data/app/assets/javascripts/teaspoon/qunit.coffee +10 -0
- data/app/controllers/teaspoon/suite_controller.rb +3 -4
- data/app/views/teaspoon/suite/_boot.html.erb +1 -1
- data/app/views/teaspoon/suite/_boot_require_js.html.erb +1 -0
- data/bin/teaspoon +1 -1
- data/config/routes.rb +4 -14
- data/lib/generators/teaspoon/install/install_generator.rb +22 -11
- data/lib/generators/teaspoon/install/templates/jasmine/{env_comments.rb → env_comments.rb.tt} +10 -5
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.coffee +5 -5
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.js +5 -5
- data/lib/generators/teaspoon/install/templates/mocha/{env_comments.rb → env_comments.rb.tt} +10 -5
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.coffee +6 -5
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.js +6 -5
- data/lib/generators/teaspoon/install/templates/qunit/{env_comments.rb → env_comments.rb.tt} +10 -5
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.coffee +5 -5
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.js +5 -5
- data/lib/tasks/teaspoon.rake +1 -1
- data/lib/teaspoon/command_line.rb +37 -40
- data/lib/teaspoon/configuration.rb +27 -30
- data/lib/teaspoon/configuration.rb.orig +187 -0
- data/lib/teaspoon/console.rb +31 -17
- data/lib/teaspoon/coverage.rb +2 -3
- data/lib/teaspoon/deprecated.rb +13 -8
- data/lib/teaspoon/drivers/base.rb +2 -2
- data/lib/teaspoon/drivers/capybara_webkit_driver.rb +33 -0
- data/lib/teaspoon/drivers/phantomjs/runner.js +2 -2
- data/lib/teaspoon/drivers/phantomjs_driver.rb +13 -4
- data/lib/teaspoon/drivers/selenium_driver.rb +3 -5
- data/lib/teaspoon/engine.rb +33 -5
- data/lib/teaspoon/environment.rb +2 -4
- data/lib/teaspoon/exceptions.rb +8 -5
- data/lib/teaspoon/formatters/base.rb +39 -27
- data/lib/teaspoon/formatters/clean_formatter.rb +0 -1
- data/lib/teaspoon/formatters/description.rb +36 -0
- data/lib/teaspoon/formatters/documentation_formatter.rb +2 -2
- data/lib/teaspoon/formatters/json_formatter.rb +1 -2
- data/lib/teaspoon/formatters/junit_formatter.rb +20 -20
- data/lib/teaspoon/formatters/modules/report_module.rb +4 -4
- data/lib/teaspoon/formatters/pride_formatter.rb +0 -1
- data/lib/teaspoon/formatters/rspec_html_formatter.rb +463 -0
- data/lib/teaspoon/formatters/snowday_formatter.rb +0 -1
- data/lib/teaspoon/formatters/swayze_or_oprah_formatter.rb +5 -4
- data/lib/teaspoon/formatters/tap_formatter.rb +2 -3
- data/lib/teaspoon/formatters/tap_y_formatter.rb +20 -21
- data/lib/teaspoon/formatters/teamcity_formatter.rb +4 -5
- data/lib/teaspoon/instrumentation.rb +7 -7
- data/lib/teaspoon/result.rb +1 -3
- data/lib/teaspoon/runner.rb +1 -2
- data/lib/teaspoon/server.rb +2 -1
- data/lib/teaspoon/suite.rb +20 -17
- data/lib/teaspoon/utility.rb +1 -3
- data/lib/teaspoon/version.rb +1 -1
- data/spec/dummy/config/application.rb +14 -18
- data/spec/dummy/config/boot.rb +2 -6
- data/spec/dummy/config/environment.rb +3 -3
- data/spec/dummy/config/environments/development.rb +27 -13
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +26 -13
- data/spec/dummy/config/routes.rb +1 -1
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/features/console_reporter_spec.rb +3 -8
- data/spec/features/hooks_spec.rb +17 -4
- data/spec/features/html_reporter_spec.rb +12 -1
- data/spec/features/install_generator_spec.rb +2 -3
- data/spec/features/instrumentation_spec.rb +11 -11
- data/spec/javascripts/teaspoon/base/teaspoon_spec.coffee +14 -1
- data/spec/spec_helper.rb +7 -4
- data/spec/teaspoon/command_line_spec.rb +19 -28
- data/spec/teaspoon/configuration_spec.rb +22 -14
- data/spec/teaspoon/console_spec.rb +79 -63
- data/spec/teaspoon/coverage_spec.rb +23 -23
- data/spec/teaspoon/drivers/capybara_webkit_driver_spec.rb +39 -0
- data/spec/teaspoon/drivers/phantomjs_driver_spec.rb +10 -5
- data/spec/teaspoon/drivers/selenium_driver_spec.rb +10 -10
- data/spec/teaspoon/environment_spec.rb +28 -20
- data/spec/teaspoon/exceptions_spec.rb +4 -4
- data/spec/teaspoon/exporter_spec.rb +28 -28
- data/spec/teaspoon/formatters/base_spec.rb +29 -29
- data/spec/teaspoon/formatters/clean_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/documentation_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/dot_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/json_formatter_spec.rb +7 -7
- data/spec/teaspoon/formatters/junit_formatter_spec.rb +10 -10
- data/spec/teaspoon/formatters/pride_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/rspec_html_formatter_spec.rb +107 -0
- data/spec/teaspoon/formatters/snowday_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/tap_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/tap_y_formatter_spec.rb +1 -1
- data/spec/teaspoon/formatters/teamcity_formatter_spec.rb +27 -27
- data/spec/teaspoon/instrumentation_spec.rb +35 -29
- data/spec/teaspoon/result_spec.rb +40 -36
- data/spec/teaspoon/runner_spec.rb +23 -20
- data/spec/teaspoon/server_spec.rb +19 -16
- data/spec/teaspoon/suite_spec.rb +23 -9
- data/spec/teaspoon_env.rb +7 -12
- data/test/javascripts/teaspoon/qunit/models_test.coffee +6 -2
- data/vendor/assets/javascripts/support/chai-1.10.0.js +4800 -0
- data/vendor/assets/javascripts/support/chai-jq-0.0.7.js +524 -0
- data/vendor/assets/javascripts/support/chai.js +4435 -4349
- metadata +57 -54
- data/app/assets/javascripts/teaspoon-angular.js +0 -1299
- data/app/assets/javascripts/teaspoon/angular.coffee +0 -55
- data/app/assets/javascripts/teaspoon/angular/reporters/console.coffee +0 -11
- data/app/assets/javascripts/teaspoon/angular/reporters/html.coffee +0 -21
- data/spec/javascripts/angular_helper.coffee +0 -5
- data/spec/javascripts/teaspoon/angular/models_aspec.coffee +0 -95
- data/spec/javascripts/teaspoon/angular/reporters/html_aspec.coffee +0 -9
- data/vendor/assets/javascripts/angular/1.0.5.js +0 -26195
- data/vendor/assets/javascripts/angular/MIT-LICENSE +0 -22
@@ -1,6 +1,6 @@
|
|
1
1
|
(function() {
|
2
|
-
var
|
3
|
-
|
2
|
+
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
3
|
+
hasProp = {}.hasOwnProperty;
|
4
4
|
|
5
5
|
this.Teaspoon = (function() {
|
6
6
|
function Teaspoon() {}
|
@@ -51,7 +51,7 @@
|
|
51
51
|
};
|
52
52
|
|
53
53
|
Teaspoon.resolveDependenciesFromParams = function(all) {
|
54
|
-
var dep, deps, file,
|
54
|
+
var dep, deps, file, i, j, len, len1, parts, path, paths;
|
55
55
|
if (all == null) {
|
56
56
|
all = [];
|
57
57
|
}
|
@@ -59,15 +59,15 @@
|
|
59
59
|
if ((paths = Teaspoon.location.search.match(/[\?&]file(\[\])?=[^&\?]*/gi)) === null) {
|
60
60
|
return all;
|
61
61
|
}
|
62
|
-
for (
|
63
|
-
path = paths[
|
62
|
+
for (i = 0, len = paths.length; i < len; i++) {
|
63
|
+
path = paths[i];
|
64
64
|
parts = decodeURIComponent(path.replace(/\+/g, " ")).match(/\/(.+)\.(js|js.coffee|coffee)$/i);
|
65
65
|
if (parts === null) {
|
66
66
|
continue;
|
67
67
|
}
|
68
68
|
file = parts[1].substr(parts[1].lastIndexOf("/") + 1);
|
69
|
-
for (
|
70
|
-
dep = all[
|
69
|
+
for (j = 0, len1 = all.length; j < len1; j++) {
|
70
|
+
dep = all[j];
|
71
71
|
if (dep.indexOf(file) >= 0) {
|
72
72
|
deps.push(dep);
|
73
73
|
}
|
@@ -98,8 +98,8 @@
|
|
98
98
|
|
99
99
|
})();
|
100
100
|
|
101
|
-
Teaspoon.Error = (function(
|
102
|
-
|
101
|
+
Teaspoon.Error = (function(superClass) {
|
102
|
+
extend(Error, superClass);
|
103
103
|
|
104
104
|
function Error(message) {
|
105
105
|
this.name = "TeaspoonError";
|
@@ -120,18 +120,18 @@
|
|
120
120
|
return;
|
121
121
|
}
|
122
122
|
this.constructor.run = true;
|
123
|
-
this.fixturePath =
|
123
|
+
this.fixturePath = Teaspoon.root + "/fixtures";
|
124
124
|
this.params = Teaspoon.params = this.getParams();
|
125
125
|
this.setup();
|
126
126
|
}
|
127
127
|
|
128
128
|
Runner.prototype.getParams = function() {
|
129
|
-
var
|
129
|
+
var i, len, name, param, params, ref, ref1, value;
|
130
130
|
params = {};
|
131
|
-
|
132
|
-
for (
|
133
|
-
param =
|
134
|
-
|
131
|
+
ref = Teaspoon.location.search.substring(1).split("&");
|
132
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
133
|
+
param = ref[i];
|
134
|
+
ref1 = param.split("="), name = ref1[0], value = ref1[1];
|
135
135
|
params[decodeURIComponent(name)] = decodeURIComponent(value);
|
136
136
|
}
|
137
137
|
return params;
|
@@ -157,11 +157,10 @@
|
|
157
157
|
|
158
158
|
}).call(this);
|
159
159
|
(function() {
|
160
|
-
var
|
160
|
+
var slice = [].slice;
|
161
161
|
|
162
162
|
Teaspoon.fixture = (function() {
|
163
|
-
var addContent, cleanup, create, load, loadComplete, preload, putContent, set, xhr, xhrRequest
|
164
|
-
_this = this;
|
163
|
+
var addContent, cleanup, create, load, loadComplete, preload, putContent, set, xhr, xhrRequest;
|
165
164
|
|
166
165
|
fixture.cache = {};
|
167
166
|
|
@@ -172,19 +171,19 @@
|
|
172
171
|
fixture.json = [];
|
173
172
|
|
174
173
|
fixture.preload = function() {
|
175
|
-
var
|
176
|
-
urls = 1 <= arguments.length ?
|
177
|
-
|
178
|
-
for (
|
179
|
-
url = urls[
|
180
|
-
|
174
|
+
var i, len, results, url, urls;
|
175
|
+
urls = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
176
|
+
results = [];
|
177
|
+
for (i = 0, len = urls.length; i < len; i++) {
|
178
|
+
url = urls[i];
|
179
|
+
results.push(preload(url));
|
181
180
|
}
|
182
|
-
return
|
181
|
+
return results;
|
183
182
|
};
|
184
183
|
|
185
184
|
fixture.load = function() {
|
186
|
-
var append,
|
187
|
-
urls = 2 <= arguments.length ?
|
185
|
+
var append, i, index, j, len, results, url, urls;
|
186
|
+
urls = 2 <= arguments.length ? slice.call(arguments, 0, i = arguments.length - 1) : (i = 0, []), append = arguments[i++];
|
188
187
|
if (append == null) {
|
189
188
|
append = false;
|
190
189
|
}
|
@@ -192,17 +191,17 @@
|
|
192
191
|
urls.push(append);
|
193
192
|
append = false;
|
194
193
|
}
|
195
|
-
|
196
|
-
for (index =
|
194
|
+
results = [];
|
195
|
+
for (index = j = 0, len = urls.length; j < len; index = ++j) {
|
197
196
|
url = urls[index];
|
198
|
-
|
197
|
+
results.push(load(url, append || index > 0));
|
199
198
|
}
|
200
|
-
return
|
199
|
+
return results;
|
201
200
|
};
|
202
201
|
|
203
202
|
fixture.set = function() {
|
204
|
-
var append, html, htmls,
|
205
|
-
htmls = 2 <= arguments.length ?
|
203
|
+
var append, html, htmls, i, index, j, len, results;
|
204
|
+
htmls = 2 <= arguments.length ? slice.call(arguments, 0, i = arguments.length - 1) : (i = 0, []), append = arguments[i++];
|
206
205
|
if (append == null) {
|
207
206
|
append = false;
|
208
207
|
}
|
@@ -210,12 +209,12 @@
|
|
210
209
|
htmls.push(append);
|
211
210
|
append = false;
|
212
211
|
}
|
213
|
-
|
214
|
-
for (index =
|
212
|
+
results = [];
|
213
|
+
for (index = j = 0, len = htmls.length; j < len; index = ++j) {
|
215
214
|
html = htmls[index];
|
216
|
-
|
215
|
+
results.push(set(html, append || index > 0));
|
217
216
|
}
|
218
|
-
return
|
217
|
+
return results;
|
219
218
|
};
|
220
219
|
|
221
220
|
fixture.cleanup = function() {
|
@@ -294,21 +293,21 @@
|
|
294
293
|
};
|
295
294
|
|
296
295
|
create = function() {
|
297
|
-
var
|
296
|
+
var ref;
|
298
297
|
Teaspoon.fixture.el = document.createElement("div");
|
299
298
|
if (typeof window.$ === 'function') {
|
300
299
|
Teaspoon.fixture.$el = $(Teaspoon.fixture.el);
|
301
300
|
}
|
302
301
|
Teaspoon.fixture.el.id = "teaspoon-fixtures";
|
303
|
-
return (
|
302
|
+
return (ref = document.body) != null ? ref.appendChild(Teaspoon.fixture.el) : void 0;
|
304
303
|
};
|
305
304
|
|
306
305
|
cleanup = function() {
|
307
|
-
var
|
308
|
-
(
|
309
|
-
if ((
|
310
|
-
if ((
|
311
|
-
|
306
|
+
var base, ref, ref1;
|
307
|
+
(base = Teaspoon.fixture).el || (base.el = document.getElementById("teaspoon-fixtures"));
|
308
|
+
if ((ref = Teaspoon.fixture.el) != null) {
|
309
|
+
if ((ref1 = ref.parentNode) != null) {
|
310
|
+
ref1.removeChild(Teaspoon.fixture.el);
|
312
311
|
}
|
313
312
|
}
|
314
313
|
return Teaspoon.fixture.el = null;
|
@@ -334,23 +333,24 @@
|
|
334
333
|
throw "Unable to make Ajax Request";
|
335
334
|
}
|
336
335
|
xhr.onreadystatechange = callback;
|
337
|
-
xhr.open("GET",
|
336
|
+
xhr.open("GET", Teaspoon.root + "/fixtures/" + url, false);
|
338
337
|
return xhr.send();
|
339
338
|
};
|
340
339
|
|
341
340
|
return fixture;
|
342
341
|
|
343
|
-
})
|
342
|
+
})();
|
344
343
|
|
345
344
|
}).call(this);
|
346
345
|
(function() {
|
347
|
-
Teaspoon.hook = function(name,
|
348
|
-
var xhr, xhrRequest;
|
349
|
-
if (
|
350
|
-
|
346
|
+
Teaspoon.hook = function(name, payload) {
|
347
|
+
var method, xhr, xhrRequest;
|
348
|
+
if (payload == null) {
|
349
|
+
payload = {};
|
351
350
|
}
|
351
|
+
method = "POST";
|
352
352
|
xhr = null;
|
353
|
-
xhrRequest = function(url,
|
353
|
+
xhrRequest = function(url, payload, callback) {
|
354
354
|
var e;
|
355
355
|
if (window.XMLHttpRequest) {
|
356
356
|
xhr = new XMLHttpRequest();
|
@@ -370,10 +370,13 @@
|
|
370
370
|
throw "Unable to make Ajax Request";
|
371
371
|
}
|
372
372
|
xhr.onreadystatechange = callback;
|
373
|
-
xhr.open(
|
374
|
-
|
373
|
+
xhr.open("POST", Teaspoon.root + "/" + url, false);
|
374
|
+
xhr.setRequestHeader("Content-Type", "application/json");
|
375
|
+
return xhr.send(JSON.stringify({
|
376
|
+
args: payload
|
377
|
+
}));
|
375
378
|
};
|
376
|
-
return xhrRequest(
|
379
|
+
return xhrRequest(Teaspoon.suites.active + "/" + name, payload, function() {
|
377
380
|
if (xhr.readyState !== 4) {
|
378
381
|
return;
|
379
382
|
}
|
@@ -414,9 +417,9 @@
|
|
414
417
|
};
|
415
418
|
|
416
419
|
BaseView.prototype.findEl = function(id) {
|
417
|
-
var
|
420
|
+
var base;
|
418
421
|
this.elements || (this.elements = {});
|
419
|
-
return (
|
422
|
+
return (base = this.elements)[id] || (base[id] = document.getElementById("teaspoon-" + id));
|
420
423
|
};
|
421
424
|
|
422
425
|
BaseView.prototype.setText = function(id, value) {
|
@@ -457,17 +460,17 @@
|
|
457
460
|
|
458
461
|
}).call(this);
|
459
462
|
(function() {
|
460
|
-
var
|
461
|
-
|
462
|
-
|
463
|
+
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
464
|
+
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
465
|
+
hasProp = {}.hasOwnProperty;
|
463
466
|
|
464
|
-
Teaspoon.Reporters.HTML = (function(
|
465
|
-
|
467
|
+
Teaspoon.Reporters.HTML = (function(superClass) {
|
468
|
+
extend(HTML, superClass);
|
466
469
|
|
467
470
|
function HTML() {
|
468
|
-
this.changeSuite =
|
469
|
-
this.toggleConfig =
|
470
|
-
this.reportRunnerResults =
|
471
|
+
this.changeSuite = bind(this.changeSuite, this);
|
472
|
+
this.toggleConfig = bind(this.toggleConfig, this);
|
473
|
+
this.reportRunnerResults = bind(this.reportRunnerResults, this);
|
471
474
|
this.start = new Teaspoon.Date().getTime();
|
472
475
|
this.config = {
|
473
476
|
"use-catch": true,
|
@@ -492,14 +495,14 @@
|
|
492
495
|
}
|
493
496
|
|
494
497
|
HTML.prototype.build = function() {
|
495
|
-
var
|
498
|
+
var ref;
|
496
499
|
this.buildLayout();
|
497
500
|
this.setText("env-info", this.envInfo());
|
498
501
|
this.setText("version", Teaspoon.version);
|
499
502
|
this.findEl("toggles").onclick = this.toggleConfig;
|
500
503
|
this.findEl("suites").innerHTML = this.buildSuiteSelect();
|
501
|
-
if ((
|
502
|
-
|
504
|
+
if ((ref = this.findEl("suite-select")) != null) {
|
505
|
+
ref.onchange = this.changeSuite;
|
503
506
|
}
|
504
507
|
this.el = this.findEl("report-all");
|
505
508
|
this.showConfiguration();
|
@@ -516,7 +519,7 @@
|
|
516
519
|
};
|
517
520
|
|
518
521
|
HTML.prototype.buildSuiteSelect = function() {
|
519
|
-
var filename,
|
522
|
+
var filename, i, len, options, path, ref, selected, suite;
|
520
523
|
if (Teaspoon.suites.all.length === 1) {
|
521
524
|
return "";
|
522
525
|
}
|
@@ -525,9 +528,9 @@
|
|
525
528
|
filename = "/index.html";
|
526
529
|
}
|
527
530
|
options = [];
|
528
|
-
|
529
|
-
for (
|
530
|
-
suite =
|
531
|
+
ref = Teaspoon.suites.all;
|
532
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
533
|
+
suite = ref[i];
|
531
534
|
path = [Teaspoon.root, suite].join("/");
|
532
535
|
selected = Teaspoon.suites.active === suite ? " selected" : "";
|
533
536
|
options.push("<option" + selected + " value=\"" + path + filename + "\">" + suite + "</option>");
|
@@ -587,7 +590,7 @@
|
|
587
590
|
};
|
588
591
|
|
589
592
|
HTML.prototype.elapsedTime = function() {
|
590
|
-
return
|
593
|
+
return (((new Teaspoon.Date().getTime() - this.start) / 1000).toFixed(3)) + "s";
|
591
594
|
};
|
592
595
|
|
593
596
|
HTML.prototype.updateStat = function(name, value) {
|
@@ -598,7 +601,7 @@
|
|
598
601
|
};
|
599
602
|
|
600
603
|
HTML.prototype.updateStatus = function(spec) {
|
601
|
-
var elapsed,
|
604
|
+
var elapsed, ref, ref1, result;
|
602
605
|
spec = new Teaspoon.Spec(spec);
|
603
606
|
result = spec.result();
|
604
607
|
if (result.skipped || result.status === "pending") {
|
@@ -608,11 +611,11 @@
|
|
608
611
|
elapsed = new Teaspoon.Date().getTime() - this.specStart;
|
609
612
|
if (result.status === "passed") {
|
610
613
|
this.updateStat("passes", this.total.passes += 1);
|
611
|
-
return (
|
614
|
+
return (ref = this.reportView) != null ? ref.updateState("passed", elapsed) : void 0;
|
612
615
|
} else {
|
613
616
|
this.updateStat("failures", this.total.failures += 1);
|
614
|
-
if ((
|
615
|
-
|
617
|
+
if ((ref1 = this.reportView) != null) {
|
618
|
+
ref1.updateState("failed", elapsed);
|
616
619
|
}
|
617
620
|
if (!this.config["build-full-report"]) {
|
618
621
|
new Teaspoon.Reporters.HTML.FailureView(spec).appendTo(this.findEl("report-failures"));
|
@@ -626,14 +629,14 @@
|
|
626
629
|
};
|
627
630
|
|
628
631
|
HTML.prototype.showConfiguration = function() {
|
629
|
-
var key,
|
630
|
-
|
631
|
-
|
632
|
-
for (key in
|
633
|
-
value =
|
634
|
-
|
632
|
+
var key, ref, results, value;
|
633
|
+
ref = this.config;
|
634
|
+
results = [];
|
635
|
+
for (key in ref) {
|
636
|
+
value = ref[key];
|
637
|
+
results.push(this.setClass(key, value ? "active" : ""));
|
635
638
|
}
|
636
|
-
return
|
639
|
+
return results;
|
637
640
|
};
|
638
641
|
|
639
642
|
HTML.prototype.setStatus = function(status) {
|
@@ -675,8 +678,8 @@
|
|
675
678
|
};
|
676
679
|
|
677
680
|
HTML.prototype.store = function(name, value) {
|
678
|
-
var
|
679
|
-
if (((
|
681
|
+
var ref;
|
682
|
+
if (((ref = window.localStorage) != null ? ref.setItem : void 0) != null) {
|
680
683
|
return this.localstore(name, value);
|
681
684
|
} else {
|
682
685
|
return this.cookie(name, value);
|
@@ -695,7 +698,7 @@
|
|
695
698
|
} else {
|
696
699
|
date = new Teaspoon.Date();
|
697
700
|
date.setDate(date.getDate() + 365);
|
698
|
-
return document.cookie =
|
701
|
+
return document.cookie = name + "=" + (escape(JSON.stringify(value))) + "; expires=" + (date.toUTCString()) + "; path=/;";
|
699
702
|
}
|
700
703
|
};
|
701
704
|
|
@@ -716,16 +719,14 @@
|
|
716
719
|
|
717
720
|
}).call(this);
|
718
721
|
(function() {
|
719
|
-
var
|
720
|
-
|
721
|
-
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
722
|
+
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
723
|
+
hasProp = {}.hasOwnProperty;
|
722
724
|
|
723
|
-
Teaspoon.Reporters.HTML.ProgressView = (function(
|
724
|
-
|
725
|
+
Teaspoon.Reporters.HTML.ProgressView = (function(superClass) {
|
726
|
+
extend(ProgressView, superClass);
|
725
727
|
|
726
728
|
function ProgressView() {
|
727
|
-
|
728
|
-
return _ref;
|
729
|
+
return ProgressView.__super__.constructor.apply(this, arguments);
|
729
730
|
}
|
730
731
|
|
731
732
|
ProgressView.create = function(displayProgress) {
|
@@ -752,12 +753,11 @@
|
|
752
753
|
|
753
754
|
})(Teaspoon.Reporters.BaseView);
|
754
755
|
|
755
|
-
Teaspoon.Reporters.HTML.SimpleProgressView = (function(
|
756
|
-
|
756
|
+
Teaspoon.Reporters.HTML.SimpleProgressView = (function(superClass) {
|
757
|
+
extend(SimpleProgressView, superClass);
|
757
758
|
|
758
759
|
function SimpleProgressView() {
|
759
|
-
|
760
|
-
return _ref1;
|
760
|
+
return SimpleProgressView.__super__.constructor.apply(this, arguments);
|
761
761
|
}
|
762
762
|
|
763
763
|
SimpleProgressView.prototype.build = function() {
|
@@ -768,19 +768,18 @@
|
|
768
768
|
SimpleProgressView.prototype.update = function(total, run) {
|
769
769
|
var percent;
|
770
770
|
percent = total ? Math.ceil((run * 100) / total) : 0;
|
771
|
-
return this.setHtml("progress-percent",
|
771
|
+
return this.setHtml("progress-percent", percent + "%");
|
772
772
|
};
|
773
773
|
|
774
774
|
return SimpleProgressView;
|
775
775
|
|
776
776
|
})(Teaspoon.Reporters.HTML.ProgressView);
|
777
777
|
|
778
|
-
Teaspoon.Reporters.HTML.RadialProgressView = (function(
|
779
|
-
|
778
|
+
Teaspoon.Reporters.HTML.RadialProgressView = (function(superClass) {
|
779
|
+
extend(RadialProgressView, superClass);
|
780
780
|
|
781
781
|
function RadialProgressView() {
|
782
|
-
|
783
|
-
return _ref2;
|
782
|
+
return RadialProgressView.__super__.constructor.apply(this, arguments);
|
784
783
|
}
|
785
784
|
|
786
785
|
RadialProgressView.supported = !!document.createElement("canvas").getContext;
|
@@ -808,7 +807,7 @@
|
|
808
807
|
RadialProgressView.prototype.update = function(total, run) {
|
809
808
|
var half, percent;
|
810
809
|
percent = total ? Math.ceil((run * 100) / total) : 0;
|
811
|
-
this.setHtml("progress-percent",
|
810
|
+
this.setHtml("progress-percent", percent + "%");
|
812
811
|
if (!this.ctx) {
|
813
812
|
return;
|
814
813
|
}
|
@@ -825,13 +824,13 @@
|
|
825
824
|
|
826
825
|
}).call(this);
|
827
826
|
(function() {
|
828
|
-
var
|
829
|
-
|
827
|
+
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
828
|
+
hasProp = {}.hasOwnProperty;
|
830
829
|
|
831
|
-
Teaspoon.Reporters.HTML.SpecView = (function(
|
830
|
+
Teaspoon.Reporters.HTML.SpecView = (function(superClass) {
|
832
831
|
var viewId;
|
833
832
|
|
834
|
-
|
833
|
+
extend(SpecView, superClass);
|
835
834
|
|
836
835
|
viewId = 0;
|
837
836
|
|
@@ -868,12 +867,12 @@
|
|
868
867
|
};
|
869
868
|
|
870
869
|
SpecView.prototype.buildErrors = function() {
|
871
|
-
var div, error, html,
|
870
|
+
var div, error, html, i, len, ref;
|
872
871
|
div = this.createEl("div");
|
873
872
|
html = "";
|
874
|
-
|
875
|
-
for (
|
876
|
-
error =
|
873
|
+
ref = this.spec.errors();
|
874
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
875
|
+
error = ref[i];
|
877
876
|
html += "<strong>" + (this.htmlSafe(error.message)) + "</strong><br/>" + (this.htmlSafe(error.stack || "Stack trace unavailable"));
|
878
877
|
}
|
879
878
|
div.innerHTML = html;
|
@@ -881,7 +880,7 @@
|
|
881
880
|
};
|
882
881
|
|
883
882
|
SpecView.prototype.updateState = function(state, elapsed) {
|
884
|
-
var classes, result
|
883
|
+
var base, classes, result;
|
885
884
|
result = this.spec.result();
|
886
885
|
classes = ["state-" + state];
|
887
886
|
if (elapsed > Teaspoon.slow) {
|
@@ -894,7 +893,7 @@
|
|
894
893
|
if (result.status !== "passed") {
|
895
894
|
this.buildErrors();
|
896
895
|
}
|
897
|
-
return typeof (
|
896
|
+
return typeof (base = this.parentView).updateState === "function" ? base.updateState(state) : void 0;
|
898
897
|
};
|
899
898
|
|
900
899
|
return SpecView;
|
@@ -903,11 +902,11 @@
|
|
903
902
|
|
904
903
|
}).call(this);
|
905
904
|
(function() {
|
906
|
-
var
|
907
|
-
|
905
|
+
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
906
|
+
hasProp = {}.hasOwnProperty;
|
908
907
|
|
909
|
-
Teaspoon.Reporters.HTML.FailureView = (function(
|
910
|
-
|
908
|
+
Teaspoon.Reporters.HTML.FailureView = (function(superClass) {
|
909
|
+
extend(FailureView, superClass);
|
911
910
|
|
912
911
|
function FailureView(spec) {
|
913
912
|
this.spec = spec;
|
@@ -915,12 +914,12 @@
|
|
915
914
|
}
|
916
915
|
|
917
916
|
FailureView.prototype.build = function() {
|
918
|
-
var error, html,
|
917
|
+
var error, html, i, len, ref;
|
919
918
|
FailureView.__super__.build.call(this, "spec");
|
920
919
|
html = "<h1 class=\"teaspoon-clearfix\"><a href=\"" + this.spec.link + "\">" + (this.htmlSafe(this.spec.fullDescription)) + "</a></h1>";
|
921
|
-
|
922
|
-
for (
|
923
|
-
error =
|
920
|
+
ref = this.spec.errors();
|
921
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
922
|
+
error = ref[i];
|
924
923
|
html += "<div><strong>" + (this.htmlSafe(error.message)) + "</strong><br/>" + (this.htmlSafe(error.stack || "Stack trace unavailable")) + "</div>";
|
925
924
|
}
|
926
925
|
return this.el.innerHTML = html;
|
@@ -932,18 +931,18 @@
|
|
932
931
|
|
933
932
|
}).call(this);
|
934
933
|
(function() {
|
935
|
-
var
|
936
|
-
|
934
|
+
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
935
|
+
hasProp = {}.hasOwnProperty;
|
937
936
|
|
938
|
-
Teaspoon.Reporters.HTML.SuiteView = (function(
|
937
|
+
Teaspoon.Reporters.HTML.SuiteView = (function(superClass) {
|
939
938
|
var viewId;
|
940
939
|
|
941
|
-
|
940
|
+
extend(SuiteView, superClass);
|
942
941
|
|
943
942
|
viewId = 0;
|
944
943
|
|
945
|
-
function SuiteView(
|
946
|
-
this.suite =
|
944
|
+
function SuiteView(suite1, reporter) {
|
945
|
+
this.suite = suite1;
|
947
946
|
this.reporter = reporter;
|
948
947
|
this.views = this.reporter.views;
|
949
948
|
this.suite.viewId = viewId += 1;
|
@@ -981,13 +980,13 @@
|
|
981
980
|
};
|
982
981
|
|
983
982
|
SuiteView.prototype.updateState = function(state) {
|
984
|
-
var
|
983
|
+
var base;
|
985
984
|
if (this.state === "failed") {
|
986
985
|
return;
|
987
986
|
}
|
988
|
-
this.el.className =
|
989
|
-
if (typeof (
|
990
|
-
|
987
|
+
this.el.className = (this.el.className.replace(/\s?state-\w+/, "")) + " state-" + state;
|
988
|
+
if (typeof (base = this.parentView).updateState === "function") {
|
989
|
+
base.updateState(state);
|
991
990
|
}
|
992
991
|
return this.state = state;
|
993
992
|
};
|
@@ -1004,11 +1003,11 @@
|
|
1004
1003
|
|
1005
1004
|
}).call(this);
|
1006
1005
|
(function() {
|
1007
|
-
var
|
1006
|
+
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
1008
1007
|
|
1009
1008
|
Teaspoon.Reporters.Console = (function() {
|
1010
1009
|
function Console() {
|
1011
|
-
this.reportRunnerResults =
|
1010
|
+
this.reportRunnerResults = bind(this.reportRunnerResults, this);
|
1012
1011
|
this.start = new Teaspoon.Date();
|
1013
1012
|
this.suites = {};
|
1014
1013
|
}
|
@@ -1022,22 +1021,22 @@
|
|
1022
1021
|
};
|
1023
1022
|
|
1024
1023
|
Console.prototype.reportSuites = function() {
|
1025
|
-
var
|
1026
|
-
|
1027
|
-
|
1028
|
-
for (index =
|
1029
|
-
suite =
|
1024
|
+
var i, index, len, ref, results, suite;
|
1025
|
+
ref = this.spec.getParents();
|
1026
|
+
results = [];
|
1027
|
+
for (index = i = 0, len = ref.length; i < len; index = ++i) {
|
1028
|
+
suite = ref[index];
|
1030
1029
|
if (this.suites[suite.fullDescription]) {
|
1031
1030
|
continue;
|
1032
1031
|
}
|
1033
1032
|
this.suites[suite.fullDescription] = true;
|
1034
|
-
|
1033
|
+
results.push(this.log({
|
1035
1034
|
type: "suite",
|
1036
1035
|
label: suite.description,
|
1037
1036
|
level: index
|
1038
1037
|
}));
|
1039
1038
|
}
|
1040
|
-
return
|
1039
|
+
return results;
|
1041
1040
|
};
|
1042
1041
|
|
1043
1042
|
Console.prototype.reportSpecResults = function(spec) {
|
@@ -1077,13 +1076,13 @@
|
|
1077
1076
|
};
|
1078
1077
|
|
1079
1078
|
Console.prototype.trackFailure = function() {
|
1080
|
-
var error,
|
1079
|
+
var error, i, len, ref, result, results;
|
1081
1080
|
result = this.spec.result();
|
1082
|
-
|
1083
|
-
|
1084
|
-
for (
|
1085
|
-
error =
|
1086
|
-
|
1081
|
+
ref = this.spec.errors();
|
1082
|
+
results = [];
|
1083
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
1084
|
+
error = ref[i];
|
1085
|
+
results.push(this.log({
|
1087
1086
|
type: "spec",
|
1088
1087
|
suite: this.spec.suiteName,
|
1089
1088
|
label: this.spec.description,
|
@@ -1094,7 +1093,7 @@
|
|
1094
1093
|
trace: error.stack || error.message || "Stack Trace Unavailable"
|
1095
1094
|
}));
|
1096
1095
|
}
|
1097
|
-
return
|
1096
|
+
return results;
|
1098
1097
|
};
|
1099
1098
|
|
1100
1099
|
Console.prototype.reportRunnerResults = function() {
|
@@ -1120,16 +1119,14 @@
|
|
1120
1119
|
|
1121
1120
|
}).call(this);
|
1122
1121
|
(function() {
|
1123
|
-
var
|
1124
|
-
|
1125
|
-
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
1122
|
+
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
1123
|
+
hasProp = {}.hasOwnProperty;
|
1126
1124
|
|
1127
|
-
Teaspoon.Reporters.HTML = (function(
|
1128
|
-
|
1125
|
+
Teaspoon.Reporters.HTML = (function(superClass) {
|
1126
|
+
extend(HTML, superClass);
|
1129
1127
|
|
1130
1128
|
function HTML() {
|
1131
|
-
|
1132
|
-
return _ref;
|
1129
|
+
return HTML.__super__.constructor.apply(this, arguments);
|
1133
1130
|
}
|
1134
1131
|
|
1135
1132
|
HTML.prototype.readConfig = function() {
|
@@ -1150,16 +1147,16 @@
|
|
1150
1147
|
|
1151
1148
|
}).call(this);
|
1152
1149
|
(function() {
|
1153
|
-
var env,
|
1154
|
-
|
1155
|
-
|
1150
|
+
var env,
|
1151
|
+
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
1152
|
+
hasProp = {}.hasOwnProperty;
|
1156
1153
|
|
1157
1154
|
if (typeof jasmine === "undefined" || jasmine === null) {
|
1158
1155
|
throw new Teaspoon.Error('Jasmine not found -- use `suite.use_framework :jasmine` and adjust or remove the `suite.javascripts` directive.');
|
1159
1156
|
}
|
1160
1157
|
|
1161
|
-
Teaspoon.Runner = (function(
|
1162
|
-
|
1158
|
+
Teaspoon.Runner = (function(superClass) {
|
1159
|
+
extend(Runner, superClass);
|
1163
1160
|
|
1164
1161
|
function Runner() {
|
1165
1162
|
Runner.__super__.constructor.apply(this, arguments);
|
@@ -1194,8 +1191,8 @@
|
|
1194
1191
|
})(Teaspoon.Runner);
|
1195
1192
|
|
1196
1193
|
Teaspoon.Spec = (function() {
|
1197
|
-
function Spec(
|
1198
|
-
this.spec =
|
1194
|
+
function Spec(spec1) {
|
1195
|
+
this.spec = spec1;
|
1199
1196
|
this.fullDescription = this.spec.getFullName();
|
1200
1197
|
this.description = this.spec.description;
|
1201
1198
|
this.link = "?grep=" + (encodeURIComponent(this.fullDescription));
|
@@ -1206,23 +1203,23 @@
|
|
1206
1203
|
}
|
1207
1204
|
|
1208
1205
|
Spec.prototype.errors = function() {
|
1209
|
-
var
|
1206
|
+
var i, item, len, ref, results1;
|
1210
1207
|
if (!this.spec.results) {
|
1211
1208
|
return [];
|
1212
1209
|
}
|
1213
|
-
|
1214
|
-
|
1215
|
-
for (
|
1216
|
-
item =
|
1210
|
+
ref = this.spec.results().getItems();
|
1211
|
+
results1 = [];
|
1212
|
+
for (i = 0, len = ref.length; i < len; i++) {
|
1213
|
+
item = ref[i];
|
1217
1214
|
if (item.passed()) {
|
1218
1215
|
continue;
|
1219
1216
|
}
|
1220
|
-
|
1217
|
+
results1.push({
|
1221
1218
|
message: item.message,
|
1222
1219
|
stack: item.trace.stack
|
1223
1220
|
});
|
1224
1221
|
}
|
1225
|
-
return
|
1222
|
+
return results1;
|
1226
1223
|
};
|
1227
1224
|
|
1228
1225
|
Spec.prototype.getParents = function() {
|
@@ -1274,58 +1271,67 @@
|
|
1274
1271
|
|
1275
1272
|
})();
|
1276
1273
|
|
1277
|
-
Teaspoon.fixture = (function(
|
1278
|
-
|
1274
|
+
Teaspoon.fixture = (function(superClass) {
|
1275
|
+
extend(fixture, superClass);
|
1279
1276
|
|
1280
1277
|
function fixture() {
|
1281
|
-
|
1282
|
-
return _ref;
|
1278
|
+
return fixture.__super__.constructor.apply(this, arguments);
|
1283
1279
|
}
|
1284
1280
|
|
1285
1281
|
window.fixture = fixture;
|
1286
1282
|
|
1287
1283
|
fixture.load = function() {
|
1288
|
-
var args
|
1289
|
-
_this = this;
|
1284
|
+
var args;
|
1290
1285
|
args = arguments;
|
1291
1286
|
if (!(env.currentSuite || env.currentSpec)) {
|
1292
1287
|
throw "Teaspoon can't load fixtures outside of describe.";
|
1293
1288
|
}
|
1294
1289
|
if (env.currentSuite) {
|
1295
|
-
env.beforeEach(function() {
|
1296
|
-
return
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1290
|
+
env.beforeEach((function(_this) {
|
1291
|
+
return function() {
|
1292
|
+
return fixture.__super__.constructor.load.apply(_this, args);
|
1293
|
+
};
|
1294
|
+
})(this));
|
1295
|
+
env.afterEach((function(_this) {
|
1296
|
+
return function() {
|
1297
|
+
return _this.cleanup();
|
1298
|
+
};
|
1299
|
+
})(this));
|
1301
1300
|
return fixture.__super__.constructor.load.apply(this, arguments);
|
1302
1301
|
} else {
|
1303
|
-
env.currentSpec.after(function() {
|
1304
|
-
return
|
1305
|
-
|
1302
|
+
env.currentSpec.after((function(_this) {
|
1303
|
+
return function() {
|
1304
|
+
return _this.cleanup();
|
1305
|
+
};
|
1306
|
+
})(this));
|
1306
1307
|
return fixture.__super__.constructor.load.apply(this, arguments);
|
1307
1308
|
}
|
1308
1309
|
};
|
1309
1310
|
|
1310
1311
|
fixture.set = function() {
|
1311
|
-
var args
|
1312
|
-
_this = this;
|
1312
|
+
var args;
|
1313
1313
|
args = arguments;
|
1314
1314
|
if (!(env.currentSuite || env.currentSpec)) {
|
1315
1315
|
throw "Teaspoon can't load fixtures outside of describe.";
|
1316
1316
|
}
|
1317
1317
|
if (env.currentSuite) {
|
1318
|
-
env.beforeEach(function() {
|
1319
|
-
return
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1318
|
+
env.beforeEach((function(_this) {
|
1319
|
+
return function() {
|
1320
|
+
return fixture.__super__.constructor.set.apply(_this, args);
|
1321
|
+
};
|
1322
|
+
})(this));
|
1323
|
+
env.afterEach((function(_this) {
|
1324
|
+
return function() {
|
1325
|
+
return _this.cleanup();
|
1326
|
+
};
|
1327
|
+
})(this));
|
1324
1328
|
return fixture.__super__.constructor.set.apply(this, arguments);
|
1325
1329
|
} else {
|
1326
|
-
env.currentSpec.after(function() {
|
1327
|
-
return
|
1328
|
-
|
1330
|
+
env.currentSpec.after((function(_this) {
|
1331
|
+
return function() {
|
1332
|
+
return _this.cleanup();
|
1333
|
+
};
|
1334
|
+
})(this));
|
1329
1335
|
return fixture.__super__.constructor.set.apply(this, arguments);
|
1330
1336
|
}
|
1331
1337
|
};
|