js-test-driver-rails 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitmodules +3 -3
- data/lib/js_test_driver/version.rb +1 -1
- data/vendor/JasmineAdapter.js +171 -178
- metadata +4 -20
data/.gitmodules
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
[submodule "vendor/jasmine-jstd-adapter"]
|
2
|
-
path = vendor/jasmine-jstd-adapter
|
3
|
-
url = git://github.com/mhevery/jasmine-jstd-adapter.git
|
4
1
|
[submodule "vendor/jasmine"]
|
5
2
|
path = vendor/jasmine
|
6
3
|
url = git://github.com/pivotal/jasmine.git
|
4
|
+
[submodule "vendor/jasmine-jstd-adapter"]
|
5
|
+
path = vendor/jasmine-jstd-adapter
|
6
|
+
url = git://github.com/ibolmo/jasmine-jstd-adapter.git
|
data/vendor/JasmineAdapter.js
CHANGED
@@ -1,186 +1,179 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Jasmine JsTestDriver Adapter.
|
3
3
|
* @author misko@hevery.com (Misko Hevery)
|
4
|
+
* @author olmo.maldonado@gmail.com (Olmo Maldonado)
|
4
5
|
*/
|
5
|
-
(function(
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
};
|
170
|
-
}
|
171
|
-
|
172
|
-
})(window);
|
6
|
+
(function(){
|
7
|
+
|
8
|
+
|
9
|
+
var Env = function(onTestDone, onComplete){
|
10
|
+
jasmine.Env.call(this);
|
11
|
+
|
12
|
+
this.specFilter = function(spec){
|
13
|
+
if (!this.exclusive) return true;
|
14
|
+
var blocks = spec.queue.blocks, l = blocks.length;
|
15
|
+
for (var i = 0; i < l; i++) if (blocks[i].func.exclusive >= this.exclusive) return true;
|
16
|
+
return false;
|
17
|
+
};
|
18
|
+
|
19
|
+
this.reporter = new Reporter(onTestDone, onComplete);
|
20
|
+
};
|
21
|
+
jasmine.util.inherit(Env, jasmine.Env);
|
22
|
+
|
23
|
+
// Here we store:
|
24
|
+
// 0: everyone runs
|
25
|
+
// 1: run everything under ddescribe
|
26
|
+
// 2: run only iits (ignore ddescribe)
|
27
|
+
Env.prototype.exclusive = 0;
|
28
|
+
|
29
|
+
|
30
|
+
Env.prototype.execute = function(){
|
31
|
+
collectMode = false;
|
32
|
+
playback();
|
33
|
+
jasmine.Env.prototype.execute.call(this);
|
34
|
+
};
|
35
|
+
|
36
|
+
|
37
|
+
var Reporter = function(onTestDone, onComplete){
|
38
|
+
this.onTestDone = onTestDone;
|
39
|
+
this.onComplete = onComplete;
|
40
|
+
this.reset();
|
41
|
+
};
|
42
|
+
jasmine.util.inherit(Reporter, jasmine.Reporter);
|
43
|
+
|
44
|
+
|
45
|
+
Reporter.formatStack = function(stack) {
|
46
|
+
var line, lines = (stack || '').split(/\r?\n/), l = lines.length, frames = [];
|
47
|
+
for (var i = 0; i < l; i++){
|
48
|
+
line = lines[i];
|
49
|
+
if (line.match(/\/jasmine[\.-]/)) continue;
|
50
|
+
frames.push(line.replace(/https?:\/\/\w+(:\d+)?\/test\//, '').replace(/^\s*/, ' '));
|
51
|
+
}
|
52
|
+
return frames.join('\n');
|
53
|
+
};
|
54
|
+
|
55
|
+
|
56
|
+
Reporter.prototype.reset = function(){
|
57
|
+
this.specLog = jstestdriver.console.log_ = [];
|
58
|
+
};
|
59
|
+
|
60
|
+
|
61
|
+
Reporter.prototype.log = function(str){
|
62
|
+
this.specLog.push(str);
|
63
|
+
};
|
64
|
+
|
65
|
+
|
66
|
+
Reporter.prototype.reportSpecStarting = function(){
|
67
|
+
this.reset();
|
68
|
+
this.start = +new Date();
|
69
|
+
};
|
70
|
+
|
71
|
+
|
72
|
+
Reporter.prototype.reportSpecResults = function(spec){
|
73
|
+
var elapsed = +new Date() - this.start, results = spec.results();
|
74
|
+
|
75
|
+
if (results.skipped) return;
|
76
|
+
|
77
|
+
var item, state = 'passed', items = results.getItems(), l = items.length, messages = [];
|
78
|
+
for (var i = 0; i < l; i++){
|
79
|
+
item = items[i];
|
80
|
+
if (item.passed()) continue;
|
81
|
+
state = (item.message.indexOf('AssertionError:') != -1) ? 'error' : 'failed';
|
82
|
+
messages.push({
|
83
|
+
message: item + '',
|
84
|
+
name: item.trace.name,
|
85
|
+
stack: Reporter.formatStack(item.trace.stack)
|
86
|
+
});
|
87
|
+
}
|
88
|
+
|
89
|
+
this.onTestDone(new jstestdriver.TestResult(
|
90
|
+
spec.suite.getFullName(),
|
91
|
+
spec.description,
|
92
|
+
state,
|
93
|
+
jstestdriver.angular.toJson(messages),
|
94
|
+
this.specLog.join('\n'),
|
95
|
+
elapsed
|
96
|
+
));
|
97
|
+
};
|
98
|
+
|
99
|
+
|
100
|
+
Reporter.prototype.reportRunnerResults = function(){
|
101
|
+
this.onComplete();
|
102
|
+
};
|
103
|
+
|
104
|
+
|
105
|
+
var collectMode = true, intercepted = {};
|
106
|
+
|
107
|
+
describe = intercept('describe');
|
108
|
+
beforeEach = intercept('beforeEach');
|
109
|
+
afterEach = intercept('afterEach');
|
110
|
+
|
111
|
+
var template = TestCase('Jasmine Adapter Tests', null, 'jasmine test case');
|
112
|
+
|
113
|
+
jstestdriver.pluginRegistrar.register({
|
114
|
+
|
115
|
+
name: 'jasmine',
|
116
|
+
|
117
|
+
runTestConfiguration: function(config, onTestDone, onComplete){
|
118
|
+
if (config.testCaseInfo_.template_ !== template) return;
|
119
|
+
(jasmine.currentEnv_ = new Env(onTestDone, onComplete)).execute();
|
120
|
+
return true;
|
121
|
+
},
|
122
|
+
|
123
|
+
onTestsFinish: function(){
|
124
|
+
jasmine.currentEnv_ = null;
|
125
|
+
collectMode = true;
|
126
|
+
}
|
127
|
+
|
128
|
+
});
|
129
|
+
|
130
|
+
function intercept(method){
|
131
|
+
var bucket = intercepted[method] = [], method = window[method];
|
132
|
+
return function(desc, fn){
|
133
|
+
if (collectMode) bucket.push(function(){ method(desc, fn); });
|
134
|
+
else method(desc, fn);
|
135
|
+
};
|
136
|
+
}
|
137
|
+
|
138
|
+
function playback(){
|
139
|
+
for (var method in intercepted){
|
140
|
+
var bucket = intercepted[method];
|
141
|
+
for (var i = 0, l = bucket.length; i < l; i++) bucket[i]();
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
})();
|
146
|
+
|
147
|
+
var ddescribe = function(name, fn){
|
148
|
+
var env = jasmine.getEnv();
|
149
|
+
if (!env.exclusive) env.exclusive = 1; // run ddescribe only
|
150
|
+
describe(name, function(){
|
151
|
+
var oldIt = it;
|
152
|
+
it = function(name, fn){
|
153
|
+
fn.exclusive = 1; // run anything under ddescribe
|
154
|
+
env.it(name, fn);
|
155
|
+
};
|
156
|
+
|
157
|
+
try {
|
158
|
+
fn.call(this);
|
159
|
+
} finally {
|
160
|
+
it = oldIt;
|
161
|
+
};
|
162
|
+
});
|
163
|
+
};
|
164
|
+
|
165
|
+
var iit = function(name, fn){
|
166
|
+
var env = jasmine.getEnv();
|
167
|
+
env.exclusive = fn.exclusive = 2; // run only iits
|
168
|
+
env.it(name, fn);
|
169
|
+
};
|
173
170
|
|
174
171
|
// Patch Jasmine for proper stack traces
|
175
172
|
jasmine.Spec.prototype.fail = function (e) {
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
expectationResult.trace = e;
|
183
|
-
}
|
184
|
-
this.results_.addResult(expectationResult);
|
173
|
+
var result = new jasmine.ExpectationResult({
|
174
|
+
passed: false,
|
175
|
+
message: e ? jasmine.util.formatException(e) : 'Exception'
|
176
|
+
});
|
177
|
+
if(e) result.trace = e;
|
178
|
+
this.results_.addResult(result);
|
185
179
|
};
|
186
|
-
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js-test-driver-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 4
|
8
|
-
- 0
|
9
|
-
version: 0.4.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.4.1
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Adam Pohorecki
|
@@ -14,8 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-04-
|
18
|
-
default_executable:
|
13
|
+
date: 2011-04-29 00:00:00 Z
|
19
14
|
dependencies:
|
20
15
|
- !ruby/object:Gem::Dependency
|
21
16
|
name: json
|
@@ -25,8 +20,6 @@ dependencies:
|
|
25
20
|
requirements:
|
26
21
|
- - ">="
|
27
22
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
23
|
version: "0"
|
31
24
|
type: :runtime
|
32
25
|
version_requirements: *id001
|
@@ -38,8 +31,6 @@ dependencies:
|
|
38
31
|
requirements:
|
39
32
|
- - ">="
|
40
33
|
- !ruby/object:Gem::Version
|
41
|
-
segments:
|
42
|
-
- 0
|
43
34
|
version: "0"
|
44
35
|
type: :runtime
|
45
36
|
version_requirements: *id002
|
@@ -51,8 +42,6 @@ dependencies:
|
|
51
42
|
requirements:
|
52
43
|
- - ">="
|
53
44
|
- !ruby/object:Gem::Version
|
54
|
-
segments:
|
55
|
-
- 0
|
56
45
|
version: "0"
|
57
46
|
type: :development
|
58
47
|
version_requirements: *id003
|
@@ -101,7 +90,6 @@ files:
|
|
101
90
|
- vendor/coverage.jar
|
102
91
|
- vendor/jasmine.js
|
103
92
|
- vendor/js_test_driver.jar
|
104
|
-
has_rdoc: true
|
105
93
|
homepage: http://github.com/psyho/js-test-driver-rails
|
106
94
|
licenses: []
|
107
95
|
|
@@ -115,21 +103,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
103
|
requirements:
|
116
104
|
- - ">="
|
117
105
|
- !ruby/object:Gem::Version
|
118
|
-
segments:
|
119
|
-
- 0
|
120
106
|
version: "0"
|
121
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
108
|
none: false
|
123
109
|
requirements:
|
124
110
|
- - ">="
|
125
111
|
- !ruby/object:Gem::Version
|
126
|
-
segments:
|
127
|
-
- 0
|
128
112
|
version: "0"
|
129
113
|
requirements: []
|
130
114
|
|
131
115
|
rubyforge_project: js-test-driver-rails
|
132
|
-
rubygems_version: 1.
|
116
|
+
rubygems_version: 1.7.2
|
133
117
|
signing_key:
|
134
118
|
specification_version: 3
|
135
119
|
summary: A wrapper for JsTestDriver for use with ruby/rails projects
|