js-test-driver-rails 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.gitmodules +6 -0
- data/Gemfile +2 -5
- data/Gemfile.lock +8 -9
- data/Rakefile +3 -28
- data/js-test-driver-rails.gemspec +25 -0
- data/lib/js_test_driver/version.rb +3 -0
- metadata +17 -183
- data/VERSION +0 -1
- data/vendor/jasmine-jstd-adapter/MIT.LICENSE +0 -22
- data/vendor/jasmine-jstd-adapter/README.md +0 -25
- data/vendor/jasmine-jstd-adapter/jsTestDriver.conf +0 -6
- data/vendor/jasmine-jstd-adapter/jsTestDriverIit.conf +0 -6
- data/vendor/jasmine-jstd-adapter/lib/jasmine/jasmine-0.11.1.js +0 -2343
- data/vendor/jasmine-jstd-adapter/lib/jstestdriver/JsTestDriver.jar +0 -0
- data/vendor/jasmine-jstd-adapter/server.sh +0 -1
- data/vendor/jasmine-jstd-adapter/src-test/iit/iitSpec.js +0 -46
- data/vendor/jasmine-jstd-adapter/src-test/tests.js +0 -89
- data/vendor/jasmine-jstd-adapter/src/JasmineAdapter.js +0 -186
- data/vendor/jasmine-jstd-adapter/test-iit.sh +0 -1
- data/vendor/jasmine-jstd-adapter/test-regular.sh +0 -2
- data/vendor/jasmine-jstd-adapter/test.sh +0 -2
- data/vendor/jasmine/Gemfile +0 -6
- data/vendor/jasmine/MIT.LICENSE +0 -20
- data/vendor/jasmine/README.markdown +0 -28
- data/vendor/jasmine/Rakefile +0 -182
- data/vendor/jasmine/cruise_config.rb +0 -21
- data/vendor/jasmine/example/SpecRunner.html +0 -27
- data/vendor/jasmine/example/spec/PlayerSpec.js +0 -58
- data/vendor/jasmine/example/spec/SpecHelper.js +0 -9
- data/vendor/jasmine/example/src/Player.js +0 -22
- data/vendor/jasmine/example/src/Song.js +0 -7
- 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/jsdoc-template/allclasses.tmpl +0 -17
- data/vendor/jasmine/jsdoc-template/allfiles.tmpl +0 -56
- data/vendor/jasmine/jsdoc-template/class.tmpl +0 -646
- data/vendor/jasmine/jsdoc-template/index.tmpl +0 -39
- data/vendor/jasmine/jsdoc-template/publish.js +0 -184
- data/vendor/jasmine/jsdoc-template/static/default.css +0 -162
- data/vendor/jasmine/jsdoc-template/static/header.html +0 -2
- data/vendor/jasmine/jsdoc-template/static/index.html +0 -19
- data/vendor/jasmine/jsdoc-template/symbol.tmpl +0 -35
- data/vendor/jasmine/lib/jasmine-html.js +0 -188
- data/vendor/jasmine/lib/jasmine.css +0 -166
- data/vendor/jasmine/lib/jasmine.js +0 -2421
- data/vendor/jasmine/lib/json2.js +0 -478
- data/vendor/jasmine/spec/runner.html +0 -80
- data/vendor/jasmine/spec/suites/BaseSpec.js +0 -27
- data/vendor/jasmine/spec/suites/CustomMatchersSpec.js +0 -97
- data/vendor/jasmine/spec/suites/EnvSpec.js +0 -158
- data/vendor/jasmine/spec/suites/ExceptionsSpec.js +0 -107
- data/vendor/jasmine/spec/suites/JsApiReporterSpec.js +0 -103
- data/vendor/jasmine/spec/suites/MatchersSpec.js +0 -795
- data/vendor/jasmine/spec/suites/MockClockSpec.js +0 -38
- data/vendor/jasmine/spec/suites/MultiReporterSpec.js +0 -45
- data/vendor/jasmine/spec/suites/NestedResultsSpec.js +0 -54
- data/vendor/jasmine/spec/suites/PrettyPrintSpec.js +0 -93
- data/vendor/jasmine/spec/suites/QueueSpec.js +0 -23
- data/vendor/jasmine/spec/suites/ReporterSpec.js +0 -56
- data/vendor/jasmine/spec/suites/RunnerSpec.js +0 -267
- data/vendor/jasmine/spec/suites/SpecRunningSpec.js +0 -1253
- data/vendor/jasmine/spec/suites/SpecSpec.js +0 -124
- data/vendor/jasmine/spec/suites/SpySpec.js +0 -201
- data/vendor/jasmine/spec/suites/SuiteSpec.js +0 -120
- data/vendor/jasmine/spec/suites/TrivialReporterSpec.js +0 -238
- data/vendor/jasmine/spec/suites/UtilSpec.js +0 -40
- data/vendor/jasmine/spec/suites/WaitsForBlockSpec.js +0 -87
- data/vendor/jasmine/src/Block.js +0 -22
- data/vendor/jasmine/src/Env.js +0 -264
- data/vendor/jasmine/src/JsApiReporter.js +0 -102
- data/vendor/jasmine/src/Matchers.js +0 -354
- data/vendor/jasmine/src/MultiReporter.js +0 -35
- data/vendor/jasmine/src/NestedResults.js +0 -80
- data/vendor/jasmine/src/PrettyPrinter.js +0 -122
- data/vendor/jasmine/src/Queue.js +0 -99
- data/vendor/jasmine/src/Reporter.js +0 -31
- data/vendor/jasmine/src/Runner.js +0 -77
- data/vendor/jasmine/src/Spec.js +0 -242
- data/vendor/jasmine/src/Suite.js +0 -82
- data/vendor/jasmine/src/WaitsBlock.js +0 -13
- data/vendor/jasmine/src/WaitsForBlock.js +0 -52
- data/vendor/jasmine/src/base.js +0 -589
- data/vendor/jasmine/src/html/TrivialReporter.js +0 -188
- data/vendor/jasmine/src/html/jasmine.css +0 -166
- data/vendor/jasmine/src/mock-timeout.js +0 -183
- data/vendor/jasmine/src/util.js +0 -67
- data/vendor/jasmine/src/version.json +0 -5
@@ -1,122 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Base class for pretty printing for expectation results.
|
3
|
-
*/
|
4
|
-
jasmine.PrettyPrinter = function() {
|
5
|
-
this.ppNestLevel_ = 0;
|
6
|
-
};
|
7
|
-
|
8
|
-
/**
|
9
|
-
* Formats a value in a nice, human-readable string.
|
10
|
-
*
|
11
|
-
* @param value
|
12
|
-
*/
|
13
|
-
jasmine.PrettyPrinter.prototype.format = function(value) {
|
14
|
-
if (this.ppNestLevel_ > 40) {
|
15
|
-
throw new Error('jasmine.PrettyPrinter: format() nested too deeply!');
|
16
|
-
}
|
17
|
-
|
18
|
-
this.ppNestLevel_++;
|
19
|
-
try {
|
20
|
-
if (value === jasmine.undefined) {
|
21
|
-
this.emitScalar('undefined');
|
22
|
-
} else if (value === null) {
|
23
|
-
this.emitScalar('null');
|
24
|
-
} else if (value === jasmine.getGlobal()) {
|
25
|
-
this.emitScalar('<global>');
|
26
|
-
} else if (value instanceof jasmine.Matchers.Any) {
|
27
|
-
this.emitScalar(value.toString());
|
28
|
-
} else if (typeof value === 'string') {
|
29
|
-
this.emitString(value);
|
30
|
-
} else if (jasmine.isSpy(value)) {
|
31
|
-
this.emitScalar("spy on " + value.identity);
|
32
|
-
} else if (value instanceof RegExp) {
|
33
|
-
this.emitScalar(value.toString());
|
34
|
-
} else if (typeof value === 'function') {
|
35
|
-
this.emitScalar('Function');
|
36
|
-
} else if (typeof value.nodeType === 'number') {
|
37
|
-
this.emitScalar('HTMLNode');
|
38
|
-
} else if (value instanceof Date) {
|
39
|
-
this.emitScalar('Date(' + value + ')');
|
40
|
-
} else if (value.__Jasmine_been_here_before__) {
|
41
|
-
this.emitScalar('<circular reference: ' + (jasmine.isArray_(value) ? 'Array' : 'Object') + '>');
|
42
|
-
} else if (jasmine.isArray_(value) || typeof value == 'object') {
|
43
|
-
value.__Jasmine_been_here_before__ = true;
|
44
|
-
if (jasmine.isArray_(value)) {
|
45
|
-
this.emitArray(value);
|
46
|
-
} else {
|
47
|
-
this.emitObject(value);
|
48
|
-
}
|
49
|
-
delete value.__Jasmine_been_here_before__;
|
50
|
-
} else {
|
51
|
-
this.emitScalar(value.toString());
|
52
|
-
}
|
53
|
-
} finally {
|
54
|
-
this.ppNestLevel_--;
|
55
|
-
}
|
56
|
-
};
|
57
|
-
|
58
|
-
jasmine.PrettyPrinter.prototype.iterateObject = function(obj, fn) {
|
59
|
-
for (var property in obj) {
|
60
|
-
if (property == '__Jasmine_been_here_before__') continue;
|
61
|
-
fn(property, obj.__lookupGetter__ ? (obj.__lookupGetter__(property) != null) : false);
|
62
|
-
}
|
63
|
-
};
|
64
|
-
|
65
|
-
jasmine.PrettyPrinter.prototype.emitArray = jasmine.unimplementedMethod_;
|
66
|
-
jasmine.PrettyPrinter.prototype.emitObject = jasmine.unimplementedMethod_;
|
67
|
-
jasmine.PrettyPrinter.prototype.emitScalar = jasmine.unimplementedMethod_;
|
68
|
-
jasmine.PrettyPrinter.prototype.emitString = jasmine.unimplementedMethod_;
|
69
|
-
|
70
|
-
jasmine.StringPrettyPrinter = function() {
|
71
|
-
jasmine.PrettyPrinter.call(this);
|
72
|
-
|
73
|
-
this.string = '';
|
74
|
-
};
|
75
|
-
jasmine.util.inherit(jasmine.StringPrettyPrinter, jasmine.PrettyPrinter);
|
76
|
-
|
77
|
-
jasmine.StringPrettyPrinter.prototype.emitScalar = function(value) {
|
78
|
-
this.append(value);
|
79
|
-
};
|
80
|
-
|
81
|
-
jasmine.StringPrettyPrinter.prototype.emitString = function(value) {
|
82
|
-
this.append("'" + value + "'");
|
83
|
-
};
|
84
|
-
|
85
|
-
jasmine.StringPrettyPrinter.prototype.emitArray = function(array) {
|
86
|
-
this.append('[ ');
|
87
|
-
for (var i = 0; i < array.length; i++) {
|
88
|
-
if (i > 0) {
|
89
|
-
this.append(', ');
|
90
|
-
}
|
91
|
-
this.format(array[i]);
|
92
|
-
}
|
93
|
-
this.append(' ]');
|
94
|
-
};
|
95
|
-
|
96
|
-
jasmine.StringPrettyPrinter.prototype.emitObject = function(obj) {
|
97
|
-
var self = this;
|
98
|
-
this.append('{ ');
|
99
|
-
var first = true;
|
100
|
-
|
101
|
-
this.iterateObject(obj, function(property, isGetter) {
|
102
|
-
if (first) {
|
103
|
-
first = false;
|
104
|
-
} else {
|
105
|
-
self.append(', ');
|
106
|
-
}
|
107
|
-
|
108
|
-
self.append(property);
|
109
|
-
self.append(' : ');
|
110
|
-
if (isGetter) {
|
111
|
-
self.append('<getter>');
|
112
|
-
} else {
|
113
|
-
self.format(obj[property]);
|
114
|
-
}
|
115
|
-
});
|
116
|
-
|
117
|
-
this.append(' }');
|
118
|
-
};
|
119
|
-
|
120
|
-
jasmine.StringPrettyPrinter.prototype.append = function(value) {
|
121
|
-
this.string += value;
|
122
|
-
};
|
data/vendor/jasmine/src/Queue.js
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
jasmine.Queue = function(env) {
|
2
|
-
this.env = env;
|
3
|
-
this.blocks = [];
|
4
|
-
this.running = false;
|
5
|
-
this.index = 0;
|
6
|
-
this.offset = 0;
|
7
|
-
this.abort = false;
|
8
|
-
};
|
9
|
-
|
10
|
-
jasmine.Queue.prototype.addBefore = function(block) {
|
11
|
-
this.blocks.unshift(block);
|
12
|
-
};
|
13
|
-
|
14
|
-
jasmine.Queue.prototype.add = function(block) {
|
15
|
-
this.blocks.push(block);
|
16
|
-
};
|
17
|
-
|
18
|
-
jasmine.Queue.prototype.insertNext = function(block) {
|
19
|
-
this.blocks.splice((this.index + this.offset + 1), 0, block);
|
20
|
-
this.offset++;
|
21
|
-
};
|
22
|
-
|
23
|
-
jasmine.Queue.prototype.start = function(onComplete) {
|
24
|
-
this.running = true;
|
25
|
-
this.onComplete = onComplete;
|
26
|
-
this.next_();
|
27
|
-
};
|
28
|
-
|
29
|
-
jasmine.Queue.prototype.isRunning = function() {
|
30
|
-
return this.running;
|
31
|
-
};
|
32
|
-
|
33
|
-
jasmine.Queue.LOOP_DONT_RECURSE = true;
|
34
|
-
|
35
|
-
jasmine.Queue.prototype.next_ = function() {
|
36
|
-
var self = this;
|
37
|
-
var goAgain = true;
|
38
|
-
|
39
|
-
while (goAgain) {
|
40
|
-
goAgain = false;
|
41
|
-
|
42
|
-
if (self.index < self.blocks.length && !this.abort) {
|
43
|
-
var calledSynchronously = true;
|
44
|
-
var completedSynchronously = false;
|
45
|
-
|
46
|
-
var onComplete = function () {
|
47
|
-
if (jasmine.Queue.LOOP_DONT_RECURSE && calledSynchronously) {
|
48
|
-
completedSynchronously = true;
|
49
|
-
return;
|
50
|
-
}
|
51
|
-
|
52
|
-
if (self.blocks[self.index].abort) {
|
53
|
-
self.abort = true;
|
54
|
-
}
|
55
|
-
|
56
|
-
self.offset = 0;
|
57
|
-
self.index++;
|
58
|
-
|
59
|
-
var now = new Date().getTime();
|
60
|
-
if (self.env.updateInterval && now - self.env.lastUpdate > self.env.updateInterval) {
|
61
|
-
self.env.lastUpdate = now;
|
62
|
-
self.env.setTimeout(function() {
|
63
|
-
self.next_();
|
64
|
-
}, 0);
|
65
|
-
} else {
|
66
|
-
if (jasmine.Queue.LOOP_DONT_RECURSE && completedSynchronously) {
|
67
|
-
goAgain = true;
|
68
|
-
} else {
|
69
|
-
self.next_();
|
70
|
-
}
|
71
|
-
}
|
72
|
-
};
|
73
|
-
self.blocks[self.index].execute(onComplete);
|
74
|
-
|
75
|
-
calledSynchronously = false;
|
76
|
-
if (completedSynchronously) {
|
77
|
-
onComplete();
|
78
|
-
}
|
79
|
-
|
80
|
-
} else {
|
81
|
-
self.running = false;
|
82
|
-
if (self.onComplete) {
|
83
|
-
self.onComplete();
|
84
|
-
}
|
85
|
-
}
|
86
|
-
}
|
87
|
-
};
|
88
|
-
|
89
|
-
jasmine.Queue.prototype.results = function() {
|
90
|
-
var results = new jasmine.NestedResults();
|
91
|
-
for (var i = 0; i < this.blocks.length; i++) {
|
92
|
-
if (this.blocks[i].results) {
|
93
|
-
results.addResult(this.blocks[i].results());
|
94
|
-
}
|
95
|
-
}
|
96
|
-
return results;
|
97
|
-
};
|
98
|
-
|
99
|
-
|
@@ -1,31 +0,0 @@
|
|
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.reportSpecStarting = function(spec) {
|
22
|
-
};
|
23
|
-
|
24
|
-
//noinspection JSUnusedLocalSymbols
|
25
|
-
jasmine.Reporter.prototype.reportSpecResults = function(spec) {
|
26
|
-
};
|
27
|
-
|
28
|
-
//noinspection JSUnusedLocalSymbols
|
29
|
-
jasmine.Reporter.prototype.log = function(str) {
|
30
|
-
};
|
31
|
-
|
@@ -1,77 +0,0 @@
|
|
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_.splice(0,0,beforeEachFunction);
|
29
|
-
};
|
30
|
-
|
31
|
-
jasmine.Runner.prototype.afterEach = function(afterEachFunction) {
|
32
|
-
afterEachFunction.typeName = 'afterEach';
|
33
|
-
this.after_.splice(0,0,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
|
-
jasmine.Runner.prototype.suites = function() {
|
62
|
-
return this.suites_;
|
63
|
-
};
|
64
|
-
|
65
|
-
jasmine.Runner.prototype.topLevelSuites = function() {
|
66
|
-
var topLevelSuites = [];
|
67
|
-
for (var i = 0; i < this.suites_.length; i++) {
|
68
|
-
if (!this.suites_[i].parentSuite) {
|
69
|
-
topLevelSuites.push(this.suites_[i]);
|
70
|
-
}
|
71
|
-
}
|
72
|
-
return topLevelSuites;
|
73
|
-
};
|
74
|
-
|
75
|
-
jasmine.Runner.prototype.results = function() {
|
76
|
-
return this.queue.results();
|
77
|
-
};
|
data/vendor/jasmine/src/Spec.js
DELETED
@@ -1,242 +0,0 @@
|
|
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
|
-
/**
|
41
|
-
* All parameters are pretty-printed and concatenated together, then written to the spec's output.
|
42
|
-
*
|
43
|
-
* Be careful not to leave calls to <code>jasmine.log</code> in production code.
|
44
|
-
*/
|
45
|
-
jasmine.Spec.prototype.log = function() {
|
46
|
-
return this.results_.log(arguments);
|
47
|
-
};
|
48
|
-
|
49
|
-
jasmine.Spec.prototype.runs = function (func) {
|
50
|
-
var block = new jasmine.Block(this.env, func, this);
|
51
|
-
this.addToQueue(block);
|
52
|
-
return this;
|
53
|
-
};
|
54
|
-
|
55
|
-
jasmine.Spec.prototype.addToQueue = function (block) {
|
56
|
-
if (this.queue.isRunning()) {
|
57
|
-
this.queue.insertNext(block);
|
58
|
-
} else {
|
59
|
-
this.queue.add(block);
|
60
|
-
}
|
61
|
-
};
|
62
|
-
|
63
|
-
/**
|
64
|
-
* @param {jasmine.ExpectationResult} result
|
65
|
-
*/
|
66
|
-
jasmine.Spec.prototype.addMatcherResult = function(result) {
|
67
|
-
this.results_.addResult(result);
|
68
|
-
};
|
69
|
-
|
70
|
-
jasmine.Spec.prototype.expect = function(actual) {
|
71
|
-
var positive = new (this.getMatchersClass_())(this.env, actual, this);
|
72
|
-
positive.not = new (this.getMatchersClass_())(this.env, actual, this, true);
|
73
|
-
return positive;
|
74
|
-
};
|
75
|
-
|
76
|
-
/**
|
77
|
-
* Waits a fixed time period before moving to the next block.
|
78
|
-
*
|
79
|
-
* @deprecated Use waitsFor() instead
|
80
|
-
* @param {Number} timeout milliseconds to wait
|
81
|
-
*/
|
82
|
-
jasmine.Spec.prototype.waits = function(timeout) {
|
83
|
-
var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this);
|
84
|
-
this.addToQueue(waitsFunc);
|
85
|
-
return this;
|
86
|
-
};
|
87
|
-
|
88
|
-
/**
|
89
|
-
* Waits for the latchFunction to return true before proceeding to the next block.
|
90
|
-
*
|
91
|
-
* @param {Function} latchFunction
|
92
|
-
* @param {String} optional_timeoutMessage
|
93
|
-
* @param {Number} optional_timeout
|
94
|
-
*/
|
95
|
-
jasmine.Spec.prototype.waitsFor = function(latchFunction, optional_timeoutMessage, optional_timeout) {
|
96
|
-
var latchFunction_ = null;
|
97
|
-
var optional_timeoutMessage_ = null;
|
98
|
-
var optional_timeout_ = null;
|
99
|
-
|
100
|
-
for (var i = 0; i < arguments.length; i++) {
|
101
|
-
var arg = arguments[i];
|
102
|
-
switch (typeof arg) {
|
103
|
-
case 'function':
|
104
|
-
latchFunction_ = arg;
|
105
|
-
break;
|
106
|
-
case 'string':
|
107
|
-
optional_timeoutMessage_ = arg;
|
108
|
-
break;
|
109
|
-
case 'number':
|
110
|
-
optional_timeout_ = arg;
|
111
|
-
break;
|
112
|
-
}
|
113
|
-
}
|
114
|
-
|
115
|
-
var waitsForFunc = new jasmine.WaitsForBlock(this.env, optional_timeout_, latchFunction_, optional_timeoutMessage_, this);
|
116
|
-
this.addToQueue(waitsForFunc);
|
117
|
-
return this;
|
118
|
-
};
|
119
|
-
|
120
|
-
jasmine.Spec.prototype.fail = function (e) {
|
121
|
-
var expectationResult = new jasmine.ExpectationResult({
|
122
|
-
passed: false,
|
123
|
-
message: e ? jasmine.util.formatException(e) : 'Exception'
|
124
|
-
});
|
125
|
-
this.results_.addResult(expectationResult);
|
126
|
-
};
|
127
|
-
|
128
|
-
jasmine.Spec.prototype.getMatchersClass_ = function() {
|
129
|
-
return this.matchersClass || this.env.matchersClass;
|
130
|
-
};
|
131
|
-
|
132
|
-
jasmine.Spec.prototype.addMatchers = function(matchersPrototype) {
|
133
|
-
var parent = this.getMatchersClass_();
|
134
|
-
var newMatchersClass = function() {
|
135
|
-
parent.apply(this, arguments);
|
136
|
-
};
|
137
|
-
jasmine.util.inherit(newMatchersClass, parent);
|
138
|
-
jasmine.Matchers.wrapInto_(matchersPrototype, newMatchersClass);
|
139
|
-
this.matchersClass = newMatchersClass;
|
140
|
-
};
|
141
|
-
|
142
|
-
jasmine.Spec.prototype.finishCallback = function() {
|
143
|
-
this.env.reporter.reportSpecResults(this);
|
144
|
-
};
|
145
|
-
|
146
|
-
jasmine.Spec.prototype.finish = function(onComplete) {
|
147
|
-
this.removeAllSpies();
|
148
|
-
this.finishCallback();
|
149
|
-
if (onComplete) {
|
150
|
-
onComplete();
|
151
|
-
}
|
152
|
-
};
|
153
|
-
|
154
|
-
jasmine.Spec.prototype.after = function(doAfter) {
|
155
|
-
if (this.queue.isRunning()) {
|
156
|
-
this.queue.add(new jasmine.Block(this.env, doAfter, this));
|
157
|
-
} else {
|
158
|
-
this.afterCallbacks.unshift(doAfter);
|
159
|
-
}
|
160
|
-
};
|
161
|
-
|
162
|
-
jasmine.Spec.prototype.execute = function(onComplete) {
|
163
|
-
var spec = this;
|
164
|
-
if (!spec.env.specFilter(spec)) {
|
165
|
-
spec.results_.skipped = true;
|
166
|
-
spec.finish(onComplete);
|
167
|
-
return;
|
168
|
-
}
|
169
|
-
|
170
|
-
this.env.reporter.reportSpecStarting(this);
|
171
|
-
|
172
|
-
spec.env.currentSpec = spec;
|
173
|
-
|
174
|
-
spec.addBeforesAndAftersToQueue();
|
175
|
-
|
176
|
-
spec.queue.start(function () {
|
177
|
-
spec.finish(onComplete);
|
178
|
-
});
|
179
|
-
};
|
180
|
-
|
181
|
-
jasmine.Spec.prototype.addBeforesAndAftersToQueue = function() {
|
182
|
-
var runner = this.env.currentRunner();
|
183
|
-
var i;
|
184
|
-
|
185
|
-
for (var suite = this.suite; suite; suite = suite.parentSuite) {
|
186
|
-
for (i = 0; i < suite.before_.length; i++) {
|
187
|
-
this.queue.addBefore(new jasmine.Block(this.env, suite.before_[i], this));
|
188
|
-
}
|
189
|
-
}
|
190
|
-
for (i = 0; i < runner.before_.length; i++) {
|
191
|
-
this.queue.addBefore(new jasmine.Block(this.env, runner.before_[i], this));
|
192
|
-
}
|
193
|
-
for (i = 0; i < this.afterCallbacks.length; i++) {
|
194
|
-
this.queue.add(new jasmine.Block(this.env, this.afterCallbacks[i], this));
|
195
|
-
}
|
196
|
-
for (suite = this.suite; suite; suite = suite.parentSuite) {
|
197
|
-
for (i = 0; i < suite.after_.length; i++) {
|
198
|
-
this.queue.add(new jasmine.Block(this.env, suite.after_[i], this));
|
199
|
-
}
|
200
|
-
}
|
201
|
-
for (i = 0; i < runner.after_.length; i++) {
|
202
|
-
this.queue.add(new jasmine.Block(this.env, runner.after_[i], this));
|
203
|
-
}
|
204
|
-
};
|
205
|
-
|
206
|
-
jasmine.Spec.prototype.explodes = function() {
|
207
|
-
throw 'explodes function should not have been called';
|
208
|
-
};
|
209
|
-
|
210
|
-
jasmine.Spec.prototype.spyOn = function(obj, methodName, ignoreMethodDoesntExist) {
|
211
|
-
if (obj == jasmine.undefined) {
|
212
|
-
throw "spyOn could not find an object to spy upon for " + methodName + "()";
|
213
|
-
}
|
214
|
-
|
215
|
-
if (!ignoreMethodDoesntExist && obj[methodName] === jasmine.undefined) {
|
216
|
-
throw methodName + '() method does not exist';
|
217
|
-
}
|
218
|
-
|
219
|
-
if (!ignoreMethodDoesntExist && obj[methodName] && obj[methodName].isSpy) {
|
220
|
-
throw new Error(methodName + ' has already been spied upon');
|
221
|
-
}
|
222
|
-
|
223
|
-
var spyObj = jasmine.createSpy(methodName);
|
224
|
-
|
225
|
-
this.spies_.push(spyObj);
|
226
|
-
spyObj.baseObj = obj;
|
227
|
-
spyObj.methodName = methodName;
|
228
|
-
spyObj.originalValue = obj[methodName];
|
229
|
-
|
230
|
-
obj[methodName] = spyObj;
|
231
|
-
|
232
|
-
return spyObj;
|
233
|
-
};
|
234
|
-
|
235
|
-
jasmine.Spec.prototype.removeAllSpies = function() {
|
236
|
-
for (var i = 0; i < this.spies_.length; i++) {
|
237
|
-
var spy = this.spies_[i];
|
238
|
-
spy.baseObj[spy.methodName] = spy.originalValue;
|
239
|
-
}
|
240
|
-
this.spies_ = [];
|
241
|
-
};
|
242
|
-
|