cornucopia 0.1.14 → 0.1.15
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.
- checksums.yaml +4 -4
- data/README.md +3 -13
- data/lib/cornucopia/cucumber_hooks.rb +3 -1
- data/lib/cornucopia/rspec_hooks.rb +12 -9
- data/lib/cornucopia/source_files/cornucopia.css +73 -2
- data/lib/cornucopia/source_files/report.js +17 -0
- data/lib/cornucopia/source_files/report_holder.html +22 -0
- data/lib/cornucopia/spinach_hooks.rb +6 -0
- data/lib/cornucopia/util/configured_report.rb +9 -23
- data/lib/cornucopia/util/file_asset.rb +8 -0
- data/lib/cornucopia/util/report_builder.rb +155 -10
- data/lib/cornucopia/version.rb +1 -1
- data/spec/lib/capybara/finder_diagnostics_spec.rb +288 -233
- data/spec/lib/capybara/page_diagnostics_spec.rb +7 -7
- data/spec/lib/util/configured_report_spec.rb +3 -3
- data/spec/lib/util/log_capture_spec.rb +3 -3
- data/spec/lib/util/report_builder_spec.rb +398 -50
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bbf7f8abccf3fce5d307ac06dd1215471b3b3a0
|
4
|
+
data.tar.gz: 32a60a2590a58d37617092b6fef5961f1cf05e14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16810c0c3b197e50db0bb2331492786af365d607fadd96d6f2ad91687304128b8577d938cfdb2857ac5c63c3ba074c4e5f8fd0eb6bb1175a9d0dd71a5c1a5c8f
|
7
|
+
data.tar.gz: db32c9f9023bec3fdf6cd404c0d43d0c7fa8e0ab6893dc5f2a49e7ef50ed0b98a7005b4bf34b9bf9c50295fc7b845f10e0913e38b115206b9ca1c3aaf7dc54ac
|
data/README.md
CHANGED
@@ -360,22 +360,12 @@ report files.
|
|
360
360
|
|
361
361
|
## Todos...
|
362
362
|
|
363
|
-
ReportBuilder - delayed reports
|
364
|
-
@delayed_reports = { key: { report_name: "", report_table: ReportTable.new do || end} }
|
365
|
-
finder diagnostics - within sub-report. delayed_report?
|
366
|
-
ReportBuilder - reports by test with multiple sub-reports
|
367
|
-
Instead of delayed reports?
|
368
|
-
ReportBuilder - reformat and styling of report?
|
369
|
-
ReportBuilder - Each test in separate files so we can create a report with a list of failed tests in case there are a
|
370
|
-
lot of them.
|
371
|
-
Instead of delayed reports?
|
372
|
-
Hooks to add stuff to reports
|
373
|
-
Add own section to report for test
|
374
|
-
Option/way to make new section a more-details section
|
375
363
|
SitePrism override section, element, sections and elements command to allow parameters to be passed in as additional
|
376
364
|
options.
|
377
365
|
functions to override:
|
378
366
|
main function (name)
|
379
367
|
has_
|
380
368
|
???
|
381
|
-
Make configuration a singleton
|
369
|
+
Make configuration a singleton
|
370
|
+
SitePrism work with Capybara::Node::Simple
|
371
|
+
ReportBuilder - reformat and styling of report?
|
@@ -10,7 +10,9 @@ Around do |scenario, block|
|
|
10
10
|
|
11
11
|
Cornucopia::Capybara::FinderDiagnostics::FindAction.start_test
|
12
12
|
|
13
|
-
|
13
|
+
Cornucopia::Util::ReportBuilder.current_report.within_test("#{scenario.feature.title} : #{scenario.title}") do
|
14
|
+
block.call
|
15
|
+
end
|
14
16
|
|
15
17
|
if scenario.failed?
|
16
18
|
seed_value = scenario.instance_variable_get(:@seed_value)
|
@@ -22,19 +22,22 @@ RSpec.configure do |config|
|
|
22
22
|
|
23
23
|
Cornucopia::Capybara::FinderDiagnostics::FindAction.start_test
|
24
24
|
|
25
|
-
example.run
|
26
|
-
|
27
25
|
test_example = example.example if example.respond_to?(:example)
|
28
26
|
test_example ||= self.example if self.respond_to?(:example)
|
29
|
-
if (test_example.exception)
|
30
|
-
puts ("random seed for testing was: #{@seed_value}")
|
31
27
|
|
32
|
-
|
33
|
-
|
34
|
-
|
28
|
+
Cornucopia::Util::ReportBuilder.current_report.within_test(test_example.full_description) do
|
29
|
+
example.run
|
30
|
+
|
31
|
+
if (test_example.exception)
|
32
|
+
puts ("random seed for testing was: #{@seed_value}")
|
33
|
+
|
34
|
+
Cornucopia::Util::ReportBuilder.current_report.
|
35
|
+
within_section("Test Error: #{test_example.full_description}") do |report|
|
36
|
+
configured_report = Cornucopia::Util::Configuration.report_configuration :rspec
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
+
configured_report.add_report_objects example: test_example, rspec: RSpec
|
39
|
+
configured_report.generate_report(report)
|
40
|
+
end
|
38
41
|
end
|
39
42
|
end
|
40
43
|
end
|
@@ -36,12 +36,14 @@
|
|
36
36
|
display: table-row;
|
37
37
|
}
|
38
38
|
|
39
|
-
|
39
|
+
/*.cornucopia-section:nth-child(2n),*/
|
40
|
+
.cornucopia-section.cornucopia-even
|
40
41
|
{
|
41
42
|
background-color: steelblue;
|
42
43
|
}
|
43
44
|
|
44
|
-
|
45
|
+
/*.cornucopia-section:nth-child(2n +1),*/
|
46
|
+
.cornucopia-section.cornucopia-odd
|
45
47
|
{
|
46
48
|
background-color: powderblue;
|
47
49
|
}
|
@@ -113,6 +115,11 @@
|
|
113
115
|
position: relative;
|
114
116
|
}
|
115
117
|
|
118
|
+
.cornucopia-end-section
|
119
|
+
{
|
120
|
+
clear: left;
|
121
|
+
}
|
122
|
+
|
116
123
|
.cornucopia-section-image
|
117
124
|
{
|
118
125
|
margin-bottom: 10px;
|
@@ -149,6 +156,27 @@
|
|
149
156
|
color: red
|
150
157
|
}
|
151
158
|
|
159
|
+
.report-index-list li
|
160
|
+
{
|
161
|
+
padding-bottom: 5px;
|
162
|
+
margin-bottom: 5px;
|
163
|
+
border-bottom-style: solid;
|
164
|
+
border-bottom-color: lightgrey;
|
165
|
+
border-bottom-width: thin;
|
166
|
+
}
|
167
|
+
|
168
|
+
.report-index-list li:last-child
|
169
|
+
{
|
170
|
+
border-bottom-style: none;
|
171
|
+
}
|
172
|
+
|
173
|
+
.report-index-list
|
174
|
+
{
|
175
|
+
list-style-type: none;
|
176
|
+
margin-bottom: 10px;
|
177
|
+
padding-left: 5px;
|
178
|
+
}
|
179
|
+
|
152
180
|
.index-list
|
153
181
|
{
|
154
182
|
list-style-type: none;
|
@@ -159,4 +187,47 @@
|
|
159
187
|
.padded-frame
|
160
188
|
{
|
161
189
|
padding-right: 10px;
|
190
|
+
}
|
191
|
+
|
192
|
+
.coruncopia-report-holder-table
|
193
|
+
{
|
194
|
+
display: table;
|
195
|
+
height: 100%;
|
196
|
+
width: 100%;
|
197
|
+
}
|
198
|
+
|
199
|
+
.coruncopia-report-holder-row
|
200
|
+
{
|
201
|
+
display: table-row;
|
202
|
+
height: 100%;
|
203
|
+
}
|
204
|
+
|
205
|
+
.coruncopia-report-holder-list-cell
|
206
|
+
{
|
207
|
+
display: table-cell;
|
208
|
+
height: 100%;
|
209
|
+
vertical-align: top;
|
210
|
+
padding-right: 5px;
|
211
|
+
}
|
212
|
+
|
213
|
+
.coruncopia-report-holder-list-holder
|
214
|
+
{
|
215
|
+
margin: 0px;
|
216
|
+
padding: 0px;
|
217
|
+
overflow-y: scroll;
|
218
|
+
}
|
219
|
+
|
220
|
+
.coruncopia-report-body-cell
|
221
|
+
{
|
222
|
+
display: table-cell;
|
223
|
+
width: 100%;
|
224
|
+
height: 100%;
|
225
|
+
}
|
226
|
+
|
227
|
+
.coruncopia-report-body-frame
|
228
|
+
{
|
229
|
+
float: right;
|
230
|
+
width: 100%;
|
231
|
+
height: 100%;
|
232
|
+
border-style: none;
|
162
233
|
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
last_scroll_top = null;
|
2
|
+
|
3
|
+
function show_sub_report (event_obj)
|
4
|
+
{
|
5
|
+
if (!(event_obj.shiftKey || event_obj.ctrlKey || event_obj.metaKey || event_obj.altKey))
|
6
|
+
{
|
7
|
+
link_item = $ (event_obj.target);
|
8
|
+
$("#report-display-document").attr("src", link_item.attr ("href"))
|
9
|
+
event_obj.preventDefault();
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
$ (document).ready (function ()
|
14
|
+
{
|
15
|
+
$ (document).on ("click", "a.coruncopia-report-link", {}, show_sub_report);
|
16
|
+
}
|
17
|
+
);
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<html>
|
2
|
+
<header><title>%{report_title}</title></header>
|
3
|
+
<body>
|
4
|
+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
5
|
+
<link href="cornucopia.css" rel="stylesheet" type="text/css" />
|
6
|
+
<div class="coruncopia-report-holder-table">
|
7
|
+
<div class="coruncopia-report-holder-row">
|
8
|
+
<div class="coruncopia-report-holder-list-cell">
|
9
|
+
<!--<div class=".coruncopia-report-holder-list-holder">-->
|
10
|
+
<ul class="report-index-list">
|
11
|
+
%{report_list}
|
12
|
+
</ul>
|
13
|
+
<!--</div>-->
|
14
|
+
</div>
|
15
|
+
<div class="coruncopia-report-body-cell">
|
16
|
+
<iframe class="coruncopia-report-body-frame" id="report-display-document" src=""></iframe>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
<script src="report.js"></script>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -2,6 +2,12 @@ require ::File.expand_path("../cornucopia", File.dirname(__FILE__))
|
|
2
2
|
load ::File.expand_path("capybara/install_finder_extensions.rb", File.dirname(__FILE__))
|
3
3
|
load ::File.expand_path("site_prism/install_element_extensions.rb", File.dirname(__FILE__))
|
4
4
|
|
5
|
+
Spinach.hooks.around_scenario do |scenario_data, step_definitions, &block|
|
6
|
+
Cornucopia::Util::ReportBuilder.current_report.within_test("#{scenario_data.feature.name} : #{scenario_data.name}") do
|
7
|
+
block.call
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
5
11
|
Spinach.hooks.before_scenario do |scenario, step_definitions|
|
6
12
|
@running_scenario = scenario
|
7
13
|
seed_value = Cornucopia::Util::Configuration.seed ||
|
@@ -159,34 +159,20 @@ module Cornucopia
|
|
159
159
|
options_report_table = options.delete(:report_table)
|
160
160
|
[@min_fields, @more_info_fields].each do |export_field_list|
|
161
161
|
if export_field_list
|
162
|
-
table_pre
|
163
|
-
|
164
|
-
|
162
|
+
table_pre = false
|
163
|
+
table_function = :within_table
|
165
164
|
if @min_fields != export_field_list && !options_report_table
|
166
165
|
options_report_table = nil
|
166
|
+
table_pre = true
|
167
167
|
|
168
|
-
|
169
|
-
table_pre << " <div class=\"cornucopia-table\">\n"
|
170
|
-
table_pre << " <div class=\"cornucopia-row\">\n"
|
171
|
-
table_pre << " <div class=\"cornucopia-cell-data\">\n"
|
172
|
-
table_pre << " <a class =\"cornucopia-additional-details\" href=\"#\">More Details...</a>\n"
|
173
|
-
table_pre << " </div>\n"
|
174
|
-
table_pre << " </div>\n"
|
175
|
-
table_pre << " </div>\n"
|
176
|
-
table_pre << " <div class=\"cornucopia-additional-details hidden\">\n"
|
177
|
-
table_pre.html_safe
|
178
|
-
table_post = " </div>\n"
|
179
|
-
table_post << "</div>\n"
|
180
|
-
table_post.html_safe
|
168
|
+
table_function = :within_hidden_table
|
181
169
|
end
|
182
170
|
|
183
|
-
report.
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
not_a_table: table_pre,
|
189
|
-
suppress_blank_table: table_pre) do |outer_report_table|
|
171
|
+
report.send(table_function,
|
172
|
+
report_table: options_report_table,
|
173
|
+
nested_table: options.delete(:nested_table),
|
174
|
+
nested_table_label: options.delete(:nested_table_label)
|
175
|
+
) do |outer_report_table|
|
190
176
|
Cornucopia::Util::ReportTable.new(
|
191
177
|
report_table: table_pre ? nil : outer_report_table,
|
192
178
|
nested_table: outer_report_table,
|
@@ -17,6 +17,14 @@ module Cornucopia
|
|
17
17
|
@asset_body = asset_body
|
18
18
|
end
|
19
19
|
|
20
|
+
def body
|
21
|
+
unless @asset_body
|
22
|
+
self.source_file = path
|
23
|
+
end
|
24
|
+
|
25
|
+
@asset_body
|
26
|
+
end
|
27
|
+
|
20
28
|
def source_file=(source_file_name)
|
21
29
|
# We read the file into memory in case the file moves or is temporary.
|
22
30
|
@asset_body = File.read(source_file_name)
|
@@ -152,7 +152,8 @@ module Cornucopia
|
|
152
152
|
section << "</h4>\n".html_safe
|
153
153
|
section << " <ul class=\"index-list\">\n".html_safe
|
154
154
|
|
155
|
-
section_items.
|
155
|
+
section << Cornucopia::Util::ReportBuilder.build_index_section_item(section_items.shift)
|
156
|
+
section_items.reverse.each do |section_item|
|
156
157
|
section << Cornucopia::Util::ReportBuilder.build_index_section_item(section_item)
|
157
158
|
end
|
158
159
|
|
@@ -193,6 +194,11 @@ module Cornucopia
|
|
193
194
|
def initialize(folder_name = nil, parent_folder = nil)
|
194
195
|
@parent_folder_name = parent_folder || Cornucopia::Util::Configuration.base_folder
|
195
196
|
@base_folder_name = folder_name || Cornucopia::Util::Configuration.base_folder
|
197
|
+
@report_title = folder_name || Cornucopia::Util::Configuration.base_folder
|
198
|
+
@test_name = "unknown_test"
|
199
|
+
@section_number = 0
|
200
|
+
@test_number = 0
|
201
|
+
@report_body = "".html_safe
|
196
202
|
end
|
197
203
|
|
198
204
|
# This does nothing in a normal report because reports are built as you go.
|
@@ -211,14 +217,13 @@ module Cornucopia
|
|
211
217
|
end
|
212
218
|
end
|
213
219
|
|
214
|
-
if File.exists?(
|
220
|
+
if File.exists?(report_base_page_name)
|
215
221
|
if Cornucopia::Util::Configuration.open_report_after_generation(@base_folder_name)
|
216
222
|
# `open #{report_base_page_name}` rescue nil
|
217
223
|
system("open #{report_base_page_name}") rescue nil
|
218
224
|
end
|
219
225
|
else
|
220
|
-
|
221
|
-
File.open(report_contents_page_name, "a:UTF-8") do |write_file|
|
226
|
+
open_report_contents_file do |write_file|
|
222
227
|
write_file.write %Q[<p class=\"cornucopia-no-errors\">No Errors to report</p>]
|
223
228
|
write_file.write "\n"
|
224
229
|
end
|
@@ -244,6 +249,15 @@ module Cornucopia
|
|
244
249
|
@report_folder_name
|
245
250
|
end
|
246
251
|
|
252
|
+
def report_test_folder_name
|
253
|
+
unless @report_test_folder_name
|
254
|
+
@test_number += 1
|
255
|
+
@report_test_folder_name = File.join(report_folder_name, "test_#{@test_number}")
|
256
|
+
end
|
257
|
+
|
258
|
+
@report_test_folder_name
|
259
|
+
end
|
260
|
+
|
247
261
|
def index_folder_name
|
248
262
|
unless @index_folder_name
|
249
263
|
@index_folder_name = File.join(Cornucopia::Util::ReportBuilder.root_folder, "#{@parent_folder_name}/")
|
@@ -342,6 +356,23 @@ module Cornucopia
|
|
342
356
|
end
|
343
357
|
end
|
344
358
|
|
359
|
+
def rebuild_report_holder_page
|
360
|
+
initialize_report_files
|
361
|
+
|
362
|
+
report_folder = report_folder_name
|
363
|
+
|
364
|
+
FileUtils.mkdir_p report_folder_name
|
365
|
+
FileUtils.rm_rf report_base_page_name
|
366
|
+
|
367
|
+
report_holder_body = FileAsset.asset("report_holder.html").body
|
368
|
+
FileAsset.asset("report.js").add_file(File.join(report_folder, "report.js"))
|
369
|
+
FileAsset.asset("cornucopia.css").add_file(File.join(report_folder, "cornucopia.css"))
|
370
|
+
|
371
|
+
File.open(File.join(report_folder, "index.html"), "w+") do |write_file|
|
372
|
+
write_file << report_holder_body % { report_list: @report_body, report_title: @report_title }
|
373
|
+
end
|
374
|
+
end
|
375
|
+
|
345
376
|
def report_base_page_name
|
346
377
|
File.join(report_folder_name, "index.html")
|
347
378
|
end
|
@@ -350,6 +381,14 @@ module Cornucopia
|
|
350
381
|
File.join(report_folder_name, "report_contents.html")
|
351
382
|
end
|
352
383
|
|
384
|
+
def report_test_base_page_name
|
385
|
+
File.join(report_test_folder_name, "index.html")
|
386
|
+
end
|
387
|
+
|
388
|
+
def report_test_contents_page_name
|
389
|
+
File.join(report_test_folder_name, "report_contents.html")
|
390
|
+
end
|
391
|
+
|
353
392
|
def index_base_page_name
|
354
393
|
File.join(index_folder_name, "index.html")
|
355
394
|
end
|
@@ -358,12 +397,28 @@ module Cornucopia
|
|
358
397
|
File.join(index_folder_name, "report_contents.html")
|
359
398
|
end
|
360
399
|
|
361
|
-
def initialize_report_files
|
400
|
+
def initialize_report_files
|
401
|
+
support_folder_name = report_folder_name
|
402
|
+
|
403
|
+
FileUtils.mkdir_p @report_folder_name
|
404
|
+
|
405
|
+
unless File.exists?(report_base_page_name)
|
406
|
+
# use a different base index file.
|
407
|
+
FileAsset.asset("report_holder.html").add_file(File.join(support_folder_name, "index.html"))
|
408
|
+
rebuild_index_page
|
409
|
+
end
|
410
|
+
|
411
|
+
FileAsset.asset("report.js").add_file(File.join(support_folder_name, "report.js"))
|
412
|
+
FileAsset.asset("cornucopia.css").add_file(File.join(support_folder_name, "cornucopia.css"))
|
413
|
+
end
|
414
|
+
|
415
|
+
def initialize_basic_report_files
|
362
416
|
support_folder_name = report_folder_name
|
363
417
|
|
364
418
|
FileUtils.mkdir_p @report_folder_name
|
365
419
|
|
366
420
|
unless File.exists?(report_base_page_name)
|
421
|
+
# use a different base index file.
|
367
422
|
FileAsset.asset("report_base.html").add_file(File.join(support_folder_name, "index.html"))
|
368
423
|
rebuild_index_page
|
369
424
|
end
|
@@ -375,27 +430,117 @@ module Cornucopia
|
|
375
430
|
FileAsset.asset("cornucopia.css").add_file(File.join(support_folder_name, "cornucopia.css"))
|
376
431
|
end
|
377
432
|
|
433
|
+
def test_list_item
|
434
|
+
if @test_list_item
|
435
|
+
nil
|
436
|
+
else
|
437
|
+
folder_name = File.basename(report_test_folder_name)
|
438
|
+
|
439
|
+
@test_list_item = "<li>\n".html_safe
|
440
|
+
@test_list_item += "<a class=\"coruncopia-report-link\" href=\"#{folder_name}/index.html\" target=\"_blank\">".html_safe
|
441
|
+
@test_list_item += @test_name
|
442
|
+
@test_list_item += "</a>\n".html_safe
|
443
|
+
@test_list_item += "</li>\n".html_safe
|
444
|
+
|
445
|
+
@test_list_item
|
446
|
+
end
|
447
|
+
end
|
448
|
+
|
449
|
+
def initialize_report_test_files
|
450
|
+
@report_body += test_list_item
|
451
|
+
|
452
|
+
support_folder_name = report_test_folder_name
|
453
|
+
|
454
|
+
FileUtils.mkdir_p @report_test_folder_name
|
455
|
+
|
456
|
+
unless File.exists?(report_test_base_page_name)
|
457
|
+
FileAsset.asset("report_base.html").add_file(File.join(support_folder_name, "index.html"))
|
458
|
+
rebuild_report_holder_page
|
459
|
+
end
|
460
|
+
|
461
|
+
FileAsset.asset("report_contents.html").add_file(File.join(support_folder_name, "report_contents.html"))
|
462
|
+
FileAsset.asset("collapse.gif").add_file(File.join(support_folder_name, "collapse.gif"))
|
463
|
+
FileAsset.asset("expand.gif").add_file(File.join(support_folder_name, "expand.gif"))
|
464
|
+
FileAsset.asset("more_info.js").add_file(File.join(support_folder_name, "more_info.js"))
|
465
|
+
FileAsset.asset("cornucopia.css").add_file(File.join(support_folder_name, "cornucopia.css"))
|
466
|
+
end
|
467
|
+
|
378
468
|
def open_report_contents_file(&block)
|
379
|
-
|
469
|
+
initialize_basic_report_files
|
380
470
|
|
381
471
|
File.open(report_contents_page_name, "a:UTF-8", &block)
|
382
472
|
end
|
383
473
|
|
474
|
+
def open_report_test_contents_file(&block)
|
475
|
+
initialize_report_test_files
|
476
|
+
|
477
|
+
File.open(report_test_contents_page_name, "a:UTF-8", &block)
|
478
|
+
end
|
479
|
+
|
480
|
+
def within_test(test_name, &block)
|
481
|
+
orig_test_name = @test_name
|
482
|
+
orig_test_folder = @report_test_folder_name
|
483
|
+
orig_test_list_item = @test_list_item
|
484
|
+
orig_section_number = @section_number
|
485
|
+
|
486
|
+
begin
|
487
|
+
@test_name = test_name
|
488
|
+
@report_test_folder_name = nil
|
489
|
+
@test_list_item = nil
|
490
|
+
@section_number = 0
|
491
|
+
|
492
|
+
block.yield
|
493
|
+
ensure
|
494
|
+
@section_number = orig_section_number
|
495
|
+
@test_name = orig_test_name
|
496
|
+
@report_test_folder_name = orig_test_folder
|
497
|
+
@test_list_item = orig_test_list_item
|
498
|
+
end
|
499
|
+
end
|
500
|
+
|
384
501
|
def within_section(section_text, &block)
|
385
502
|
begin
|
386
|
-
|
387
|
-
write_file.write "<div class=\"cornucopia-section\">\n"
|
503
|
+
open_report_test_contents_file do |write_file|
|
504
|
+
write_file.write "<div class=\"cornucopia-section #{((@section_number += 1) % 2) == 1 ? "cornucopia-even" : "cornucopia-odd"}\">\n"
|
388
505
|
write_file.write "<p class=\"cornucopia-section-label\">#{Cornucopia::Util::ReportBuilder.escape_string(section_text)}</p>\n".
|
389
506
|
force_encoding("UTF-8")
|
390
507
|
end
|
391
508
|
block.yield self
|
392
509
|
ensure
|
393
|
-
|
510
|
+
open_report_test_contents_file do |write_file|
|
394
511
|
write_file.write "</div>\n"
|
512
|
+
write_file.write "<div class=\"cornucopia-end-section\" />\n"
|
395
513
|
end
|
396
514
|
end
|
397
515
|
end
|
398
516
|
|
517
|
+
def within_hidden_table(options={}, &block)
|
518
|
+
table_pre = "<div class=\"cornucopia-show-hide-section\">\n"
|
519
|
+
table_pre << " <div class=\"cornucopia-table\">\n"
|
520
|
+
table_pre << " <div class=\"cornucopia-row\">\n"
|
521
|
+
table_pre << " <div class=\"cornucopia-cell-data\">\n"
|
522
|
+
table_pre << " <a class =\"cornucopia-additional-details\" href=\"#\">More Details...</a>\n"
|
523
|
+
table_pre << " </div>\n"
|
524
|
+
table_pre << " </div>\n"
|
525
|
+
table_pre << " </div>\n"
|
526
|
+
table_pre << " <div class=\"cornucopia-additional-details hidden\">\n"
|
527
|
+
table_pre = table_pre.html_safe
|
528
|
+
|
529
|
+
table_post = " </div>\n"
|
530
|
+
table_post << "</div>\n"
|
531
|
+
table_post = table_post.html_safe
|
532
|
+
|
533
|
+
within_table(table_prefix: table_pre,
|
534
|
+
table_postfix: table_post,
|
535
|
+
report_table: nil,
|
536
|
+
nested_table: options.delete(:nested_table),
|
537
|
+
nested_table_label: options.delete(:nested_table_label),
|
538
|
+
not_a_table: table_pre,
|
539
|
+
suppress_blank_table: table_pre) do |outer_report_table|
|
540
|
+
block.yield outer_report_table
|
541
|
+
end
|
542
|
+
end
|
543
|
+
|
399
544
|
def within_table(options = {}, &block)
|
400
545
|
report_table = nil
|
401
546
|
options_report_table = options[:report_table]
|
@@ -407,7 +552,7 @@ module Cornucopia
|
|
407
552
|
end
|
408
553
|
ensure
|
409
554
|
if report_table && !options_report_table
|
410
|
-
|
555
|
+
open_report_test_contents_file do |write_file|
|
411
556
|
write_file.write report_table.full_table.force_encoding("UTF-8")
|
412
557
|
end
|
413
558
|
end
|