jazz 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.rdoc +129 -0
- data/bin/jazz +230 -0
- data/doc/jasmine/files.html +460 -0
- data/doc/jasmine/index.html +322 -0
- data/doc/jasmine/symbols/_global_.html +1083 -0
- data/doc/jasmine/symbols/jasmine.Block.html +417 -0
- data/doc/jasmine/symbols/jasmine.Clock.html +678 -0
- data/doc/jasmine/symbols/jasmine.Env.html +1135 -0
- data/doc/jasmine/symbols/jasmine.EnvjsReporter.html +328 -0
- data/doc/jasmine/symbols/jasmine.JsApiReporter.html +822 -0
- data/doc/jasmine/symbols/jasmine.Matchers.html +1106 -0
- data/doc/jasmine/symbols/jasmine.MultiReporter.html +394 -0
- data/doc/jasmine/symbols/jasmine.NestedResults.html +710 -0
- data/doc/jasmine/symbols/jasmine.Reporter.html +574 -0
- data/doc/jasmine/symbols/jasmine.Runner.html +710 -0
- data/doc/jasmine/symbols/jasmine.Spec.html +1372 -0
- data/doc/jasmine/symbols/jasmine.Spy.html +855 -0
- data/doc/jasmine/symbols/jasmine.Suite.html +705 -0
- data/doc/jasmine/symbols/jasmine.XMLReporter.html +328 -0
- data/doc/jasmine/symbols/jasmine.html +1359 -0
- data/doc/jasmine/symbols/jasmine.util.html +535 -0
- data/doc/jasmine/symbols/src/lib_EnvjsReporter.js.html +149 -0
- data/doc/jasmine/symbols/src/lib_TrivialReporter.js.html +127 -0
- data/doc/jasmine/symbols/src/lib_XMLReporter.js.html +210 -0
- data/doc/jasmine/symbols/src/src_Block.js.html +35 -0
- data/doc/jasmine/symbols/src/src_Env.js.html +233 -0
- data/doc/jasmine/symbols/src/src_JsApiReporter.js.html +110 -0
- data/doc/jasmine/symbols/src/src_Matchers.js.html +399 -0
- data/doc/jasmine/symbols/src/src_MultiReporter.js.html +36 -0
- data/doc/jasmine/symbols/src/src_NestedResults.js.html +88 -0
- data/doc/jasmine/symbols/src/src_PrettyPrinter.js.html +128 -0
- data/doc/jasmine/symbols/src/src_Queue.js.html +119 -0
- data/doc/jasmine/symbols/src/src_Reporter.js.html +35 -0
- data/doc/jasmine/symbols/src/src_Reporters.js.html +51 -0
- data/doc/jasmine/symbols/src/src_Runner.js.html +75 -0
- data/doc/jasmine/symbols/src/src_Spec.js.html +228 -0
- data/doc/jasmine/symbols/src/src_Suite.js.html +77 -0
- data/doc/jasmine/symbols/src/src_WaitsBlock.js.html +21 -0
- data/doc/jasmine/symbols/src/src_WaitsForBlock.js.html +45 -0
- data/doc/jasmine/symbols/src/src_base.js.html +566 -0
- data/doc/jasmine/symbols/src/src_mock-timeout.js.html +185 -0
- data/doc/jasmine/symbols/src/src_util.js.html +75 -0
- data/lib/jazz.rb +0 -0
- data/lib/jazz/intro.js +46 -0
- data/lib/jazz/jasmine/EnvjsReporter.js +141 -0
- data/lib/jazz/jasmine/TrivialReporter.js +155 -0
- data/lib/jazz/jasmine/XMLReporter.js +241 -0
- data/lib/jazz/jasmine/consolex.js +28 -0
- data/lib/jazz/jasmine/jasmine-0.10.0.js +2526 -0
- data/lib/jazz/jasmine/jasmine.js +2526 -0
- data/lib/jazz/jasmine/json2.js +478 -0
- data/lib/jazz/options.rb +26 -0
- data/lib/jazz/outro.js +3 -0
- data/lib/jazz/qintro.js +113 -0
- data/lib/jazz/qoutro.js +3 -0
- data/lib/jazz/qunit/qunit.css +17 -0
- data/lib/jazz/qunit/qunit.js +1027 -0
- data/spec/example/hello_world_spec.js +29 -0
- data/spec/example/nested/HelloWorldSpec.js +13 -0
- data/spec/example/nested/SpecHelper.js +1 -0
- data/spec/example/plain_spec.js +8 -0
- data/spec/example/spec_helper.js +1 -0
- data/spec/spec_helper.js +18 -0
- data/spec/spec_runner.js +143 -0
- data/test/jazz_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- data/vendor/jasmine/MIT.LICENSE +20 -0
- data/vendor/jasmine/README.markdown +479 -0
- data/vendor/jasmine/Rakefile +155 -0
- data/vendor/jasmine/Wakefile +68 -0
- data/vendor/jasmine/contrib/ruby/jasmine_runner.rb +334 -0
- data/vendor/jasmine/contrib/ruby/jasmine_spec_builder.rb +153 -0
- data/vendor/jasmine/contrib/ruby/run.html +47 -0
- data/vendor/jasmine/contrib/ruby/spec/jasmine_runner_spec.rb +71 -0
- data/vendor/jasmine/doc/files.html +460 -0
- data/vendor/jasmine/doc/index.html +322 -0
- data/vendor/jasmine/doc/symbols/_global_.html +1083 -0
- data/vendor/jasmine/doc/symbols/jasmine.Block.html +417 -0
- data/vendor/jasmine/doc/symbols/jasmine.Clock.html +678 -0
- data/vendor/jasmine/doc/symbols/jasmine.Env.html +1135 -0
- data/vendor/jasmine/doc/symbols/jasmine.EnvjsReporter.html +328 -0
- data/vendor/jasmine/doc/symbols/jasmine.JsApiReporter.html +822 -0
- data/vendor/jasmine/doc/symbols/jasmine.Matchers.html +1106 -0
- data/vendor/jasmine/doc/symbols/jasmine.MultiReporter.html +394 -0
- data/vendor/jasmine/doc/symbols/jasmine.NestedResults.html +710 -0
- data/vendor/jasmine/doc/symbols/jasmine.Reporter.html +574 -0
- data/vendor/jasmine/doc/symbols/jasmine.Runner.html +710 -0
- data/vendor/jasmine/doc/symbols/jasmine.Spec.html +1372 -0
- data/vendor/jasmine/doc/symbols/jasmine.Spy.html +855 -0
- data/vendor/jasmine/doc/symbols/jasmine.Suite.html +705 -0
- data/vendor/jasmine/doc/symbols/jasmine.XMLReporter.html +328 -0
- data/vendor/jasmine/doc/symbols/jasmine.html +1359 -0
- data/vendor/jasmine/doc/symbols/jasmine.util.html +535 -0
- data/vendor/jasmine/doc/symbols/src/lib_EnvjsReporter.js.html +149 -0
- data/vendor/jasmine/doc/symbols/src/lib_TrivialReporter.js.html +127 -0
- data/vendor/jasmine/doc/symbols/src/lib_XMLReporter.js.html +210 -0
- data/vendor/jasmine/doc/symbols/src/src_Block.js.html +35 -0
- data/vendor/jasmine/doc/symbols/src/src_Env.js.html +233 -0
- data/vendor/jasmine/doc/symbols/src/src_JsApiReporter.js.html +110 -0
- data/vendor/jasmine/doc/symbols/src/src_Matchers.js.html +399 -0
- data/vendor/jasmine/doc/symbols/src/src_MultiReporter.js.html +36 -0
- data/vendor/jasmine/doc/symbols/src/src_NestedResults.js.html +88 -0
- data/vendor/jasmine/doc/symbols/src/src_PrettyPrinter.js.html +128 -0
- data/vendor/jasmine/doc/symbols/src/src_Queue.js.html +119 -0
- data/vendor/jasmine/doc/symbols/src/src_Reporter.js.html +35 -0
- data/vendor/jasmine/doc/symbols/src/src_Reporters.js.html +51 -0
- data/vendor/jasmine/doc/symbols/src/src_Runner.js.html +75 -0
- data/vendor/jasmine/doc/symbols/src/src_Spec.js.html +228 -0
- data/vendor/jasmine/doc/symbols/src/src_Suite.js.html +77 -0
- data/vendor/jasmine/doc/symbols/src/src_WaitsBlock.js.html +21 -0
- data/vendor/jasmine/doc/symbols/src/src_WaitsForBlock.js.html +45 -0
- data/vendor/jasmine/doc/symbols/src/src_base.js.html +566 -0
- data/vendor/jasmine/doc/symbols/src/src_mock-timeout.js.html +185 -0
- data/vendor/jasmine/doc/symbols/src/src_util.js.html +75 -0
- data/vendor/jasmine/examples/html/example_suite.html +27 -0
- data/vendor/jasmine/examples/html/spec/example_suite.js +11 -0
- data/vendor/jasmine/examples/ruby/Rakefile +33 -0
- data/vendor/jasmine/examples/ruby/spec/example/example_spec.js +11 -0
- data/vendor/jasmine/examples/ruby/spec/jasmine_helper.rb +41 -0
- data/vendor/jasmine/examples/ruby/spec/jasmine_spec.rb +31 -0
- data/vendor/jasmine/examples/ruby/spec/saucelabs.yml +24 -0
- data/vendor/jasmine/geminstaller.yml +23 -0
- data/vendor/jasmine/images/fail-16.png +0 -0
- data/vendor/jasmine/images/fail.png +0 -0
- data/vendor/jasmine/images/go-16.png +0 -0
- data/vendor/jasmine/images/go.png +0 -0
- data/vendor/jasmine/images/pending-16.png +0 -0
- data/vendor/jasmine/images/pending.png +0 -0
- data/vendor/jasmine/images/question-bk.png +0 -0
- data/vendor/jasmine/images/questionbk-16.png +0 -0
- data/vendor/jasmine/images/spinner.gif +0 -0
- data/vendor/jasmine/lib/EnvjsReporter.js +141 -0
- data/vendor/jasmine/lib/TrivialReporter.js +155 -0
- data/vendor/jasmine/lib/XMLReporter.js +241 -0
- data/vendor/jasmine/lib/consolex.js +28 -0
- data/vendor/jasmine/lib/jasmine-0.10.0.js +2526 -0
- data/vendor/jasmine/lib/jasmine.css +86 -0
- data/vendor/jasmine/lib/json2.js +478 -0
- data/vendor/jasmine/spec/jasmine_helper.rb +44 -0
- data/vendor/jasmine/spec/jasmine_spec.rb +31 -0
- data/vendor/jasmine/spec/runner.html +43 -0
- data/vendor/jasmine/spec/runner.js +78 -0
- data/vendor/jasmine/spec/saucelabs.yml +24 -0
- data/vendor/jasmine/spec/suites/EnvSpec.js +71 -0
- data/vendor/jasmine/spec/suites/ExceptionsSpec.js +107 -0
- data/vendor/jasmine/spec/suites/JsApiReporterSpec.js +82 -0
- data/vendor/jasmine/spec/suites/MatchersSpec.js +589 -0
- data/vendor/jasmine/spec/suites/MockClockSpec.js +34 -0
- data/vendor/jasmine/spec/suites/MultiReporterSpec.js +30 -0
- data/vendor/jasmine/spec/suites/NestedResultsSpec.js +54 -0
- data/vendor/jasmine/spec/suites/PrettyPrintSpec.js +93 -0
- data/vendor/jasmine/spec/suites/QueueSpec.js +23 -0
- data/vendor/jasmine/spec/suites/ReporterSpec.js +60 -0
- data/vendor/jasmine/spec/suites/RunnerSpec.js +258 -0
- data/vendor/jasmine/spec/suites/SpecRunningSpec.js +1117 -0
- data/vendor/jasmine/spec/suites/SpecSpec.js +110 -0
- data/vendor/jasmine/spec/suites/SpySpec.js +187 -0
- data/vendor/jasmine/spec/suites/SuiteSpec.js +101 -0
- data/vendor/jasmine/spec/suites/TrivialReporterSpec.js +140 -0
- data/vendor/jasmine/spec/suites/UtilSpec.js +23 -0
- data/vendor/jasmine/src/Block.js +34 -0
- data/vendor/jasmine/src/Env.js +236 -0
- data/vendor/jasmine/src/JsApiReporter.js +103 -0
- data/vendor/jasmine/src/Matchers.js +326 -0
- data/vendor/jasmine/src/MultiReporter.js +28 -0
- data/vendor/jasmine/src/NestedResults.js +99 -0
- data/vendor/jasmine/src/PrettyPrinter.js +122 -0
- data/vendor/jasmine/src/Queue.js +210 -0
- data/vendor/jasmine/src/Reporter.js +27 -0
- data/vendor/jasmine/src/Reporters.js +43 -0
- data/vendor/jasmine/src/Runner.js +68 -0
- data/vendor/jasmine/src/Spec.js +254 -0
- data/vendor/jasmine/src/Suite.js +70 -0
- data/vendor/jasmine/src/WaitsBlock.js +13 -0
- data/vendor/jasmine/src/WaitsForBlock.js +38 -0
- data/vendor/jasmine/src/base.js +604 -0
- data/vendor/jasmine/src/mock-timeout.js +177 -0
- data/vendor/jasmine/src/util.js +67 -0
- data/vendor/jasmine/src/version.json +5 -0
- metadata +292 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
/** No-op base class for Jasmine reporters.
|
2
|
+
*
|
3
|
+
* @constructor
|
4
|
+
*/
|
5
|
+
jasmine.Reporter = function() {
|
6
|
+
};
|
7
|
+
|
8
|
+
//noinspection JSUnusedLocalSymbols
|
9
|
+
jasmine.Reporter.prototype.reportRunnerStarting = function(runner) {
|
10
|
+
};
|
11
|
+
|
12
|
+
//noinspection JSUnusedLocalSymbols
|
13
|
+
jasmine.Reporter.prototype.reportRunnerResults = function(runner) {
|
14
|
+
};
|
15
|
+
|
16
|
+
//noinspection JSUnusedLocalSymbols
|
17
|
+
jasmine.Reporter.prototype.reportSuiteResults = function(suite) {
|
18
|
+
};
|
19
|
+
|
20
|
+
//noinspection JSUnusedLocalSymbols
|
21
|
+
jasmine.Reporter.prototype.reportSpecResults = function(spec) {
|
22
|
+
};
|
23
|
+
|
24
|
+
//noinspection JSUnusedLocalSymbols
|
25
|
+
jasmine.Reporter.prototype.log = function(str) {
|
26
|
+
};
|
27
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/** JasmineReporters.reporter
|
2
|
+
* Base object that will get called whenever a Spec, Suite, or Runner is done. It is up to
|
3
|
+
* descendants of this object to do something with the results (see json_reporter.js)
|
4
|
+
*
|
5
|
+
* @deprecated
|
6
|
+
*/
|
7
|
+
jasmine.Reporters = {};
|
8
|
+
|
9
|
+
/**
|
10
|
+
* @deprecated
|
11
|
+
* @param callbacks
|
12
|
+
*/
|
13
|
+
jasmine.Reporters.reporter = function(callbacks) {
|
14
|
+
/**
|
15
|
+
* @deprecated
|
16
|
+
* @param callbacks
|
17
|
+
*/
|
18
|
+
var that = {
|
19
|
+
callbacks: callbacks || {},
|
20
|
+
|
21
|
+
doCallback: function(callback, results) {
|
22
|
+
if (callback) {
|
23
|
+
callback(results);
|
24
|
+
}
|
25
|
+
},
|
26
|
+
|
27
|
+
reportRunnerResults: function(runner) {
|
28
|
+
that.doCallback(that.callbacks.runnerCallback, runner);
|
29
|
+
},
|
30
|
+
reportSuiteResults: function(suite) {
|
31
|
+
that.doCallback(that.callbacks.suiteCallback, suite);
|
32
|
+
},
|
33
|
+
reportSpecResults: function(spec) {
|
34
|
+
that.doCallback(that.callbacks.specCallback, spec);
|
35
|
+
},
|
36
|
+
log: function (str) {
|
37
|
+
if (this.console && this.console.log) this.console.log(str);
|
38
|
+
}
|
39
|
+
};
|
40
|
+
|
41
|
+
return that;
|
42
|
+
};
|
43
|
+
|
@@ -0,0 +1,68 @@
|
|
1
|
+
/**
|
2
|
+
* Runner
|
3
|
+
*
|
4
|
+
* @constructor
|
5
|
+
* @param {jasmine.Env} env
|
6
|
+
*/
|
7
|
+
jasmine.Runner = function(env) {
|
8
|
+
var self = this;
|
9
|
+
self.env = env;
|
10
|
+
self.queue = new jasmine.Queue(env);
|
11
|
+
self.before_ = [];
|
12
|
+
self.after_ = [];
|
13
|
+
self.suites_ = [];
|
14
|
+
};
|
15
|
+
|
16
|
+
jasmine.Runner.prototype.execute = function() {
|
17
|
+
var self = this;
|
18
|
+
if (self.env.reporter.reportRunnerStarting) {
|
19
|
+
self.env.reporter.reportRunnerStarting(this);
|
20
|
+
}
|
21
|
+
self.queue.start(function () {
|
22
|
+
self.finishCallback();
|
23
|
+
});
|
24
|
+
};
|
25
|
+
|
26
|
+
jasmine.Runner.prototype.beforeEach = function(beforeEachFunction) {
|
27
|
+
beforeEachFunction.typeName = 'beforeEach';
|
28
|
+
this.before_.push(beforeEachFunction);
|
29
|
+
};
|
30
|
+
|
31
|
+
jasmine.Runner.prototype.afterEach = function(afterEachFunction) {
|
32
|
+
afterEachFunction.typeName = 'afterEach';
|
33
|
+
this.after_.push(afterEachFunction);
|
34
|
+
};
|
35
|
+
|
36
|
+
|
37
|
+
jasmine.Runner.prototype.finishCallback = function() {
|
38
|
+
this.env.reporter.reportRunnerResults(this);
|
39
|
+
};
|
40
|
+
|
41
|
+
jasmine.Runner.prototype.addSuite = function(suite) {
|
42
|
+
this.suites_.push(suite);
|
43
|
+
};
|
44
|
+
|
45
|
+
jasmine.Runner.prototype.add = function(block) {
|
46
|
+
if (block instanceof jasmine.Suite) {
|
47
|
+
this.addSuite(block);
|
48
|
+
}
|
49
|
+
this.queue.add(block);
|
50
|
+
};
|
51
|
+
|
52
|
+
jasmine.Runner.prototype.specs = function () {
|
53
|
+
var suites = this.suites();
|
54
|
+
var specs = [];
|
55
|
+
for (var i = 0; i < suites.length; i++) {
|
56
|
+
specs = specs.concat(suites[i].specs());
|
57
|
+
}
|
58
|
+
return specs;
|
59
|
+
};
|
60
|
+
|
61
|
+
|
62
|
+
jasmine.Runner.prototype.suites = function() {
|
63
|
+
return this.suites_;
|
64
|
+
};
|
65
|
+
|
66
|
+
jasmine.Runner.prototype.results = function() {
|
67
|
+
return this.queue.results();
|
68
|
+
};
|
@@ -0,0 +1,254 @@
|
|
1
|
+
/**
|
2
|
+
* Internal representation of a Jasmine specification, or test.
|
3
|
+
*
|
4
|
+
* @constructor
|
5
|
+
* @param {jasmine.Env} env
|
6
|
+
* @param {jasmine.Suite} suite
|
7
|
+
* @param {String} description
|
8
|
+
*/
|
9
|
+
jasmine.Spec = function(env, suite, description) {
|
10
|
+
if (!env) {
|
11
|
+
throw new Error('jasmine.Env() required');
|
12
|
+
}
|
13
|
+
if (!suite) {
|
14
|
+
throw new Error('jasmine.Suite() required');
|
15
|
+
}
|
16
|
+
var spec = this;
|
17
|
+
spec.id = env.nextSpecId ? env.nextSpecId() : null;
|
18
|
+
spec.env = env;
|
19
|
+
spec.suite = suite;
|
20
|
+
spec.description = description;
|
21
|
+
spec.queue = new jasmine.Queue(env);
|
22
|
+
|
23
|
+
spec.afterCallbacks = [];
|
24
|
+
spec.spies_ = [];
|
25
|
+
|
26
|
+
spec.results_ = new jasmine.NestedResults();
|
27
|
+
spec.results_.description = description;
|
28
|
+
spec.matchersClass = null;
|
29
|
+
};
|
30
|
+
|
31
|
+
jasmine.Spec.prototype.getFullName = function() {
|
32
|
+
return this.suite.getFullName() + ' ' + this.description + '.';
|
33
|
+
};
|
34
|
+
|
35
|
+
|
36
|
+
jasmine.Spec.prototype.results = function() {
|
37
|
+
return this.results_;
|
38
|
+
};
|
39
|
+
|
40
|
+
jasmine.Spec.prototype.log = function(message) {
|
41
|
+
return this.results_.log(message);
|
42
|
+
};
|
43
|
+
|
44
|
+
/** @deprecated */
|
45
|
+
jasmine.Spec.prototype.getResults = function() {
|
46
|
+
return this.results_;
|
47
|
+
};
|
48
|
+
|
49
|
+
jasmine.Spec.prototype.runs = function (func) {
|
50
|
+
var block = new jasmine.Block(this.env, func, this);
|
51
|
+
this.addToQueue(block);
|
52
|
+
( this.pending != -1 ) && ( !this.queue.isRunning() ) && ( this.pending = false );
|
53
|
+
return this;
|
54
|
+
};
|
55
|
+
|
56
|
+
jasmine.Spec.prototype.addToQueue = function (block) {
|
57
|
+
if (this.queue.isRunning()) {
|
58
|
+
this.queue.insertNext(block);
|
59
|
+
} else {
|
60
|
+
this.queue.add(block);
|
61
|
+
}
|
62
|
+
};
|
63
|
+
|
64
|
+
jasmine.Spec.prototype.stop = function(delay){
|
65
|
+
this.queue._stop(delay);
|
66
|
+
};
|
67
|
+
|
68
|
+
jasmine.Spec.prototype.start = function(){
|
69
|
+
this.queue._start();
|
70
|
+
};
|
71
|
+
|
72
|
+
jasmine.Spec.prototype.eventually = function(func){
|
73
|
+
// this.queue._eventually(fn);
|
74
|
+
var block = new jasmine.Block(this.env, func, this);
|
75
|
+
block.is_eventual = true;
|
76
|
+
this.addToQueue(block);
|
77
|
+
( this.pending != -1 ) && ( this.pending = false );
|
78
|
+
return this;
|
79
|
+
};
|
80
|
+
|
81
|
+
jasmine.Spec.prototype.wait_for = function(condition,fn){
|
82
|
+
this.queue._wait_for(condition,fn);
|
83
|
+
};
|
84
|
+
|
85
|
+
jasmine.Spec.prototype.anticipate = function(number){
|
86
|
+
this._anticipate = number;
|
87
|
+
};
|
88
|
+
|
89
|
+
jasmine.Spec.prototype.addMatcherResult = function(result) {
|
90
|
+
this.results_.addResult(result);
|
91
|
+
};
|
92
|
+
|
93
|
+
jasmine.Spec.prototype.expect = function(actual) {
|
94
|
+
return new (this.getMatchersClass_())(this.env, actual, this);
|
95
|
+
};
|
96
|
+
|
97
|
+
jasmine.Spec.prototype.waits = function(timeout) {
|
98
|
+
var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this);
|
99
|
+
this.addToQueue(waitsFunc);
|
100
|
+
return this;
|
101
|
+
};
|
102
|
+
|
103
|
+
jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessage) {
|
104
|
+
var waitsForFunc = new jasmine.WaitsForBlock(this.env, timeout, latchFunction, timeoutMessage, this);
|
105
|
+
this.addToQueue(waitsForFunc);
|
106
|
+
return this;
|
107
|
+
};
|
108
|
+
|
109
|
+
jasmine.Spec.prototype.fail = function (e) {
|
110
|
+
var expectationResult = new jasmine.ExpectationResult({
|
111
|
+
passed: false,
|
112
|
+
message: e ? jasmine.util.formatException(e) : 'Exception',
|
113
|
+
exception: e
|
114
|
+
});
|
115
|
+
this.results_.addResult(expectationResult);
|
116
|
+
};
|
117
|
+
|
118
|
+
jasmine.Spec.prototype.getMatchersClass_ = function() {
|
119
|
+
return this.matchersClass || this.env.matchersClass;
|
120
|
+
};
|
121
|
+
|
122
|
+
jasmine.Spec.prototype.addMatchers = function(matchersPrototype) {
|
123
|
+
var parent = this.getMatchersClass_();
|
124
|
+
var newMatchersClass = function() {
|
125
|
+
parent.apply(this, arguments);
|
126
|
+
};
|
127
|
+
jasmine.util.inherit(newMatchersClass, parent);
|
128
|
+
for (var method in matchersPrototype) {
|
129
|
+
newMatchersClass.prototype[method] = matchersPrototype[method];
|
130
|
+
}
|
131
|
+
this.matchersClass = newMatchersClass;
|
132
|
+
};
|
133
|
+
|
134
|
+
jasmine.Spec.prototype.finishCallback = function() {
|
135
|
+
this.env.reporter.reportSpecResults(this);
|
136
|
+
};
|
137
|
+
|
138
|
+
jasmine.Spec.prototype.finish = function(onComplete) {
|
139
|
+
this.removeAllSpies();
|
140
|
+
this.finishCallback();
|
141
|
+
if (onComplete) {
|
142
|
+
onComplete();
|
143
|
+
}
|
144
|
+
};
|
145
|
+
|
146
|
+
jasmine.Spec.prototype.after = function(doAfter, test) {
|
147
|
+
|
148
|
+
if (this.queue.isRunning()) {
|
149
|
+
this.queue.add(new jasmine.Block(this.env, doAfter, this));
|
150
|
+
} else {
|
151
|
+
this.afterCallbacks.unshift(doAfter);
|
152
|
+
}
|
153
|
+
};
|
154
|
+
|
155
|
+
jasmine.Spec.prototype.execute = function(onComplete) {
|
156
|
+
var spec = this;
|
157
|
+
if (!spec.env.specFilter(spec)) {
|
158
|
+
spec.results_.skipped = true;
|
159
|
+
spec.finish(onComplete);
|
160
|
+
return;
|
161
|
+
}
|
162
|
+
this.env.reporter.log('>> Jasmine Running ' + this.suite.description + ' ' + this.description + '...');
|
163
|
+
|
164
|
+
spec.env.currentSpec = spec;
|
165
|
+
|
166
|
+
spec.addBeforesAndAftersToQueue();
|
167
|
+
|
168
|
+
spec.queue.start(function () {
|
169
|
+
spec.finish(onComplete);
|
170
|
+
});
|
171
|
+
};
|
172
|
+
|
173
|
+
jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
|
174
|
+
var runner = this.env.currentRunner();
|
175
|
+
var block;
|
176
|
+
for (var suite = this.suite; suite; suite = suite.parentSuite) {
|
177
|
+
for (var i = 0; i < suite.before_.length; i++) {
|
178
|
+
block = new jasmine.Block(this.env, suite.before_[i], this);
|
179
|
+
block.is_before = true;
|
180
|
+
this.queue.addBefore(block);
|
181
|
+
}
|
182
|
+
}
|
183
|
+
for (var i = 0; i < runner.before_.length; i++) {
|
184
|
+
block = new jasmine.Block(this.env, runner.before_[i], this);
|
185
|
+
block.is_before = true;
|
186
|
+
this.queue.addBefore(block);
|
187
|
+
}
|
188
|
+
for (i = 0; i < this.afterCallbacks.length; i++) {
|
189
|
+
block = new jasmine.Block(this.env, this.afterCallbacks[i], this);
|
190
|
+
block.is_after = true;
|
191
|
+
this.queue.add(block);
|
192
|
+
}
|
193
|
+
for (suite = this.suite; suite; suite = suite.parentSuite) {
|
194
|
+
for (var i = 0; i < suite.after_.length; i++) {
|
195
|
+
block = new jasmine.Block(this.env, suite.after_[i], this);
|
196
|
+
block.is_after = true;
|
197
|
+
this.queue.add(block);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
for (var i = 0; i < runner.after_.length; i++) {
|
201
|
+
block = new jasmine.Block(this.env, runner.after_[i], this);
|
202
|
+
block.is_after = true;
|
203
|
+
this.queue.add(block);
|
204
|
+
}
|
205
|
+
};
|
206
|
+
|
207
|
+
jasmine.Spec.prototype.explodes = function() {
|
208
|
+
throw 'explodes function should not have been called';
|
209
|
+
};
|
210
|
+
|
211
|
+
jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) {
|
212
|
+
if (obj == jasmine.undefined) {
|
213
|
+
throw "spyOn could not find an object to spy upon for " + methodName + "()";
|
214
|
+
}
|
215
|
+
|
216
|
+
if (!ignoreMethodDoesntExist && obj[methodName] === jasmine.undefined) {
|
217
|
+
throw methodName + '() method does not exist';
|
218
|
+
}
|
219
|
+
|
220
|
+
if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) {
|
221
|
+
throw new Error(methodName + ' has already been spied upon');
|
222
|
+
}
|
223
|
+
|
224
|
+
var spyObj = jasmine.createSpy(methodName);
|
225
|
+
|
226
|
+
this.spies_.push(spyObj);
|
227
|
+
spyObj.baseObj = obj;
|
228
|
+
spyObj.methodName = methodName;
|
229
|
+
spyObj.originalValue = obj[methodName];
|
230
|
+
|
231
|
+
obj[methodName] = spyObj;
|
232
|
+
|
233
|
+
return spyObj;
|
234
|
+
};
|
235
|
+
|
236
|
+
jasmine.Spec.prototype.removeAllSpies = function() {
|
237
|
+
for (var i = 0; i < this.spies_.length; i++) {
|
238
|
+
var spy = this.spies_[i];
|
239
|
+
spy.baseObj[spy.methodName] = spy.originalValue;
|
240
|
+
}
|
241
|
+
this.spies_ = [];
|
242
|
+
};
|
243
|
+
|
244
|
+
jasmine.Spec.prototype.block_start = function() {
|
245
|
+
this.results_.block_start();
|
246
|
+
};
|
247
|
+
|
248
|
+
jasmine.Spec.prototype.block_finish = function() {
|
249
|
+
this.results_.block_finish();
|
250
|
+
};
|
251
|
+
|
252
|
+
jasmine.Spec.prototype.block_abort = function() {
|
253
|
+
this.results_.block_abort();
|
254
|
+
};
|
@@ -0,0 +1,70 @@
|
|
1
|
+
/**
|
2
|
+
* Internal representation of a Jasmine suite.
|
3
|
+
*
|
4
|
+
* @constructor
|
5
|
+
* @param {jasmine.Env} env
|
6
|
+
* @param {String} description
|
7
|
+
* @param {Function} specDefinitions
|
8
|
+
* @param {jasmine.Suite} parentSuite
|
9
|
+
*/
|
10
|
+
jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
|
11
|
+
var self = this;
|
12
|
+
self.id = env.nextSuiteId ? env.nextSuiteId() : null;
|
13
|
+
self.description = description;
|
14
|
+
self.queue = new jasmine.Queue(env);
|
15
|
+
self.parentSuite = parentSuite;
|
16
|
+
self.env = env;
|
17
|
+
self.before_ = [];
|
18
|
+
self.after_ = [];
|
19
|
+
self.specs_ = [];
|
20
|
+
};
|
21
|
+
|
22
|
+
jasmine.Suite.prototype.getFullName = function() {
|
23
|
+
var fullName = this.description;
|
24
|
+
for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) {
|
25
|
+
fullName = parentSuite.description + ' ' + fullName;
|
26
|
+
}
|
27
|
+
return fullName;
|
28
|
+
};
|
29
|
+
|
30
|
+
jasmine.Suite.prototype.finish = function(onComplete) {
|
31
|
+
this.env.reporter.reportSuiteResults(this);
|
32
|
+
this.finished = true;
|
33
|
+
if (typeof(onComplete) == 'function') {
|
34
|
+
onComplete();
|
35
|
+
}
|
36
|
+
};
|
37
|
+
|
38
|
+
jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) {
|
39
|
+
beforeEachFunction.typeName = 'beforeEach';
|
40
|
+
this.before_.push(beforeEachFunction);
|
41
|
+
};
|
42
|
+
|
43
|
+
jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
|
44
|
+
afterEachFunction.typeName = 'afterEach';
|
45
|
+
this.after_.push(afterEachFunction);
|
46
|
+
};
|
47
|
+
|
48
|
+
jasmine.Suite.prototype.results = function() {
|
49
|
+
return this.queue.results();
|
50
|
+
};
|
51
|
+
|
52
|
+
jasmine.Suite.prototype.add = function(block) {
|
53
|
+
if (block instanceof jasmine.Suite) {
|
54
|
+
this.env.currentRunner().addSuite(block);
|
55
|
+
} else {
|
56
|
+
this.specs_.push(block);
|
57
|
+
}
|
58
|
+
this.queue.add(block);
|
59
|
+
};
|
60
|
+
|
61
|
+
jasmine.Suite.prototype.specs = function() {
|
62
|
+
return this.specs_;
|
63
|
+
};
|
64
|
+
|
65
|
+
jasmine.Suite.prototype.execute = function(onComplete) {
|
66
|
+
var self = this;
|
67
|
+
this.queue.start(function () {
|
68
|
+
self.finish(onComplete);
|
69
|
+
});
|
70
|
+
};
|