-
Notifications
You must be signed in to change notification settings - Fork 0
/
result.html
333 lines (284 loc) · 9.57 KB
/
result.html
1
2
3
4
5
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<!DOCTYPE html>
<html lang='en'>
<head>
<title>RSpec results</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="Pragma" content="no-cache" />
<style type="text/css">
body {
margin: 0;
padding: 0;
background: #fff;
font-size: 80%;
}
</style>
<script type="text/javascript">
// <![CDATA[
function addClass(element_id, classname) {
document.getElementById(element_id).className += (" " + classname);
}
function removeClass(element_id, classname) {
var elem = document.getElementById(element_id);
var classlist = elem.className.replace(classname,'');
elem.className = classlist;
}
function moveProgressBar(percentDone) {
document.getElementById("rspec-header").style.width = percentDone +"%";
}
function makeRed(element_id) {
removeClass(element_id, 'passed');
removeClass(element_id, 'not_implemented');
addClass(element_id,'failed');
}
function makeYellow(element_id) {
var elem = document.getElementById(element_id);
if (elem.className.indexOf("failed") == -1) { // class doesn't includes failed
if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
removeClass(element_id, 'passed');
addClass(element_id,'not_implemented');
}
}
}
function apply_filters() {
var passed_filter = document.getElementById('passed_checkbox').checked;
var failed_filter = document.getElementById('failed_checkbox').checked;
var pending_filter = document.getElementById('pending_checkbox').checked;
assign_display_style("example passed", passed_filter);
assign_display_style("example failed", failed_filter);
assign_display_style("example not_implemented", pending_filter);
assign_display_style_for_group("example_group passed", passed_filter);
assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
}
function get_display_style(display_flag) {
var style_mode = 'none';
if (display_flag == true) {
style_mode = 'block';
}
return style_mode;
}
function assign_display_style(classname, display_flag) {
var style_mode = get_display_style(display_flag);
var elems = document.getElementsByClassName(classname)
for (var i=0; i<elems.length;i++) {
elems[i].style.display = style_mode;
}
}
function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
var display_style_mode = get_display_style(display_flag);
var subgroup_style_mode = get_display_style(subgroup_flag);
var elems = document.getElementsByClassName(classname)
for (var i=0; i<elems.length;i++) {
var style_mode = display_style_mode;
if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
elems[i].style.display = subgroup_style_mode;
} else {
elems[i].style.display = display_style_mode;
}
}
}
// ]]>
</script>
<style type="text/css">
#rspec-header {
background: #65C400; color: #fff; height: 4em;
}
.rspec-report h1 {
margin: 0px 10px 0px 10px;
padding: 10px;
font-family: "Lucida Grande", Helvetica, sans-serif;
font-size: 1.8em;
position: absolute;
}
#label {
float:left;
}
#display-filters {
float:left;
padding: 28px 0 0 40%;
font-family: "Lucida Grande", Helvetica, sans-serif;
}
#summary {
float:right;
padding: 5px 10px;
font-family: "Lucida Grande", Helvetica, sans-serif;
text-align: right;
}
#summary p {
margin: 0 0 0 2px;
}
#summary #totals {
font-size: 1.2em;
}
.example_group {
margin: 0 10px 5px;
background: #fff;
}
dl {
margin: 0; padding: 0 0 5px;
font: normal 11px "Lucida Grande", Helvetica, sans-serif;
}
dt {
padding: 3px;
background: #65C400;
color: #fff;
font-weight: bold;
}
dd {
margin: 5px 0 5px 5px;
padding: 3px 3px 3px 18px;
}
dd .duration {
padding-left: 5px;
text-align: right;
right: 0px;
float:right;
}
dd.example.passed {
border-left: 5px solid #65C400;
border-bottom: 1px solid #65C400;
background: #DBFFB4; color: #3D7700;
}
dd.example.not_implemented {
border-left: 5px solid #FAF834;
border-bottom: 1px solid #FAF834;
background: #FCFB98; color: #131313;
}
dd.example.pending_fixed {
border-left: 5px solid #0000C2;
border-bottom: 1px solid #0000C2;
color: #0000C2; background: #D3FBFF;
}
dd.example.failed {
border-left: 5px solid #C20000;
border-bottom: 1px solid #C20000;
color: #C20000; background: #FFFBD3;
}
dt.not_implemented {
color: #000000; background: #FAF834;
}
dt.pending_fixed {
color: #FFFFFF; background: #C40D0D;
}
dt.failed {
color: #FFFFFF; background: #C40D0D;
}
#rspec-header.not_implemented {
color: #000000; background: #FAF834;
}
#rspec-header.pending_fixed {
color: #FFFFFF; background: #C40D0D;
}
#rspec-header.failed {
color: #FFFFFF; background: #C40D0D;
}
.backtrace {
color: #000;
font-size: 12px;
}
a {
color: #BE5C00;
}
/* Ruby code, style similar to vibrant ink */
.ruby {
font-size: 12px;
font-family: monospace;
color: white;
background-color: black;
padding: 0.1em 0 0.2em 0;
}
.ruby .keyword { color: #FF6600; }
.ruby .constant { color: #339999; }
.ruby .attribute { color: white; }
.ruby .global { color: white; }
.ruby .module { color: white; }
.ruby .class { color: white; }
.ruby .string { color: #66FF00; }
.ruby .ident { color: white; }
.ruby .method { color: #FFCC00; }
.ruby .number { color: white; }
.ruby .char { color: white; }
.ruby .comment { color: #9933CC; }
.ruby .symbol { color: white; }
.ruby .regex { color: #44B4CC; }
.ruby .punct { color: white; }
.ruby .escape { color: white; }
.ruby .interp { color: white; }
.ruby .expr { color: white; }
.ruby .offending { background-color: gray; }
.ruby .linenum {
width: 75px;
padding: 0.1em 1em 0.2em 0;
color: #000000;
background-color: #FFFBD3;
}
</style>
</head>
<body>
<div class="rspec-report">
<div id="rspec-header">
<div id="label">
<h1>RSpec Code Examples</h1>
</div>
<div id="display-filters">
<input id="passed_checkbox" name="passed_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
<input id="failed_checkbox" name="failed_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
<input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
</div>
<div id="summary">
<p id="totals"> </p>
<p id="duration"> </p>
</div>
</div>
<div class="results">
<div id="div_group_1" class="example_group passed">
<dl style="margin-left: 0px;">
<dt id="example_group_1" class="passed">a playing card</dt>
<script type="text/javascript">makeRed('rspec-header');</script>
<script type="text/javascript">makeRed('div_group_1');</script>
<script type="text/javascript">makeRed('example_group_1');</script>
<script type="text/javascript">moveProgressBar('50.0');</script>
<dd class="example failed">
<span class="failed_spec_name">has a suit</span>
<span class="duration">0.00012s</span>
<div class="failure" id="failure_1">
<div class="message"><pre> Failure/Error: raise unless Card.new(suit: :spades, rank: 4).suit == :spades
NoMethodError:
undefined method `suit' for #<Card:0x00007fdf288e53f0 @suit=:spades, @rank=4>
# ./card.rb:17:in `block (2 levels) in <top (required)>'</pre></div>
<div class="backtrace"><pre>./card.rb:17:in `block (2 levels) in <top (required)>'</pre></div>
<pre class="ruby"><code><span class="linenum">15</span>RSpec.describe 'a playing card' do
<span class="linenum">16</span> it 'has a suit' do
<span class="offending"><span class="linenum">17</span> raise unless Card.new(suit: :spades, rank: 4).suit == :spades</span>
<span class="linenum">18</span> end
<span class="linenum">19</span> it 'has a rank' do
<span class="linenum">20</span><span class="comment"># Install the coderay gem to get syntax highlighting</span></code></pre>
</div>
</dd>
<script type="text/javascript">moveProgressBar('100.0');</script>
<dd class="example failed">
<span class="failed_spec_name">has a rank</span>
<span class="duration">0.00014s</span>
<div class="failure" id="failure_2">
<div class="message"><pre> Failure/Error: raise unless Card.new(suit: :spades, rank: 4).rank == 4
NoMethodError:
undefined method `rank' for #<Card:0x00007fdf2a107a00 @suit=:spades, @rank=4>
# ./card.rb:20:in `block (2 levels) in <top (required)>'</pre></div>
<div class="backtrace"><pre>./card.rb:20:in `block (2 levels) in <top (required)>'</pre></div>
<pre class="ruby"><code><span class="linenum">18</span> end
<span class="linenum">19</span> it 'has a rank' do
<span class="offending"><span class="linenum">20</span> raise unless Card.new(suit: :spades, rank: 4).rank == 4</span>
<span class="linenum">21</span> end
<span class="linenum">22</span>
<span class="linenum">23</span><span class="comment"># Install the coderay gem to get syntax highlighting</span></code></pre>
</div>
</dd>
</dl>
</div>
<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>0.03017 seconds</strong>";</script>
<script type="text/javascript">document.getElementById('totals').innerHTML = "2 examples, 2 failures";</script>
</div>
</div>
</body>
</html>