turnip_formatter 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/turnip_formatter/ext/turnip/rspec.rb +2 -6
- data/lib/turnip_formatter/formatter.css +2 -2
- data/lib/turnip_formatter/formatter.scss +2 -2
- data/lib/turnip_formatter/scenario.rb +2 -3
- data/lib/turnip_formatter/step/failure.rb +9 -9
- data/lib/turnip_formatter/step/pending.rb +7 -7
- data/lib/turnip_formatter/template.rb +27 -22
- data/lib/turnip_formatter/version.rb +1 -1
- metadata +2 -8
@@ -16,10 +16,6 @@ module Turnip
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def initialize_scenario_metadata
|
20
|
-
example.metadata[:turnip] = { steps: [] }
|
21
|
-
end
|
22
|
-
|
23
19
|
def push_scenario_metadata(scenario)
|
24
20
|
steps = scenario.steps
|
25
21
|
example.metadata[:turnip].tap do |turnip|
|
@@ -45,12 +41,12 @@ module Turnip
|
|
45
41
|
|
46
42
|
before do
|
47
43
|
example.metadata[:file_path] = feature_file
|
48
|
-
|
44
|
+
example.metadata[:turnip] = { steps: [], tags: [] }
|
49
45
|
|
50
46
|
feature.backgrounds.each do |background|
|
51
47
|
push_scenario_metadata(background)
|
52
48
|
end
|
53
|
-
|
49
|
+
|
54
50
|
background_steps.each.with_index do |step, index|
|
55
51
|
run_step(feature_file, step, index)
|
56
52
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
body {
|
2
|
-
background-color: #
|
2
|
+
background-color: #ffffff; }
|
3
3
|
|
4
4
|
div#report {
|
5
5
|
margin: 0 auto;
|
@@ -17,7 +17,7 @@ footer {
|
|
17
17
|
div#main {
|
18
18
|
margin: 0 auto;
|
19
19
|
padding: 2em;
|
20
|
-
background-color: #
|
20
|
+
background-color: #ffffff; }
|
21
21
|
div#main .ui-tabs-nav {
|
22
22
|
border-width: 0;
|
23
23
|
padding: 0; }
|
@@ -42,7 +42,7 @@ $gray-background: #DDDDDD;
|
|
42
42
|
}
|
43
43
|
|
44
44
|
body {
|
45
|
-
background-color: #
|
45
|
+
background-color: #ffffff;
|
46
46
|
}
|
47
47
|
|
48
48
|
div#report {
|
@@ -60,7 +60,7 @@ footer {
|
|
60
60
|
|
61
61
|
div#main {
|
62
62
|
@include content_centering;
|
63
|
-
background-color: #
|
63
|
+
background-color: #ffffff;
|
64
64
|
|
65
65
|
.ui-tabs-nav {
|
66
66
|
border-width: 0;
|
@@ -31,7 +31,7 @@ module TurnipFormatter
|
|
31
31
|
def id
|
32
32
|
"step_" + object_id.to_s
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
#
|
36
36
|
# @return [String] scenario name
|
37
37
|
#
|
@@ -78,8 +78,7 @@ module TurnipFormatter
|
|
78
78
|
def clean_backtrace
|
79
79
|
return if example.exception.nil?
|
80
80
|
formatted = format_backtrace(example.exception.backtrace, example.metadata)
|
81
|
-
|
82
|
-
example.exception.set_backtrace(new_backtrace)
|
81
|
+
example.exception.set_backtrace(formatted)
|
83
82
|
end
|
84
83
|
end
|
85
84
|
end
|
@@ -6,7 +6,7 @@ module TurnipFormatter
|
|
6
6
|
class Step
|
7
7
|
module Failure
|
8
8
|
extend DSL
|
9
|
-
|
9
|
+
|
10
10
|
def self.status
|
11
11
|
:failure
|
12
12
|
end
|
@@ -14,14 +14,14 @@ module TurnipFormatter
|
|
14
14
|
def status
|
15
15
|
Failure.status
|
16
16
|
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
end
|
18
|
+
add_template :source do
|
19
|
+
example.exception.backtrace.first
|
20
|
+
end
|
24
21
|
|
25
|
-
|
26
|
-
|
22
|
+
add_template :exception do
|
23
|
+
example.exception
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
27
|
end
|
@@ -14,13 +14,13 @@ module TurnipFormatter
|
|
14
14
|
def status
|
15
15
|
Pending.status
|
16
16
|
end
|
17
|
+
|
18
|
+
add_template :exception do
|
19
|
+
message = example.execution_result[:pending_message]
|
20
|
+
exception = RSpec::Core::Pending::PendingDeclaredInExample.new(message)
|
21
|
+
exception.set_backtrace(example.location)
|
22
|
+
exception
|
23
|
+
end
|
17
24
|
end
|
18
25
|
end
|
19
26
|
end
|
20
|
-
|
21
|
-
TurnipFormatter::Step::Pending.add_template :exception do
|
22
|
-
message = example.execution_result[:pending_message]
|
23
|
-
exception = RSpec::Core::Pending::PendingDeclaredInExample.new(message)
|
24
|
-
exception.set_backtrace(example.location)
|
25
|
-
exception
|
26
|
-
end
|
@@ -36,7 +36,7 @@ module TurnipFormatter
|
|
36
36
|
$(function() {
|
37
37
|
var scenarioHeader = 'section.scenario header';
|
38
38
|
$(scenarioHeader).siblings().hide();
|
39
|
-
|
39
|
+
|
40
40
|
/**
|
41
41
|
* Step folding/expanding
|
42
42
|
*/
|
@@ -44,13 +44,13 @@ module TurnipFormatter
|
|
44
44
|
var steps = $(this).siblings();
|
45
45
|
steps.slideToggle();
|
46
46
|
});
|
47
|
-
|
47
|
+
|
48
48
|
/**
|
49
49
|
* All step folding/expanding action
|
50
50
|
*/
|
51
51
|
$('#scenario_display_check').change(function() {
|
52
52
|
var steps = $(scenarioHeader).siblings();
|
53
|
-
|
53
|
+
|
54
54
|
if (this.checked) {
|
55
55
|
steps.slideUp();
|
56
56
|
} else {
|
@@ -73,7 +73,7 @@ module TurnipFormatter
|
|
73
73
|
*/
|
74
74
|
var tab_area = 'div#main';
|
75
75
|
$(tab_area).tabs();
|
76
|
-
|
76
|
+
|
77
77
|
$('div#speed-statistics a').click(function() {
|
78
78
|
$(tab_area).tabs("option", "active", 0);
|
79
79
|
});
|
@@ -108,7 +108,7 @@ module TurnipFormatter
|
|
108
108
|
def print_main_footer(total_count, failed_count, pending_count, total_time)
|
109
109
|
update_report_js_tmp = '<script type="text/javascript">document.getElementById("%s").innerHTML = "%s";</script>'
|
110
110
|
update_report_js = ''
|
111
|
-
|
111
|
+
|
112
112
|
%w{ total_count failed_count pending_count total_time }.each do |key|
|
113
113
|
update_report_js += update_report_js_tmp % [key, eval(key)]
|
114
114
|
end
|
@@ -163,12 +163,7 @@ module TurnipFormatter
|
|
163
163
|
end
|
164
164
|
|
165
165
|
def print_runtime_error(example, exception)
|
166
|
-
|
167
|
-
example_backtrace = format_backtrace(example.exception.backtrace[0..14], example.metadata).map do |l|
|
168
|
-
RSpec::Core::Metadata::relative_path(l)
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
166
|
+
exception.set_backtrace(format_backtrace(exception.backtrace))
|
172
167
|
template_exception.result(binding)
|
173
168
|
end
|
174
169
|
|
@@ -229,7 +224,7 @@ module TurnipFormatter
|
|
229
224
|
<label for="failed_check">Failed</label><input type="checkbox" checked id="failed_check">
|
230
225
|
<label for="pending_check">Pending</label><input type="checkbox" checked id="pending_check">
|
231
226
|
</section>
|
232
|
-
|
227
|
+
|
233
228
|
<section class="result">
|
234
229
|
<p>
|
235
230
|
<span id="total_count"></span> Scenario (<span id="failed_count"></span> failed <span id="pending_count"></span> pending).
|
@@ -282,24 +277,21 @@ module TurnipFormatter
|
|
282
277
|
<section class="exception">
|
283
278
|
<h1>TurnipFormatter RuntimeError</h1>
|
284
279
|
<dl>
|
285
|
-
<dt>Exception</dt>
|
280
|
+
<dt>Runtime Exception</dt>
|
286
281
|
<dd><%= h(exception.to_s) %></dd>
|
287
282
|
|
283
|
+
<dt>Runtime Exception Backtrace</dt>
|
284
|
+
<%= template_exception_backtrace(exception) %>
|
285
|
+
|
288
286
|
<dt>Example Full Description</dt>
|
289
287
|
<dd><%= h(example.metadata[:full_description]) %></dd>
|
290
288
|
|
291
289
|
<% if example.exception %>
|
292
290
|
<dt>Example Exception</dt>
|
293
291
|
<dd><%= h(example.exception.to_s) %></dd>
|
294
|
-
|
295
|
-
<dt>Backtrace
|
296
|
-
|
297
|
-
<ol>
|
298
|
-
<% example_backtrace.each do |line| %>
|
299
|
-
<li><%= h(line) %></li>
|
300
|
-
<% end %>
|
301
|
-
</ol>
|
302
|
-
</dd>
|
292
|
+
|
293
|
+
<dt>Example Backtrace</dt>
|
294
|
+
<%= template_exception_backtrace(example.exception) %>
|
303
295
|
<% end %>
|
304
296
|
|
305
297
|
<% if example.pending %>
|
@@ -310,5 +302,18 @@ module TurnipFormatter
|
|
310
302
|
</section>
|
311
303
|
EOS
|
312
304
|
end
|
305
|
+
|
306
|
+
def template_exception_backtrace(exception)
|
307
|
+
@template_exception_backtrace ||= ERB.new(<<-EOS)
|
308
|
+
<dd>
|
309
|
+
<ol>
|
310
|
+
<% exception.backtrace.each do |line| %>
|
311
|
+
<li><%= h(line) %></li>
|
312
|
+
<% end %>
|
313
|
+
</ol>
|
314
|
+
</dd>
|
315
|
+
EOS
|
316
|
+
@template_exception_backtrace.result(binding)
|
317
|
+
end
|
313
318
|
end
|
314
319
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turnip_formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: turnip
|
@@ -181,18 +181,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
181
|
- - ! '>='
|
182
182
|
- !ruby/object:Gem::Version
|
183
183
|
version: '0'
|
184
|
-
segments:
|
185
|
-
- 0
|
186
|
-
hash: 835368190807014694
|
187
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
185
|
none: false
|
189
186
|
requirements:
|
190
187
|
- - ! '>='
|
191
188
|
- !ruby/object:Gem::Version
|
192
189
|
version: '0'
|
193
|
-
segments:
|
194
|
-
- 0
|
195
|
-
hash: 835368190807014694
|
196
190
|
requirements: []
|
197
191
|
rubyforge_project:
|
198
192
|
rubygems_version: 1.8.23
|