opal-rails 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.travis.yml +6 -1
- data/Gemfile +5 -0
- data/README.md +37 -13
- data/Rakefile +14 -0
- data/app/controllers/opal_spec_controller.rb +9 -4
- data/app/views/layouts/opal_spec.html.erb +2 -3
- data/app/views/opal_spec/_index.html.erb +11 -0
- data/app/views/opal_spec/_runner.html.erb +2 -0
- data/app/views/opal_spec/run.html.erb +2 -0
- data/config/routes.rb +1 -1
- data/lib/assets/javascripts/opal-jquery.js +499 -0
- data/lib/assets/javascripts/opal-spec-runner.js.rb +2 -1
- data/lib/assets/javascripts/opal-spec.js +519 -222
- data/lib/assets/javascripts/opal.js +974 -932
- data/lib/opal/rails/engine.rb +5 -1
- data/lib/opal/rails/version.rb +2 -2
- data/opal-rails.gemspec +2 -4
- data/spec/opal/rails/processor_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/test_app/app/assets/javascripts/spec/{example_spec.js_spec.rb → example_spec.js.rb} +0 -0
- data/test_app/config/initializers/session_store.rb +1 -1
- data/test_app/config/initializers/wrap_parameters.rb +1 -1
- metadata +19 -35
- data/app/assets/images/opal-rails/.gitkeep +0 -0
- data/app/assets/javascripts/opal-rails/.gitkeep +0 -0
- data/app/assets/stylesheets/opal-rails/.gitkeep +0 -0
- data/app/controllers/.gitkeep +0 -0
- data/app/helpers/.gitkeep +0 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/models/.gitkeep +0 -0
- data/app/views/.gitkeep +0 -0
- data/lib/assets/javascripts/opal-dom.js +0 -654
@@ -1,117 +1,157 @@
|
|
1
|
-
//
|
2
|
-
// (function() {
|
3
|
-
// var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice;
|
4
|
-
// var __a, __b;
|
5
|
-
// return (__b = __scope.Document, __b.$ready$p._p = (__a = function() {
|
6
|
-
//
|
7
|
-
//
|
8
|
-
//
|
9
|
-
// return (__scope.Spec)._scope.Runner.$new().$run()
|
10
|
-
// }, __a._s = self, __a), __b.$ready$p())
|
11
|
-
// })();
|
12
|
-
|
13
|
-
// file lib/opal/spec/browser_formatter.rb
|
1
|
+
// lib/opal-spec/browser_formatter.rb
|
14
2
|
(function() {
|
15
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __module = __opal.module, __klass = __opal.klass;
|
16
|
-
|
3
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm, __module = __opal.module, __klass = __opal.klass;
|
4
|
+
|
17
5
|
return (function(__base){
|
18
|
-
// line 1,
|
6
|
+
// line 1, opal-spec/browser_formatter, module Spec
|
19
7
|
function Spec() {};
|
20
8
|
Spec = __module(__base, "Spec", Spec);
|
21
9
|
var Spec_prototype = Spec.prototype, __scope = Spec._scope;
|
22
10
|
|
23
11
|
(function(__base, __super){
|
24
|
-
// line 2,
|
12
|
+
// line 2, opal-spec/browser_formatter, class BrowserFormatter
|
25
13
|
function BrowserFormatter() {};
|
26
14
|
BrowserFormatter = __klass(__base, __super, "BrowserFormatter", BrowserFormatter);
|
27
15
|
var BrowserFormatter_prototype = BrowserFormatter.prototype, __scope = BrowserFormatter._scope;
|
28
|
-
BrowserFormatter_prototype.
|
16
|
+
BrowserFormatter_prototype.start_time = BrowserFormatter_prototype.failed_examples = BrowserFormatter_prototype.summary_element = BrowserFormatter_prototype.groups_element = BrowserFormatter_prototype.example_group_failed = BrowserFormatter_prototype.group_element = BrowserFormatter_prototype.examples = BrowserFormatter_prototype.example_list = nil;
|
29
17
|
|
30
18
|
__scope.CSS = "\n body {\n font-size: 14px;\n font-family: Helvetica Neue, Helvetica, Arial, sans-serif;\n }\n\n pre {\n font-family: \"Bitstream Vera Sans Mono\", Monaco, \"Lucida Console\", monospace;\n font-size: 12px;\n color: #444444;\n white-space: pre;\n padding: 3px 0px 3px 12px;\n margin: 0px 0px 8px;\n\n background: #FAFAFA;\n -webkit-box-shadow: rgba(0,0,0,0.07) 0 1px 2px inset;\n -webkit-border-radius: 3px;\n -moz-border-radius: 3px;\n border-radius: 3px;\n border: 1px solid #DDDDDD;\n }\n\n ul.example_groups {\n list-style-type: none;\n }\n\n li.group.passed .group_description {\n color: #597800;\n font-weight: bold;\n }\n\n li.group.failed .group_description {\n color: #FF000E;\n font-weight: bold;\n }\n\n li.example.passed {\n color: #597800;\n }\n\n li.example.failed {\n color: #FF000E;\n }\n\n .examples {\n list-style-type: none;\n }\n ";
|
31
19
|
|
32
|
-
// line 52,
|
20
|
+
// line 52, opal-spec/browser_formatter, BrowserFormatter#initialize
|
33
21
|
BrowserFormatter_prototype.$initialize = function() {
|
34
22
|
|
35
23
|
this.examples = [];
|
36
24
|
return this.failed_examples = [];
|
37
25
|
};
|
38
26
|
|
39
|
-
// line 57,
|
27
|
+
// line 57, opal-spec/browser_formatter, BrowserFormatter#start
|
40
28
|
BrowserFormatter_prototype.$start = function() {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
29
|
+
|
30
|
+
|
31
|
+
if (!document || !document.body) {
|
32
|
+
this.$raise("Not running in browser.");
|
33
|
+
}
|
34
|
+
|
35
|
+
var summary_element = document.createElement('p');
|
36
|
+
summary_element.className = 'summary';
|
37
|
+
|
38
|
+
var groups_element = document.createElement('ul');
|
39
|
+
groups_element.className = 'example_groups';
|
40
|
+
|
41
|
+
var target = document.getElementById('opal-spec-output');
|
42
|
+
|
43
|
+
if (!target) {
|
44
|
+
target = document.body;
|
45
|
+
}
|
46
|
+
|
47
|
+
target.appendChild(summary_element);
|
48
|
+
target.appendChild(groups_element);
|
49
|
+
|
50
|
+
var styles = document.createElement('style');
|
51
|
+
styles.innerHTML = __scope.CSS;
|
52
|
+
document.head.appendChild(styles);
|
53
|
+
|
54
|
+
this.start_time = __scope.Time.$now().$to_f();
|
55
|
+
this.groups_element = groups_element;
|
56
|
+
return this.summary_element = summary_element;
|
50
57
|
};
|
51
58
|
|
52
|
-
// line
|
59
|
+
// line 88, opal-spec/browser_formatter, BrowserFormatter#finish
|
53
60
|
BrowserFormatter_prototype.$finish = function() {
|
54
|
-
var text = nil;
|
55
|
-
|
56
|
-
|
61
|
+
var time = nil, text = nil, __a, __b;
|
62
|
+
time = (__a = __scope.Time.$now().$to_f(), __b = this.start_time, typeof(__a) === 'number' ? __a - __b : __a['$-'](__b));
|
63
|
+
text = "\n" + (this.$example_count()) + " examples, " + (this.failed_examples.$size()) + " failures (time taken: " + (time) + ")";
|
64
|
+
return this.summary_element.innerHTML = text;
|
57
65
|
};
|
58
66
|
|
59
|
-
// line
|
67
|
+
// line 95, opal-spec/browser_formatter, BrowserFormatter#example_group_started
|
60
68
|
BrowserFormatter_prototype.$example_group_started = function(group) {
|
61
69
|
|
62
70
|
this.example_group = group;
|
63
71
|
this.example_group_failed = false;
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
72
|
+
|
73
|
+
var group_element = document.createElement('li');
|
74
|
+
|
75
|
+
var description = document.createElement('span');
|
76
|
+
description.className = 'group_description';
|
77
|
+
description.innerHTML = group.$description();
|
78
|
+
group_element.appendChild(description);
|
79
|
+
|
80
|
+
var example_list = document.createElement('ul');
|
81
|
+
example_list.className = 'examples';
|
82
|
+
group_element.appendChild(example_list);
|
83
|
+
|
84
|
+
this.groups_element.appendChild(group_element);
|
85
|
+
|
86
|
+
this.group_element = group_element;
|
87
|
+
return this.example_list = example_list;
|
68
88
|
};
|
69
89
|
|
70
|
-
// line
|
90
|
+
// line 118, opal-spec/browser_formatter, BrowserFormatter#example_group_finished
|
71
91
|
BrowserFormatter_prototype.$example_group_finished = function(group) {
|
72
92
|
var __a;
|
73
93
|
if ((__a = this.example_group_failed) !== false && __a !== nil) {
|
74
|
-
return this.group_element
|
94
|
+
return this.group_element.className = 'group failed';
|
75
95
|
} else {
|
76
|
-
return this.group_element
|
96
|
+
return this.group_element.className = 'group passed';
|
77
97
|
};
|
78
98
|
};
|
79
99
|
|
80
|
-
// line
|
100
|
+
// line 126, opal-spec/browser_formatter, BrowserFormatter#example_started
|
81
101
|
BrowserFormatter_prototype.$example_started = function(example) {
|
82
102
|
|
83
|
-
this.examples
|
103
|
+
this.examples['$<<'](example);
|
84
104
|
return this.example = example;
|
85
105
|
};
|
86
106
|
|
87
|
-
// line
|
107
|
+
// line 131, opal-spec/browser_formatter, BrowserFormatter#example_failed
|
88
108
|
BrowserFormatter_prototype.$example_failed = function(example) {
|
89
|
-
var exception = nil, $case = nil, output = nil
|
90
|
-
this.failed_examples
|
109
|
+
var exception = nil, $case = nil, output = nil;
|
110
|
+
this.failed_examples['$<<'](example);
|
91
111
|
this.example_group_failed = true;
|
92
112
|
exception = example.$exception();
|
93
|
-
$case = exception;if ((__scope.Spec)._scope.ExpectationNotMetError
|
113
|
+
$case = exception;if ((__scope.Spec)._scope.ExpectationNotMetError['$===']($case)) {
|
94
114
|
output = exception.$message()
|
95
115
|
}
|
96
|
-
else {output = "" + exception
|
97
|
-
output = output
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
116
|
+
else {output = "" + (exception['$class']()) + ": " + (exception.$message()) + "\n";
|
117
|
+
output = output['$+'](" " + (exception.$backtrace().$join("\n ")) + "\n");};
|
118
|
+
|
119
|
+
var wrapper = document.createElement('li');
|
120
|
+
wrapper.className = 'example failed';
|
121
|
+
|
122
|
+
var description = document.createElement('span');
|
123
|
+
description.className = 'example_description';
|
124
|
+
description.innerHTML = example.$description();
|
125
|
+
|
126
|
+
var exception = document.createElement('pre');
|
127
|
+
exception.className = 'exception';
|
128
|
+
exception.innerHTML = output;
|
129
|
+
|
130
|
+
wrapper.appendChild(description);
|
131
|
+
wrapper.appendChild(exception);
|
132
|
+
|
133
|
+
this.example_list.appendChild(wrapper);
|
134
|
+
this.example_list.style.display = 'list-item';
|
135
|
+
|
136
|
+
};
|
137
|
+
|
138
|
+
// line 168, opal-spec/browser_formatter, BrowserFormatter#example_passed
|
108
139
|
BrowserFormatter_prototype.$example_passed = function(example) {
|
109
|
-
|
110
|
-
|
111
|
-
|
140
|
+
|
141
|
+
|
142
|
+
var wrapper = document.createElement('li');
|
143
|
+
wrapper.className = 'example passed';
|
144
|
+
|
145
|
+
var description = document.createElement('span');
|
146
|
+
description.className = 'example_description';
|
147
|
+
description.innerHTML = example.$description();
|
148
|
+
|
149
|
+
wrapper.appendChild(description);
|
150
|
+
this.example_list.appendChild(wrapper);
|
151
|
+
|
112
152
|
};
|
113
153
|
|
114
|
-
// line
|
154
|
+
// line 182, opal-spec/browser_formatter, BrowserFormatter#example_count
|
115
155
|
BrowserFormatter_prototype.$example_count = function() {
|
116
156
|
|
117
157
|
return this.examples.$size();
|
@@ -121,40 +161,40 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
121
161
|
|
122
162
|
})(self)
|
123
163
|
})();
|
124
|
-
//
|
164
|
+
// lib/opal-spec/example.rb
|
125
165
|
(function() {
|
126
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __module = __opal.module, __klass = __opal.klass;
|
127
|
-
|
166
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm, __module = __opal.module, __klass = __opal.klass;
|
167
|
+
|
128
168
|
return (function(__base){
|
129
|
-
// line 1,
|
169
|
+
// line 1, opal-spec/example, module Spec
|
130
170
|
function Spec() {};
|
131
171
|
Spec = __module(__base, "Spec", Spec);
|
132
172
|
var Spec_prototype = Spec.prototype, __scope = Spec._scope;
|
133
173
|
|
134
174
|
(function(__base, __super){
|
135
|
-
// line 2,
|
175
|
+
// line 2, opal-spec/example, class Example
|
136
176
|
function Example() {};
|
137
177
|
Example = __klass(__base, __super, "Example", Example);
|
138
178
|
var Example_prototype = Example.prototype, __scope = Example._scope;
|
139
179
|
Example_prototype.description = Example_prototype.example_group = Example_prototype.exception = Example_prototype.__block__ = nil;
|
140
180
|
|
141
|
-
// line 3,
|
181
|
+
// line 3, opal-spec/example, Example#description
|
142
182
|
Example_prototype.$description = function() {
|
143
183
|
|
144
184
|
return this.description
|
145
185
|
},
|
146
|
-
// line 3,
|
186
|
+
// line 3, opal-spec/example, Example#example_group
|
147
187
|
Example_prototype.$example_group = function() {
|
148
188
|
|
149
189
|
return this.example_group
|
150
190
|
},
|
151
|
-
// line 3,
|
191
|
+
// line 3, opal-spec/example, Example#exception
|
152
192
|
Example_prototype.$exception = function() {
|
153
193
|
|
154
194
|
return this.exception
|
155
195
|
};
|
156
196
|
|
157
|
-
// line 5,
|
197
|
+
// line 5, opal-spec/example, Example#initialize
|
158
198
|
Example_prototype.$initialize = function(group, desc, block) {
|
159
199
|
|
160
200
|
this.example_group = group;
|
@@ -162,7 +202,7 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
162
202
|
return this.__block__ = block;
|
163
203
|
};
|
164
204
|
|
165
|
-
// line 11,
|
205
|
+
// line 11, opal-spec/example, Example#run_before_hooks
|
166
206
|
Example_prototype.$run_before_hooks = function() {
|
167
207
|
var __a, __b;
|
168
208
|
return (__b = this.example_group.$before_hooks(), __b.$each._p = (__a = function(before) {
|
@@ -174,7 +214,7 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
174
214
|
}, __a._s = this, __a), __b.$each());
|
175
215
|
};
|
176
216
|
|
177
|
-
// line 17,
|
217
|
+
// line 17, opal-spec/example, Example#run_after_hooks
|
178
218
|
Example_prototype.$run_after_hooks = function() {
|
179
219
|
var __a, __b;
|
180
220
|
return (__b = this.example_group.$after_hooks(), __b.$each._p = (__a = function(after) {
|
@@ -186,9 +226,9 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
186
226
|
}, __a._s = this, __a), __b.$each());
|
187
227
|
};
|
188
228
|
|
189
|
-
// line 23,
|
229
|
+
// line 23, opal-spec/example, Example#run
|
190
230
|
Example_prototype.$run = function(runner) {
|
191
|
-
var e = nil, __a;
|
231
|
+
var e = nil, __a, __b;
|
192
232
|
try {
|
193
233
|
runner.$example_started(this);
|
194
234
|
this.$run_before_hooks();
|
@@ -206,7 +246,7 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
206
246
|
e = $err;this.exception = e}
|
207
247
|
else { throw $err; }
|
208
248
|
}};
|
209
|
-
if ((
|
249
|
+
if ((__b = this.exception) !== false && __b !== nil) {
|
210
250
|
return runner.$example_failed(this)
|
211
251
|
} else {
|
212
252
|
return runner.$example_passed(this)
|
@@ -217,44 +257,49 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
217
257
|
|
218
258
|
})(self)
|
219
259
|
})();
|
220
|
-
//
|
260
|
+
// lib/opal-spec/example_group.rb
|
221
261
|
(function() {
|
222
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __module = __opal.module, __klass = __opal.klass;
|
223
|
-
|
262
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm, __module = __opal.module, __klass = __opal.klass;
|
263
|
+
|
224
264
|
return (function(__base){
|
225
|
-
// line 1,
|
265
|
+
// line 1, opal-spec/example_group, module Spec
|
226
266
|
function Spec() {};
|
227
267
|
Spec = __module(__base, "Spec", Spec);
|
228
268
|
var Spec_prototype = Spec.prototype, __scope = Spec._scope;
|
229
269
|
|
230
270
|
(function(__base, __super){
|
231
|
-
// line 2,
|
271
|
+
// line 2, opal-spec/example_group, class ExampleGroup
|
232
272
|
function ExampleGroup() {};
|
233
273
|
ExampleGroup = __klass(__base, __super, "ExampleGroup", ExampleGroup);
|
234
274
|
var ExampleGroup_prototype = ExampleGroup.prototype, __scope = ExampleGroup._scope, TMP_1, TMP_2, TMP_3;
|
235
|
-
ExampleGroup_prototype.
|
275
|
+
ExampleGroup_prototype.examples = ExampleGroup_prototype.before_hooks = ExampleGroup_prototype.after_hooks = ExampleGroup_prototype.parent = ExampleGroup_prototype.desc = nil;
|
236
276
|
|
237
277
|
ExampleGroup.example_groups = [];
|
238
278
|
|
239
|
-
// line 4,
|
279
|
+
// line 4, opal-spec/example_group, ExampleGroup.example_groups
|
240
280
|
ExampleGroup.$example_groups = function() {
|
241
281
|
|
282
|
+
if (this.example_groups == null) this.example_groups = nil;
|
283
|
+
|
242
284
|
return this.example_groups
|
243
285
|
};
|
244
286
|
|
245
287
|
ExampleGroup.stack = [];
|
246
288
|
|
247
|
-
// line 9,
|
289
|
+
// line 9, opal-spec/example_group, ExampleGroup.create
|
248
290
|
ExampleGroup.$create = function(desc, block) {
|
249
291
|
var group = nil, __a;
|
250
|
-
|
251
|
-
this.example_groups
|
252
|
-
|
292
|
+
if (this.stack == null) this.stack = nil;
|
293
|
+
if (this.example_groups == null) this.example_groups = nil;
|
294
|
+
|
295
|
+
group = this['$new'](desc, this.stack.$last());
|
296
|
+
this.example_groups['$<<'](group);
|
297
|
+
this.stack['$<<'](group);
|
253
298
|
(__a = group, __a.$instance_eval._p = block.$to_proc(), __a.$instance_eval());
|
254
299
|
return this.stack.$pop();
|
255
300
|
};
|
256
301
|
|
257
|
-
// line 18,
|
302
|
+
// line 18, opal-spec/example_group, ExampleGroup#initialize
|
258
303
|
ExampleGroup_prototype.$initialize = function(desc, parent) {
|
259
304
|
|
260
305
|
this.desc = desc.$to_s();
|
@@ -264,47 +309,47 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
264
309
|
return this.after_hooks = [];
|
265
310
|
};
|
266
311
|
|
267
|
-
// line 27,
|
312
|
+
// line 27, opal-spec/example_group, ExampleGroup#it
|
268
313
|
ExampleGroup_prototype.$it = TMP_1 = function(desc) {
|
269
314
|
var __context, block;
|
270
315
|
block = TMP_1._p || nil, __context = block._s, TMP_1._p = null;
|
271
316
|
|
272
|
-
return this.examples
|
317
|
+
return this.examples['$<<'](__scope.Example['$new'](this, desc, block));
|
273
318
|
};
|
274
319
|
|
275
|
-
// line 31,
|
320
|
+
// line 31, opal-spec/example_group, ExampleGroup#it_behaves_like
|
276
321
|
ExampleGroup_prototype.$it_behaves_like = function(objs) {
|
277
322
|
objs = __slice.call(arguments, 0);
|
278
323
|
return nil;
|
279
324
|
};
|
280
325
|
|
281
|
-
// line 34,
|
326
|
+
// line 34, opal-spec/example_group, ExampleGroup#before
|
282
327
|
ExampleGroup_prototype.$before = TMP_2 = function(type) {
|
283
328
|
var __a, __context, block;
|
284
329
|
block = TMP_2._p || nil, __context = block._s, TMP_2._p = null;
|
285
330
|
if (type == null) {
|
286
331
|
type = "each"
|
287
332
|
}
|
288
|
-
if ((__a = type
|
289
|
-
this.$raise("unsupported before type: " + type)
|
333
|
+
if ((__a = type['$==']("each")) === false || __a === nil) {
|
334
|
+
this.$raise("unsupported before type: " + (type))
|
290
335
|
};
|
291
|
-
return this.before_hooks
|
336
|
+
return this.before_hooks['$<<'](block);
|
292
337
|
};
|
293
338
|
|
294
|
-
// line 39,
|
339
|
+
// line 39, opal-spec/example_group, ExampleGroup#after
|
295
340
|
ExampleGroup_prototype.$after = TMP_3 = function(type) {
|
296
341
|
var __a, __context, block;
|
297
342
|
block = TMP_3._p || nil, __context = block._s, TMP_3._p = null;
|
298
343
|
if (type == null) {
|
299
344
|
type = "each"
|
300
345
|
}
|
301
|
-
if ((__a = type
|
302
|
-
this.$raise("unsupported after type: " + type)
|
346
|
+
if ((__a = type['$==']("each")) === false || __a === nil) {
|
347
|
+
this.$raise("unsupported after type: " + (type))
|
303
348
|
};
|
304
|
-
return this.after_hooks
|
349
|
+
return this.after_hooks['$<<'](block);
|
305
350
|
};
|
306
351
|
|
307
|
-
// line 44,
|
352
|
+
// line 44, opal-spec/example_group, ExampleGroup#before_hooks
|
308
353
|
ExampleGroup_prototype.$before_hooks = function() {
|
309
354
|
var __a;
|
310
355
|
if ((__a = this.parent) !== false && __a !== nil) {
|
@@ -314,7 +359,7 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
314
359
|
};
|
315
360
|
};
|
316
361
|
|
317
|
-
// line 48,
|
362
|
+
// line 48, opal-spec/example_group, ExampleGroup#after_hooks
|
318
363
|
ExampleGroup_prototype.$after_hooks = function() {
|
319
364
|
var __a;
|
320
365
|
if ((__a = this.parent) !== false && __a !== nil) {
|
@@ -324,7 +369,7 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
324
369
|
};
|
325
370
|
};
|
326
371
|
|
327
|
-
// line 52,
|
372
|
+
// line 52, opal-spec/example_group, ExampleGroup#run
|
328
373
|
ExampleGroup_prototype.$run = function(runner) {
|
329
374
|
var __a, __b;
|
330
375
|
runner.$example_group_started(this);
|
@@ -338,11 +383,11 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
338
383
|
return runner.$example_group_finished(this);
|
339
384
|
};
|
340
385
|
|
341
|
-
// line 58,
|
386
|
+
// line 58, opal-spec/example_group, ExampleGroup#description
|
342
387
|
ExampleGroup_prototype.$description = function() {
|
343
388
|
var __a;
|
344
389
|
if ((__a = this.parent) !== false && __a !== nil) {
|
345
|
-
return "" + this.parent.$description() + " " + this.desc
|
390
|
+
return "" + (this.parent.$description()) + " " + (this.desc)
|
346
391
|
} else {
|
347
392
|
return this.desc
|
348
393
|
};
|
@@ -352,18 +397,18 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
352
397
|
|
353
398
|
})(self)
|
354
399
|
})();
|
355
|
-
//
|
400
|
+
// lib/opal-spec/expectations.rb
|
356
401
|
(function() {
|
357
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __module = __opal.module, __klass = __opal.klass;
|
358
|
-
|
402
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm, __module = __opal.module, __klass = __opal.klass;
|
403
|
+
|
359
404
|
(function(__base){
|
360
|
-
// line 1,
|
405
|
+
// line 1, opal-spec/expectations, module Spec
|
361
406
|
function Spec() {};
|
362
407
|
Spec = __module(__base, "Spec", Spec);
|
363
408
|
var Spec_prototype = Spec.prototype, __scope = Spec._scope;
|
364
409
|
|
365
410
|
(function(__base, __super){
|
366
|
-
// line 2,
|
411
|
+
// line 2, opal-spec/expectations, class ExpectationNotMetError
|
367
412
|
function ExpectationNotMetError() {};
|
368
413
|
ExpectationNotMetError = __klass(__base, __super, "ExpectationNotMetError", ExpectationNotMetError);
|
369
414
|
var ExpectationNotMetError_prototype = ExpectationNotMetError.prototype, __scope = ExpectationNotMetError._scope;
|
@@ -373,12 +418,12 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
373
418
|
})(Spec, __scope.StandardError);
|
374
419
|
|
375
420
|
(function(__base){
|
376
|
-
// line 4,
|
421
|
+
// line 4, opal-spec/expectations, module Expectations
|
377
422
|
function Expectations() {};
|
378
423
|
Expectations = __module(__base, "Expectations", Expectations);
|
379
424
|
var Expectations_prototype = Expectations.prototype, __scope = Expectations._scope;
|
380
425
|
|
381
|
-
// line 5,
|
426
|
+
// line 5, opal-spec/expectations, Expectations#should
|
382
427
|
Expectations_prototype.$should = function(matcher) {
|
383
428
|
if (matcher == null) {
|
384
429
|
matcher = nil
|
@@ -386,11 +431,11 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
386
431
|
if (matcher !== false && matcher !== nil) {
|
387
432
|
return matcher.$match(this)
|
388
433
|
} else {
|
389
|
-
return (__scope.Spec)._scope.PositiveOperatorMatcher
|
434
|
+
return (__scope.Spec)._scope.PositiveOperatorMatcher['$new'](this)
|
390
435
|
};
|
391
436
|
};
|
392
437
|
|
393
|
-
// line 13,
|
438
|
+
// line 13, opal-spec/expectations, Expectations#should_not
|
394
439
|
Expectations_prototype.$should_not = function(matcher) {
|
395
440
|
if (matcher == null) {
|
396
441
|
matcher = nil
|
@@ -398,51 +443,51 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
398
443
|
if (matcher !== false && matcher !== nil) {
|
399
444
|
return matcher.$not_match(this)
|
400
445
|
} else {
|
401
|
-
return (__scope.Spec)._scope.NegativeOperatorMatcher
|
446
|
+
return (__scope.Spec)._scope.NegativeOperatorMatcher['$new'](this)
|
402
447
|
};
|
403
448
|
};
|
404
449
|
|
405
|
-
// line 21,
|
450
|
+
// line 21, opal-spec/expectations, Expectations#be_kind_of
|
406
451
|
Expectations_prototype.$be_kind_of = function(expected) {
|
407
452
|
|
408
|
-
return (__scope.Spec)._scope.BeKindOfMatcher
|
453
|
+
return (__scope.Spec)._scope.BeKindOfMatcher['$new'](expected);
|
409
454
|
};
|
410
455
|
|
411
|
-
// line 25,
|
456
|
+
// line 25, opal-spec/expectations, Expectations#be_nil
|
412
457
|
Expectations_prototype.$be_nil = function() {
|
413
458
|
|
414
|
-
return (__scope.Spec)._scope.BeNilMatcher
|
459
|
+
return (__scope.Spec)._scope.BeNilMatcher['$new'](nil);
|
415
460
|
};
|
416
461
|
|
417
|
-
// line 29,
|
462
|
+
// line 29, opal-spec/expectations, Expectations#be_true
|
418
463
|
Expectations_prototype.$be_true = function() {
|
419
464
|
|
420
|
-
return (__scope.Spec)._scope.BeTrueMatcher
|
465
|
+
return (__scope.Spec)._scope.BeTrueMatcher['$new'](true);
|
421
466
|
};
|
422
467
|
|
423
|
-
// line 33,
|
468
|
+
// line 33, opal-spec/expectations, Expectations#be_false
|
424
469
|
Expectations_prototype.$be_false = function() {
|
425
470
|
|
426
|
-
return (__scope.Spec)._scope.BeFalseMatcher
|
471
|
+
return (__scope.Spec)._scope.BeFalseMatcher['$new'](false);
|
427
472
|
};
|
428
473
|
|
429
|
-
// line 37,
|
474
|
+
// line 37, opal-spec/expectations, Expectations#equal
|
430
475
|
Expectations_prototype.$equal = function(expected) {
|
431
476
|
|
432
|
-
return (__scope.Spec)._scope.EqualMatcher
|
477
|
+
return (__scope.Spec)._scope.EqualMatcher['$new'](expected);
|
433
478
|
};
|
434
479
|
|
435
|
-
// line 41,
|
480
|
+
// line 41, opal-spec/expectations, Expectations#raise_error
|
436
481
|
Expectations_prototype.$raise_error = function(expected) {
|
437
482
|
|
438
|
-
return (__scope.Spec)._scope.RaiseErrorMatcher
|
483
|
+
return (__scope.Spec)._scope.RaiseErrorMatcher['$new'](expected);
|
439
484
|
};
|
440
485
|
;Expectations._donate(["$should", "$should_not", "$be_kind_of", "$be_nil", "$be_true", "$be_false", "$equal", "$raise_error"]);
|
441
486
|
})(Spec);
|
442
487
|
|
443
488
|
})(self);
|
444
489
|
return (function(__base, __super){
|
445
|
-
// line 47,
|
490
|
+
// line 47, opal-spec/expectations, class Object
|
446
491
|
function Object() {};
|
447
492
|
Object = __klass(__base, __super, "Object", Object);
|
448
493
|
var Object_prototype = Object.prototype, __scope = Object._scope;
|
@@ -451,17 +496,17 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
451
496
|
|
452
497
|
})(self, null);
|
453
498
|
})();
|
454
|
-
//
|
499
|
+
// lib/opal-spec/kernel.rb
|
455
500
|
(function() {
|
456
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __module = __opal.module;
|
457
|
-
|
501
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm, __module = __opal.module;
|
502
|
+
|
458
503
|
return (function(__base){
|
459
|
-
// line 1,
|
504
|
+
// line 1, opal-spec/kernel, module Kernel
|
460
505
|
function Kernel() {};
|
461
506
|
Kernel = __module(__base, "Kernel", Kernel);
|
462
507
|
var Kernel_prototype = Kernel.prototype, __scope = Kernel._scope, TMP_1;
|
463
508
|
|
464
|
-
// line 2,
|
509
|
+
// line 2, opal-spec/kernel, Kernel#describe
|
465
510
|
Kernel_prototype.$describe = TMP_1 = function(desc) {
|
466
511
|
var __context, block;
|
467
512
|
block = TMP_1._p || nil, __context = block._s, TMP_1._p = null;
|
@@ -469,37 +514,37 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
469
514
|
return (__scope.Spec)._scope.ExampleGroup.$create(desc, block);
|
470
515
|
};
|
471
516
|
|
472
|
-
// line 6,
|
517
|
+
// line 6, opal-spec/kernel, Kernel#mock
|
473
518
|
Kernel_prototype.$mock = function(obj) {
|
474
519
|
|
475
|
-
return __scope.Object
|
520
|
+
return __scope.Object['$new']();
|
476
521
|
};
|
477
522
|
;Kernel._donate(["$describe", "$mock"]);
|
478
523
|
})(self)
|
479
524
|
})();
|
480
|
-
//
|
525
|
+
// lib/opal-spec/matchers.rb
|
481
526
|
(function() {
|
482
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __module = __opal.module, __klass = __opal.klass;
|
483
|
-
|
527
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm, __module = __opal.module, __klass = __opal.klass;
|
528
|
+
|
484
529
|
return (function(__base){
|
485
|
-
// line 1,
|
530
|
+
// line 1, opal-spec/matchers, module Spec
|
486
531
|
function Spec() {};
|
487
532
|
Spec = __module(__base, "Spec", Spec);
|
488
533
|
var Spec_prototype = Spec.prototype, __scope = Spec._scope;
|
489
534
|
|
490
535
|
(function(__base, __super){
|
491
|
-
// line 2,
|
536
|
+
// line 2, opal-spec/matchers, class Matcher
|
492
537
|
function Matcher() {};
|
493
538
|
Matcher = __klass(__base, __super, "Matcher", Matcher);
|
494
539
|
var Matcher_prototype = Matcher.prototype, __scope = Matcher._scope;
|
495
540
|
|
496
|
-
// line 3,
|
541
|
+
// line 3, opal-spec/matchers, Matcher#initialize
|
497
542
|
Matcher_prototype.$initialize = function(actual) {
|
498
543
|
|
499
544
|
return this.actual = actual;
|
500
545
|
};
|
501
546
|
|
502
|
-
// line 7,
|
547
|
+
// line 7, opal-spec/matchers, Matcher#failure
|
503
548
|
Matcher_prototype.$failure = function(message) {
|
504
549
|
|
505
550
|
return this.$raise((__scope.Spec)._scope.ExpectationNotMetError, message);
|
@@ -508,138 +553,138 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
508
553
|
})(Spec, null);
|
509
554
|
|
510
555
|
(function(__base, __super){
|
511
|
-
// line 12,
|
556
|
+
// line 12, opal-spec/matchers, class PositiveOperatorMatcher
|
512
557
|
function PositiveOperatorMatcher() {};
|
513
558
|
PositiveOperatorMatcher = __klass(__base, __super, "PositiveOperatorMatcher", PositiveOperatorMatcher);
|
514
559
|
var PositiveOperatorMatcher_prototype = PositiveOperatorMatcher.prototype, __scope = PositiveOperatorMatcher._scope;
|
515
560
|
PositiveOperatorMatcher_prototype.actual = nil;
|
516
561
|
|
517
|
-
// line 13,
|
518
|
-
PositiveOperatorMatcher_prototype
|
562
|
+
// line 13, opal-spec/matchers, PositiveOperatorMatcher#==
|
563
|
+
PositiveOperatorMatcher_prototype['$=='] = function(expected) {
|
519
564
|
|
520
|
-
if (this.actual
|
565
|
+
if (this.actual['$=='](expected)) {
|
521
566
|
return true
|
522
567
|
} else {
|
523
|
-
return this.$failure("expected: " + expected.$inspect() + ", got: " + this.actual.$inspect() + " (using ==).")
|
568
|
+
return this.$failure("expected: " + (expected.$inspect()) + ", got: " + (this.actual.$inspect()) + " (using ==).")
|
524
569
|
};
|
525
570
|
}
|
526
|
-
;PositiveOperatorMatcher._donate(["
|
571
|
+
;PositiveOperatorMatcher._donate(["$=="]);
|
527
572
|
})(Spec, __scope.Matcher);
|
528
573
|
|
529
574
|
(function(__base, __super){
|
530
|
-
// line 22,
|
575
|
+
// line 22, opal-spec/matchers, class NegativeOperatorMatcher
|
531
576
|
function NegativeOperatorMatcher() {};
|
532
577
|
NegativeOperatorMatcher = __klass(__base, __super, "NegativeOperatorMatcher", NegativeOperatorMatcher);
|
533
578
|
var NegativeOperatorMatcher_prototype = NegativeOperatorMatcher.prototype, __scope = NegativeOperatorMatcher._scope;
|
534
579
|
NegativeOperatorMatcher_prototype.actual = nil;
|
535
580
|
|
536
|
-
// line 23,
|
537
|
-
NegativeOperatorMatcher_prototype
|
581
|
+
// line 23, opal-spec/matchers, NegativeOperatorMatcher#==
|
582
|
+
NegativeOperatorMatcher_prototype['$=='] = function(expected) {
|
538
583
|
|
539
|
-
if (this.actual
|
540
|
-
return this.$failure("expected: " + expected.$inspect() + " not to be " + this.actual.$inspect() + " (using ==).")
|
584
|
+
if (this.actual['$=='](expected)) {
|
585
|
+
return this.$failure("expected: " + (expected.$inspect()) + " not to be " + (this.actual.$inspect()) + " (using ==).")
|
541
586
|
} else {
|
542
587
|
return nil
|
543
588
|
};
|
544
589
|
}
|
545
|
-
;NegativeOperatorMatcher._donate(["
|
590
|
+
;NegativeOperatorMatcher._donate(["$=="]);
|
546
591
|
})(Spec, __scope.Matcher);
|
547
592
|
|
548
593
|
(function(__base, __super){
|
549
|
-
// line 30,
|
594
|
+
// line 30, opal-spec/matchers, class BeKindOfMatcher
|
550
595
|
function BeKindOfMatcher() {};
|
551
596
|
BeKindOfMatcher = __klass(__base, __super, "BeKindOfMatcher", BeKindOfMatcher);
|
552
597
|
var BeKindOfMatcher_prototype = BeKindOfMatcher.prototype, __scope = BeKindOfMatcher._scope;
|
553
598
|
BeKindOfMatcher_prototype.actual = nil;
|
554
599
|
|
555
|
-
// line 31,
|
600
|
+
// line 31, opal-spec/matchers, BeKindOfMatcher#match
|
556
601
|
BeKindOfMatcher_prototype.$match = function(expected) {
|
557
602
|
var __a;
|
558
|
-
if ((__a = expected
|
603
|
+
if ((__a = expected['$kind_of?'](this.actual)) !== false && __a !== nil) {
|
559
604
|
return nil
|
560
605
|
} else {
|
561
|
-
return this.$failure("expected " + expected.$inspect() + " to be a kind of " + this.actual + ", not " + expected
|
606
|
+
return this.$failure("expected " + (expected.$inspect()) + " to be a kind of " + (this.actual) + ", not " + (expected['$class']()) + ".")
|
562
607
|
};
|
563
608
|
}
|
564
609
|
;BeKindOfMatcher._donate(["$match"]);
|
565
610
|
})(Spec, __scope.Matcher);
|
566
611
|
|
567
612
|
(function(__base, __super){
|
568
|
-
// line 38,
|
613
|
+
// line 38, opal-spec/matchers, class BeNilMatcher
|
569
614
|
function BeNilMatcher() {};
|
570
615
|
BeNilMatcher = __klass(__base, __super, "BeNilMatcher", BeNilMatcher);
|
571
616
|
var BeNilMatcher_prototype = BeNilMatcher.prototype, __scope = BeNilMatcher._scope;
|
572
617
|
|
573
|
-
// line 39,
|
618
|
+
// line 39, opal-spec/matchers, BeNilMatcher#match
|
574
619
|
BeNilMatcher_prototype.$match = function(expected) {
|
575
620
|
var __a;
|
576
|
-
if ((__a = expected
|
621
|
+
if ((__a = expected['$nil?']()) !== false && __a !== nil) {
|
577
622
|
return nil
|
578
623
|
} else {
|
579
|
-
return this.$failure("expected " + expected.$inspect() + " to be nil.")
|
624
|
+
return this.$failure("expected " + (expected.$inspect()) + " to be nil.")
|
580
625
|
};
|
581
626
|
}
|
582
627
|
;BeNilMatcher._donate(["$match"]);
|
583
628
|
})(Spec, __scope.Matcher);
|
584
629
|
|
585
630
|
(function(__base, __super){
|
586
|
-
// line 46,
|
631
|
+
// line 46, opal-spec/matchers, class BeTrueMatcher
|
587
632
|
function BeTrueMatcher() {};
|
588
633
|
BeTrueMatcher = __klass(__base, __super, "BeTrueMatcher", BeTrueMatcher);
|
589
634
|
var BeTrueMatcher_prototype = BeTrueMatcher.prototype, __scope = BeTrueMatcher._scope;
|
590
635
|
|
591
|
-
// line 47,
|
636
|
+
// line 47, opal-spec/matchers, BeTrueMatcher#match
|
592
637
|
BeTrueMatcher_prototype.$match = function(expected) {
|
593
638
|
|
594
|
-
if (expected
|
639
|
+
if (expected['$=='](true)) {
|
595
640
|
return nil
|
596
641
|
} else {
|
597
|
-
return this.$failure("expected " + expected.$inspect() + " to be true.")
|
642
|
+
return this.$failure("expected " + (expected.$inspect()) + " to be true.")
|
598
643
|
};
|
599
644
|
}
|
600
645
|
;BeTrueMatcher._donate(["$match"]);
|
601
646
|
})(Spec, __scope.Matcher);
|
602
647
|
|
603
648
|
(function(__base, __super){
|
604
|
-
// line 54,
|
649
|
+
// line 54, opal-spec/matchers, class BeFalseMatcher
|
605
650
|
function BeFalseMatcher() {};
|
606
651
|
BeFalseMatcher = __klass(__base, __super, "BeFalseMatcher", BeFalseMatcher);
|
607
652
|
var BeFalseMatcher_prototype = BeFalseMatcher.prototype, __scope = BeFalseMatcher._scope;
|
608
653
|
|
609
|
-
// line 55,
|
654
|
+
// line 55, opal-spec/matchers, BeFalseMatcher#match
|
610
655
|
BeFalseMatcher_prototype.$match = function(expected) {
|
611
656
|
|
612
|
-
if (expected
|
657
|
+
if (expected['$=='](false)) {
|
613
658
|
return nil
|
614
659
|
} else {
|
615
|
-
return this.$failure("expected " + expected.$inspect() + " to be false.")
|
660
|
+
return this.$failure("expected " + (expected.$inspect()) + " to be false.")
|
616
661
|
};
|
617
662
|
}
|
618
663
|
;BeFalseMatcher._donate(["$match"]);
|
619
664
|
})(Spec, __scope.Matcher);
|
620
665
|
|
621
666
|
(function(__base, __super){
|
622
|
-
// line 62,
|
667
|
+
// line 62, opal-spec/matchers, class EqualMatcher
|
623
668
|
function EqualMatcher() {};
|
624
669
|
EqualMatcher = __klass(__base, __super, "EqualMatcher", EqualMatcher);
|
625
670
|
var EqualMatcher_prototype = EqualMatcher.prototype, __scope = EqualMatcher._scope;
|
626
671
|
EqualMatcher_prototype.actual = nil;
|
627
672
|
|
628
|
-
// line 63,
|
673
|
+
// line 63, opal-spec/matchers, EqualMatcher#match
|
629
674
|
EqualMatcher_prototype.$match = function(expected) {
|
630
675
|
var __a;
|
631
|
-
if ((__a = expected
|
676
|
+
if ((__a = expected['$equal?'](this.actual)) !== false && __a !== nil) {
|
632
677
|
return nil
|
633
678
|
} else {
|
634
|
-
return this.$failure("expected " + this.actual.$inspect() + " to be the same as " + expected.$inspect() + ".")
|
679
|
+
return this.$failure("expected " + (this.actual.$inspect()) + " to be the same as " + (expected.$inspect()) + ".")
|
635
680
|
};
|
636
681
|
};
|
637
682
|
|
638
|
-
// line 69,
|
683
|
+
// line 69, opal-spec/matchers, EqualMatcher#not_match
|
639
684
|
EqualMatcher_prototype.$not_match = function(expected) {
|
640
685
|
var __a;
|
641
|
-
if ((__a = expected
|
642
|
-
return this.$failure("expected " + this.actual.$inspect() + " not to be equal to " + expected.$inspect() + ".")
|
686
|
+
if ((__a = expected['$equal?'](this.actual)) !== false && __a !== nil) {
|
687
|
+
return this.$failure("expected " + (this.actual.$inspect()) + " not to be equal to " + (expected.$inspect()) + ".")
|
643
688
|
} else {
|
644
689
|
return nil
|
645
690
|
};
|
@@ -648,13 +693,13 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
648
693
|
})(Spec, __scope.Matcher);
|
649
694
|
|
650
695
|
(function(__base, __super){
|
651
|
-
// line 76,
|
696
|
+
// line 76, opal-spec/matchers, class RaiseErrorMatcher
|
652
697
|
function RaiseErrorMatcher() {};
|
653
698
|
RaiseErrorMatcher = __klass(__base, __super, "RaiseErrorMatcher", RaiseErrorMatcher);
|
654
699
|
var RaiseErrorMatcher_prototype = RaiseErrorMatcher.prototype, __scope = RaiseErrorMatcher._scope;
|
655
700
|
RaiseErrorMatcher_prototype.actual = nil;
|
656
701
|
|
657
|
-
// line 77,
|
702
|
+
// line 77, opal-spec/matchers, RaiseErrorMatcher#match
|
658
703
|
RaiseErrorMatcher_prototype.$match = function(block) {
|
659
704
|
var should_raise = nil, e = nil;
|
660
705
|
should_raise = false;
|
@@ -667,7 +712,7 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
667
712
|
else { throw $err; }
|
668
713
|
};
|
669
714
|
if (should_raise !== false && should_raise !== nil) {
|
670
|
-
return this.$failure("expected " + this.actual + " to be raised, but nothing was.")
|
715
|
+
return this.$failure("expected " + (this.actual) + " to be raised, but nothing was.")
|
671
716
|
} else {
|
672
717
|
return nil
|
673
718
|
};
|
@@ -677,30 +722,281 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
677
722
|
|
678
723
|
})(self)
|
679
724
|
})();
|
680
|
-
//
|
725
|
+
// lib/opal-spec/phantom_formatter.rb
|
681
726
|
(function() {
|
682
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __module = __opal.module, __klass = __opal.klass;
|
727
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm, __module = __opal.module, __klass = __opal.klass;
|
728
|
+
|
729
|
+
return (function(__base){
|
730
|
+
// line 1, opal-spec/phantom_formatter, module Spec
|
731
|
+
function Spec() {};
|
732
|
+
Spec = __module(__base, "Spec", Spec);
|
733
|
+
var Spec_prototype = Spec.prototype, __scope = Spec._scope;
|
734
|
+
|
735
|
+
(function(__base, __super){
|
736
|
+
// line 2, opal-spec/phantom_formatter, class PhantomFormatter
|
737
|
+
function PhantomFormatter() {};
|
738
|
+
PhantomFormatter = __klass(__base, __super, "PhantomFormatter", PhantomFormatter);
|
739
|
+
var PhantomFormatter_prototype = PhantomFormatter.prototype, __scope = PhantomFormatter._scope;
|
740
|
+
PhantomFormatter_prototype.failed_examples = PhantomFormatter_prototype.examples = nil;
|
741
|
+
|
742
|
+
// line 3, opal-spec/phantom_formatter, PhantomFormatter#initialize
|
743
|
+
PhantomFormatter_prototype.$initialize = function() {
|
744
|
+
|
745
|
+
this.examples = [];
|
746
|
+
return this.failed_examples = [];
|
747
|
+
};
|
748
|
+
|
749
|
+
// line 8, opal-spec/phantom_formatter, PhantomFormatter#log_green
|
750
|
+
PhantomFormatter_prototype.$log_green = function(str) {
|
751
|
+
|
752
|
+
return console.log('\033[92m' + str + '\033[0m');
|
753
|
+
};
|
754
|
+
|
755
|
+
// line 12, opal-spec/phantom_formatter, PhantomFormatter#log_red
|
756
|
+
PhantomFormatter_prototype.$log_red = function(str) {
|
757
|
+
|
758
|
+
return console.log('\033[31m' + str + '\033[0m');
|
759
|
+
};
|
760
|
+
|
761
|
+
// line 16, opal-spec/phantom_formatter, PhantomFormatter#log
|
762
|
+
PhantomFormatter_prototype.$log = function(str) {
|
763
|
+
|
764
|
+
return console.log(str);
|
765
|
+
};
|
766
|
+
|
767
|
+
// line 20, opal-spec/phantom_formatter, PhantomFormatter#start
|
768
|
+
PhantomFormatter_prototype.$start = function() {
|
769
|
+
|
770
|
+
return nil;
|
771
|
+
};
|
772
|
+
|
773
|
+
// line 23, opal-spec/phantom_formatter, PhantomFormatter#finish
|
774
|
+
PhantomFormatter_prototype.$finish = function() {
|
775
|
+
var __a, __b;
|
776
|
+
if ((__a = this.failed_examples['$empty?']()) !== false && __a !== nil) {
|
777
|
+
this.$log("\nFinished");
|
778
|
+
this.$log_green("" + (this.$example_count()) + " examples, 0 failures");
|
779
|
+
return phantom.exit(0);
|
780
|
+
} else {
|
781
|
+
this.$log("\nFailures:");
|
782
|
+
(__b = this.failed_examples, __b.$each_with_index._p = (__a = function(example, idx) {
|
783
|
+
|
784
|
+
var exception = nil, $case = nil, output = nil, __a, __b;
|
785
|
+
if (example == null) example = nil;
|
786
|
+
if (idx == null) idx = nil;
|
787
|
+
|
788
|
+
this.$log("\n " + ((__a = idx, __b = 1, typeof(__a) === 'number' ? __a + __b : __a['$+'](__b))) + ". " + (example.$example_group().$description()) + " " + (example.$description()));
|
789
|
+
exception = example.$exception();
|
790
|
+
$case = exception;if ((__scope.Spec)._scope.ExpectationNotMetError['$===']($case)) {
|
791
|
+
output = exception.$message()
|
792
|
+
}
|
793
|
+
else {output = "" + (exception['$class']()) + ": " + (exception.$message()) + "\n";
|
794
|
+
output = output['$+'](" " + (exception.$backtrace().$join("\n ")) + "\n");};
|
795
|
+
return this.$log_red(" " + (output));
|
796
|
+
}, __a._s = this, __a), __b.$each_with_index());
|
797
|
+
this.$log("\nFinished");
|
798
|
+
this.$log_red("" + (this.$example_count()) + " examples, " + (this.failed_examples.$size()) + " failures");
|
799
|
+
return phantom.exit(1);
|
800
|
+
};
|
801
|
+
};
|
802
|
+
|
803
|
+
// line 57, opal-spec/phantom_formatter, PhantomFormatter#example_group_started
|
804
|
+
PhantomFormatter_prototype.$example_group_started = function(group) {
|
805
|
+
|
806
|
+
this.example_group = group;
|
807
|
+
this.example_group_failed = false;
|
808
|
+
return this.$log("\n" + (group.$description()));
|
809
|
+
};
|
810
|
+
|
811
|
+
// line 64, opal-spec/phantom_formatter, PhantomFormatter#example_group_finished
|
812
|
+
PhantomFormatter_prototype.$example_group_finished = function(group) {
|
813
|
+
|
814
|
+
return nil;
|
815
|
+
};
|
816
|
+
|
817
|
+
// line 67, opal-spec/phantom_formatter, PhantomFormatter#example_started
|
818
|
+
PhantomFormatter_prototype.$example_started = function(example) {
|
819
|
+
|
820
|
+
this.examples['$<<'](example);
|
821
|
+
return this.example = example;
|
822
|
+
};
|
823
|
+
|
824
|
+
// line 72, opal-spec/phantom_formatter, PhantomFormatter#example_failed
|
825
|
+
PhantomFormatter_prototype.$example_failed = function(example) {
|
826
|
+
|
827
|
+
this.failed_examples['$<<'](example);
|
828
|
+
this.example_group_failed = true;
|
829
|
+
return this.$log_red(" " + (example.$description()));
|
830
|
+
};
|
683
831
|
|
832
|
+
// line 78, opal-spec/phantom_formatter, PhantomFormatter#example_passed
|
833
|
+
PhantomFormatter_prototype.$example_passed = function(example) {
|
834
|
+
|
835
|
+
return this.$log_green(" " + (example.$description()));
|
836
|
+
};
|
837
|
+
|
838
|
+
// line 82, opal-spec/phantom_formatter, PhantomFormatter#example_count
|
839
|
+
PhantomFormatter_prototype.$example_count = function() {
|
840
|
+
|
841
|
+
return this.examples.$size();
|
842
|
+
};
|
843
|
+
;PhantomFormatter._donate(["$initialize", "$log_green", "$log_red", "$log", "$start", "$finish", "$example_group_started", "$example_group_finished", "$example_started", "$example_failed", "$example_passed", "$example_count"]);
|
844
|
+
})(Spec, null)
|
845
|
+
|
846
|
+
})(self)
|
847
|
+
})();
|
848
|
+
// lib/opal-spec/rspec_formatter.rb
|
849
|
+
(function() {
|
850
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm, __module = __opal.module, __klass = __opal.klass;
|
851
|
+
|
684
852
|
return (function(__base){
|
685
|
-
// line 1,
|
853
|
+
// line 1, opal-spec/rspec_formatter, module Spec
|
686
854
|
function Spec() {};
|
687
855
|
Spec = __module(__base, "Spec", Spec);
|
688
856
|
var Spec_prototype = Spec.prototype, __scope = Spec._scope;
|
689
857
|
|
690
858
|
(function(__base, __super){
|
691
|
-
// line 2,
|
859
|
+
// line 2, opal-spec/rspec_formatter, class RSpecFormatter
|
860
|
+
function RSpecFormatter() {};
|
861
|
+
RSpecFormatter = __klass(__base, __super, "RSpecFormatter", RSpecFormatter);
|
862
|
+
var RSpecFormatter_prototype = RSpecFormatter.prototype, __scope = RSpecFormatter._scope;
|
863
|
+
RSpecFormatter_prototype.spec_collector = RSpecFormatter_prototype.example_group = RSpecFormatter_prototype.examples = RSpecFormatter_prototype.failed_examples = nil;
|
864
|
+
|
865
|
+
// line 3, opal-spec/rspec_formatter, RSpecFormatter#initialize
|
866
|
+
RSpecFormatter_prototype.$initialize = function() {
|
867
|
+
|
868
|
+
this.examples = [];
|
869
|
+
this.failed_examples = [];
|
870
|
+
return this.spec_collector = spec_collector;
|
871
|
+
};
|
872
|
+
|
873
|
+
// line 10, opal-spec/rspec_formatter, RSpecFormatter#start
|
874
|
+
RSpecFormatter_prototype.$start = function() {
|
875
|
+
|
876
|
+
return nil;
|
877
|
+
};
|
878
|
+
|
879
|
+
// line 13, opal-spec/rspec_formatter, RSpecFormatter#finish
|
880
|
+
RSpecFormatter_prototype.$finish = function() {
|
881
|
+
|
882
|
+
return nil;
|
883
|
+
};
|
884
|
+
|
885
|
+
// line 16, opal-spec/rspec_formatter, RSpecFormatter#example_group_started
|
886
|
+
RSpecFormatter_prototype.$example_group_started = function(group) {
|
887
|
+
|
888
|
+
this.example_group = group;
|
889
|
+
this.example_group_failed = false;
|
890
|
+
return this.spec_collector.example_group_started(group.$description());
|
891
|
+
};
|
892
|
+
|
893
|
+
// line 23, opal-spec/rspec_formatter, RSpecFormatter#example_group_finished
|
894
|
+
RSpecFormatter_prototype.$example_group_finished = function(group) {
|
895
|
+
|
896
|
+
return this.spec_collector.example_group_finished(this.example_group.$description());
|
897
|
+
};
|
898
|
+
|
899
|
+
// line 27, opal-spec/rspec_formatter, RSpecFormatter#example_started
|
900
|
+
RSpecFormatter_prototype.$example_started = function(example) {
|
901
|
+
|
902
|
+
this.examples['$<<'](example);
|
903
|
+
return this.example = example;
|
904
|
+
};
|
905
|
+
|
906
|
+
// line 32, opal-spec/rspec_formatter, RSpecFormatter#example_failed
|
907
|
+
RSpecFormatter_prototype.$example_failed = function(example) {
|
908
|
+
|
909
|
+
this.failed_examples['$<<'](example);
|
910
|
+
this.example_group_failed = true;
|
911
|
+
return this.spec_collector.example_failed(example.$description(), example.$exception().$message());
|
912
|
+
};
|
913
|
+
|
914
|
+
// line 38, opal-spec/rspec_formatter, RSpecFormatter#example_passed
|
915
|
+
RSpecFormatter_prototype.$example_passed = function(example) {
|
916
|
+
|
917
|
+
return this.spec_collector.example_passed(example.$description());
|
918
|
+
};
|
919
|
+
|
920
|
+
// line 42, opal-spec/rspec_formatter, RSpecFormatter#example_count
|
921
|
+
RSpecFormatter_prototype.$example_count = function() {
|
922
|
+
|
923
|
+
return this.examples.$size();
|
924
|
+
};
|
925
|
+
;RSpecFormatter._donate(["$initialize", "$start", "$finish", "$example_group_started", "$example_group_finished", "$example_started", "$example_failed", "$example_passed", "$example_count"]);
|
926
|
+
})(Spec, null)
|
927
|
+
|
928
|
+
})(self)
|
929
|
+
})();
|
930
|
+
// lib/opal-spec/runner.rb
|
931
|
+
(function() {
|
932
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm, __module = __opal.module, __klass = __opal.klass;
|
933
|
+
|
934
|
+
return (function(__base){
|
935
|
+
// line 1, opal-spec/runner, module Spec
|
936
|
+
function Spec() {};
|
937
|
+
Spec = __module(__base, "Spec", Spec);
|
938
|
+
var Spec_prototype = Spec.prototype, __scope = Spec._scope;
|
939
|
+
|
940
|
+
(function(__base, __super){
|
941
|
+
// line 2, opal-spec/runner, class Runner
|
692
942
|
function Runner() {};
|
693
943
|
Runner = __klass(__base, __super, "Runner", Runner);
|
694
944
|
var Runner_prototype = Runner.prototype, __scope = Runner._scope;
|
695
945
|
Runner_prototype.formatter = nil;
|
696
946
|
|
697
|
-
// line 3,
|
698
|
-
|
947
|
+
// line 3, opal-spec/runner, Runner.in_browser?
|
948
|
+
Runner['$in_browser?'] = function() {
|
949
|
+
|
699
950
|
|
700
|
-
|
951
|
+
if (typeof(window) !== 'undefined' && typeof(document) !== 'undefined') {
|
952
|
+
return true;
|
953
|
+
}
|
954
|
+
|
955
|
+
return false;
|
956
|
+
|
701
957
|
};
|
702
958
|
|
703
|
-
// line
|
959
|
+
// line 13, opal-spec/runner, Runner.in_phantom?
|
960
|
+
Runner['$in_phantom?'] = function() {
|
961
|
+
|
962
|
+
|
963
|
+
if (typeof(phantom) !== 'undefined' && phantom.exit) {
|
964
|
+
return true;
|
965
|
+
}
|
966
|
+
|
967
|
+
return false;
|
968
|
+
|
969
|
+
};
|
970
|
+
|
971
|
+
// line 23, opal-spec/runner, Runner.autorun
|
972
|
+
Runner.$autorun = function() {
|
973
|
+
var __a;
|
974
|
+
if ((__a = this['$in_browser?']()) !== false && __a !== nil) {
|
975
|
+
|
976
|
+
setTimeout(function() {
|
977
|
+
__scope.Runner['$new']().$run();
|
978
|
+
}, 0);
|
979
|
+
|
980
|
+
} else {
|
981
|
+
return __scope.Runner['$new']().$run()
|
982
|
+
}
|
983
|
+
};
|
984
|
+
|
985
|
+
// line 35, opal-spec/runner, Runner#initialize
|
986
|
+
Runner_prototype.$initialize = function() {
|
987
|
+
var __a;
|
988
|
+
if ((__a = __scope.Runner['$in_phantom?']()) !== false && __a !== nil) {
|
989
|
+
return this.formatter = __scope.PhantomFormatter['$new']()
|
990
|
+
} else {
|
991
|
+
if ((__a = __scope.Runner['$in_browser?']()) !== false && __a !== nil) {
|
992
|
+
return this.formatter = __scope.BrowserFormatter['$new']()
|
993
|
+
} else {
|
994
|
+
return this.formatter = __scope.RSpecFormatter['$new']()
|
995
|
+
}
|
996
|
+
};
|
997
|
+
};
|
998
|
+
|
999
|
+
// line 45, opal-spec/runner, Runner#run
|
704
1000
|
Runner_prototype.$run = function() {
|
705
1001
|
var groups = nil, __a, __b;
|
706
1002
|
groups = __scope.ExampleGroup.$example_groups();
|
@@ -715,105 +1011,106 @@ var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __brea
|
|
715
1011
|
return this.formatter.$finish();
|
716
1012
|
};
|
717
1013
|
|
718
|
-
// line
|
1014
|
+
// line 52, opal-spec/runner, Runner#example_group_started
|
719
1015
|
Runner_prototype.$example_group_started = function(group) {
|
720
1016
|
|
721
1017
|
return this.formatter.$example_group_started(group);
|
722
1018
|
};
|
723
1019
|
|
724
|
-
// line
|
1020
|
+
// line 56, opal-spec/runner, Runner#example_group_finished
|
725
1021
|
Runner_prototype.$example_group_finished = function(group) {
|
726
1022
|
|
727
1023
|
return this.formatter.$example_group_finished(group);
|
728
1024
|
};
|
729
1025
|
|
730
|
-
// line
|
1026
|
+
// line 60, opal-spec/runner, Runner#example_started
|
731
1027
|
Runner_prototype.$example_started = function(example) {
|
732
1028
|
|
733
1029
|
return this.formatter.$example_started(example);
|
734
1030
|
};
|
735
1031
|
|
736
|
-
// line
|
1032
|
+
// line 64, opal-spec/runner, Runner#example_passed
|
737
1033
|
Runner_prototype.$example_passed = function(example) {
|
738
1034
|
|
739
1035
|
return this.formatter.$example_passed(example);
|
740
1036
|
};
|
741
1037
|
|
742
|
-
// line
|
1038
|
+
// line 68, opal-spec/runner, Runner#example_failed
|
743
1039
|
Runner_prototype.$example_failed = function(example) {
|
744
1040
|
|
745
1041
|
return this.formatter.$example_failed(example);
|
746
1042
|
};
|
747
|
-
;Runner._donate(["$initialize", "$run", "$example_group_started", "$example_group_finished", "$example_started", "$example_passed", "$example_failed"]);
|
1043
|
+
;Runner._donate(["$initialize", "$run", "$example_group_started", "$example_group_finished", "$example_started", "$example_passed", "$example_failed"]); ;Runner._sdonate(["$in_browser?", "$in_phantom?", "$autorun"]);
|
748
1044
|
})(Spec, null)
|
749
1045
|
|
750
1046
|
})(self)
|
751
1047
|
})();
|
752
|
-
//
|
1048
|
+
// lib/opal-spec/scratch_pad.rb
|
753
1049
|
(function() {
|
754
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __module = __opal.module;
|
755
|
-
|
1050
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm, __module = __opal.module;
|
1051
|
+
|
756
1052
|
return (function(__base){
|
757
|
-
// line 1,
|
1053
|
+
// line 1, opal-spec/scratch_pad, module ScratchPad
|
758
1054
|
function ScratchPad() {};
|
759
1055
|
ScratchPad = __module(__base, "ScratchPad", ScratchPad);
|
760
1056
|
var ScratchPad_prototype = ScratchPad.prototype, __scope = ScratchPad._scope;
|
761
1057
|
|
762
|
-
// line 2,
|
1058
|
+
// line 2, opal-spec/scratch_pad, ScratchPad.clear
|
763
1059
|
ScratchPad.$clear = function() {
|
764
1060
|
|
765
1061
|
return this.record = nil
|
766
1062
|
};
|
767
1063
|
|
768
|
-
// line 6,
|
1064
|
+
// line 6, opal-spec/scratch_pad, ScratchPad.record
|
769
1065
|
ScratchPad.$record = function(arg) {
|
770
1066
|
|
771
1067
|
return this.record = arg
|
772
1068
|
};
|
773
1069
|
|
774
|
-
// line 10,
|
775
|
-
ScratchPad
|
1070
|
+
// line 10, opal-spec/scratch_pad, ScratchPad.<<
|
1071
|
+
ScratchPad['$<<'] = function(arg) {
|
776
1072
|
|
777
1073
|
if (this.record == null) this.record = nil;
|
778
1074
|
|
779
|
-
return this.record
|
1075
|
+
return this.record['$<<'](arg)
|
780
1076
|
};
|
781
1077
|
|
782
|
-
// line 14,
|
1078
|
+
// line 14, opal-spec/scratch_pad, ScratchPad.recorded
|
783
1079
|
ScratchPad.$recorded = function() {
|
784
1080
|
|
785
1081
|
if (this.record == null) this.record = nil;
|
786
1082
|
|
787
1083
|
return this.record
|
788
1084
|
};
|
789
|
-
;ScratchPad._sdonate(["$clear", "$record", "
|
1085
|
+
;ScratchPad._sdonate(["$clear", "$record", "$<<", "$recorded"]);
|
790
1086
|
})(self)
|
791
1087
|
})();
|
792
|
-
//
|
1088
|
+
// lib/opal-spec/version.rb
|
793
1089
|
(function() {
|
794
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __module = __opal.module;
|
795
|
-
|
1090
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm, __module = __opal.module;
|
1091
|
+
|
796
1092
|
return (function(__base){
|
797
|
-
// line 1,
|
1093
|
+
// line 1, opal-spec/version, module Spec
|
798
1094
|
function Spec() {};
|
799
1095
|
Spec = __module(__base, "Spec", Spec);
|
800
1096
|
var Spec_prototype = Spec.prototype, __scope = Spec._scope;
|
801
1097
|
|
802
|
-
__scope.VERSION = "0.1.
|
1098
|
+
__scope.VERSION = "0.1.15"
|
803
1099
|
|
804
1100
|
})(self)
|
805
1101
|
})();
|
806
|
-
//
|
1102
|
+
// lib/opal-spec.rb
|
807
1103
|
(function() {
|
808
|
-
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice;
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
1104
|
+
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __mm = __opal.mm;
|
1105
|
+
|
1106
|
+
//= require opal-spec/example;
|
1107
|
+
//= require opal-spec/example_group;
|
1108
|
+
//= require opal-spec/matchers;
|
1109
|
+
//= require opal-spec/runner;
|
1110
|
+
//= require opal-spec/scratch_pad;
|
1111
|
+
//= require opal-spec/expectations;
|
1112
|
+
//= require opal-spec/browser_formatter;
|
1113
|
+
//= require opal-spec/phantom_formatter;
|
1114
|
+
//= require opal-spec/kernel;
|
1115
|
+
return //= require opal-spec/version;
|
819
1116
|
})();
|