cornucopia 0.1.21 → 0.1.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/cornucopia/util/configuration.rb +24 -0
- data/lib/cornucopia/util/log_capture.rb +36 -0
- data/lib/cornucopia/util/report_builder.rb +43 -14
- data/lib/cornucopia/version.rb +1 -1
- data/spec/lib/util/configuration_spec.rb +15 -1
- data/spec/lib/util/log_capture_spec.rb +75 -1
- data/spec/lib/util/report_builder_spec.rb +33 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cf8a5c84e2193e81d2b67d64375ada9f2007cba
|
4
|
+
data.tar.gz: 030766d5cd61bcb39200514aa0d58cd1e3fd5dd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38dd4f0575e88f87850a1fbf0a94609048f2e371933206108cdf46b55d8b55857ec11c389a6f206e89854bde464d584022c256b0c94e11acd2ab33193f8d0896
|
7
|
+
data.tar.gz: 602703301a74c5f70bfe1c45201805a72e670af12b96c91a437b32dc635c88df517045651511c6b8ce16ff0b26eb7f83f9824b8dcccd72548b2f5e741cc9fa0b
|
data/README.md
CHANGED
@@ -313,6 +313,11 @@ The configuration class contains the various configurations that are used by the
|
|
313
313
|
|
314
314
|
Indicates if the `Cornucopia::Util::LogCapture` class will capture any log files or not.
|
315
315
|
|
316
|
+
* **backup_logs_on_failure**
|
317
|
+
|
318
|
+
Indicates if the `Cornucopia::Util::LogCapture` class will backup the full log file at the end of the test suite
|
319
|
+
if there is an error.
|
320
|
+
|
316
321
|
* **user_log_files**
|
317
322
|
|
318
323
|
Returns a list of the log files which will be captures. Changing the returned value will not affect log
|
@@ -19,6 +19,7 @@ module Cornucopia
|
|
19
19
|
configurations.user_log_files = {}
|
20
20
|
configurations.default_num_lines = 500
|
21
21
|
configurations.grab_logs = true
|
22
|
+
configurations.backup_logs_on_failure = true
|
22
23
|
configurations.print_timeout_min = 10
|
23
24
|
configurations.selenium_cache_retry_count = 5
|
24
25
|
configurations.analyze_find_exceptions = true
|
@@ -405,6 +406,29 @@ module Cornucopia
|
|
405
406
|
Cornucopia::Util::Configuration.instance.configurations.grab_logs
|
406
407
|
end
|
407
408
|
|
409
|
+
# backup_logs_on_failure causes the system to copy the log files at the end of the report cycle if there were
|
410
|
+
# any errors during the creation of the report system.
|
411
|
+
#
|
412
|
+
# The system will try to grab the following log files:
|
413
|
+
# * Rails.env.log
|
414
|
+
# * any user specified logs
|
415
|
+
#
|
416
|
+
# The log capture is done with a simple file copy.
|
417
|
+
#
|
418
|
+
# Related options:
|
419
|
+
# user_log_files
|
420
|
+
# num_lines
|
421
|
+
# add_log_file
|
422
|
+
# remove_log_file
|
423
|
+
# grab_logs
|
424
|
+
def backup_logs_on_failure=(value)
|
425
|
+
Cornucopia::Util::Configuration.instance.configurations.backup_logs_on_failure = value
|
426
|
+
end
|
427
|
+
|
428
|
+
def backup_logs_on_failure
|
429
|
+
Cornucopia::Util::Configuration.instance.configurations.backup_logs_on_failure
|
430
|
+
end
|
431
|
+
|
408
432
|
# user_log_files returns a hash of all of the log files which
|
409
433
|
# the user has specified are to be grabbed.
|
410
434
|
#
|
@@ -7,6 +7,42 @@ module Cornucopia
|
|
7
7
|
class << self
|
8
8
|
TAIL_BUF_LENGTH = 1 << 16
|
9
9
|
|
10
|
+
def backup_log_files(backup_folder)
|
11
|
+
if Object.const_defined?("Rails")
|
12
|
+
log_folder = Rails.root.to_s
|
13
|
+
if (log_folder =~ /\/features\/?$/ || log_folder =~ /\/spec\/?$/)
|
14
|
+
log_folder = File.join(log_folder, "../")
|
15
|
+
end
|
16
|
+
|
17
|
+
default_log_file = "log/#{Rails.env.to_s}.log"
|
18
|
+
|
19
|
+
copy_log_file backup_folder, File.join(log_folder, default_log_file)
|
20
|
+
else
|
21
|
+
log_folder = FileUtils.pwd
|
22
|
+
end
|
23
|
+
|
24
|
+
Cornucopia::Util::Configuration.user_log_files.each do |relative_log_file, options|
|
25
|
+
copy_log_file backup_folder, File.join(log_folder, relative_log_file)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def copy_log_file(dest_folder, source_file)
|
30
|
+
extension = File.extname(source_file)
|
31
|
+
file_name = File.basename(source_file, extension)
|
32
|
+
dest_name = File.join(dest_folder, "#{file_name}#{extension}")
|
33
|
+
index = 0
|
34
|
+
|
35
|
+
while File.exists?(dest_name)
|
36
|
+
index += 1
|
37
|
+
dest_name = File.join(dest_folder, "#{file_name}_#{index}#{extension}")
|
38
|
+
end
|
39
|
+
|
40
|
+
if File.exists?(source_file)
|
41
|
+
FileUtils.mkdir_p File.dirname(dest_name)
|
42
|
+
FileUtils.cp source_file, dest_name
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
10
46
|
# This function will capture the logs and output them to the report
|
11
47
|
def capture_logs(report_table)
|
12
48
|
if report_table
|
@@ -63,8 +63,9 @@ module Cornucopia
|
|
63
63
|
format_value = value.to_s if value.is_a?(Array)
|
64
64
|
|
65
65
|
if format_sub_items
|
66
|
-
Cornucopia::Util::ReportBuilder.pretty_format(format_value).rstrip
|
66
|
+
Cornucopia::Util::ReportBuilder.pretty_format(format_value, in_pretty_print: true).rstrip
|
67
67
|
else
|
68
|
+
# "".html_safe + format_value
|
68
69
|
format_value
|
69
70
|
end
|
70
71
|
end.join("\n").html_safe
|
@@ -78,7 +79,7 @@ module Cornucopia
|
|
78
79
|
# either the class prints quickly, or we kill it and try something else.
|
79
80
|
#
|
80
81
|
# If the something else doesn't work, we just give up...
|
81
|
-
def pretty_object(value)
|
82
|
+
def pretty_object(value, options = {})
|
82
83
|
timed_out = false
|
83
84
|
return_value = nil
|
84
85
|
|
@@ -94,7 +95,7 @@ module Cornucopia
|
|
94
95
|
if value.is_a?(String)
|
95
96
|
return_value = value
|
96
97
|
elsif value.is_a?(Array)
|
97
|
-
return_value = Cornucopia::Util::ReportBuilder.pretty_array(value,
|
98
|
+
return_value = Cornucopia::Util::ReportBuilder.pretty_array(value, !options[:in_pretty_print])
|
98
99
|
elsif value.respond_to?(:pretty_inspect)
|
99
100
|
return_value = value.pretty_inspect
|
100
101
|
else
|
@@ -124,10 +125,10 @@ module Cornucopia
|
|
124
125
|
return_value
|
125
126
|
end
|
126
127
|
|
127
|
-
def pretty_format(value)
|
128
|
+
def pretty_format(value, options = {})
|
128
129
|
pretty_text = value
|
129
130
|
|
130
|
-
pretty_text = Cornucopia::Util::ReportBuilder.pretty_object(pretty_text)
|
131
|
+
pretty_text = Cornucopia::Util::ReportBuilder.pretty_object(pretty_text, options)
|
131
132
|
pretty_text = Cornucopia::Util::ReportBuilder.escape_string(pretty_text)
|
132
133
|
pretty_text = Cornucopia::Util::PrettyFormatter.format_string(pretty_text)
|
133
134
|
pretty_text = Cornucopia::Util::ReportBuilder.format_code_refs(pretty_text)
|
@@ -222,6 +223,10 @@ module Cornucopia
|
|
222
223
|
end
|
223
224
|
|
224
225
|
if File.exists?(report_base_page_name)
|
226
|
+
if Cornucopia::Util::Configuration.backup_logs_on_failure
|
227
|
+
backup_log_files
|
228
|
+
end
|
229
|
+
|
225
230
|
if Cornucopia::Util::Configuration.open_report_after_generation(@base_folder_name)
|
226
231
|
# `open #{report_base_page_name}` rescue nil
|
227
232
|
system("open #{report_base_page_name}") rescue nil
|
@@ -434,17 +439,23 @@ module Cornucopia
|
|
434
439
|
FileAsset.asset("cornucopia.css").add_file(File.join(support_folder_name, "cornucopia.css"))
|
435
440
|
end
|
436
441
|
|
442
|
+
def body_list_item(name, path)
|
443
|
+
body_list_item = "<li>\n".html_safe
|
444
|
+
body_list_item += "<a class=\"coruncopia-report-link\" href=\"#{path}\" target=\"_blank\">".html_safe
|
445
|
+
body_list_item += name
|
446
|
+
body_list_item += "</a>\n".html_safe
|
447
|
+
body_list_item += "</li>\n".html_safe
|
448
|
+
|
449
|
+
body_list_item
|
450
|
+
end
|
451
|
+
|
437
452
|
def test_list_item
|
438
453
|
if @test_list_item
|
439
454
|
nil
|
440
455
|
else
|
441
456
|
folder_name = File.basename(report_test_folder_name)
|
442
457
|
|
443
|
-
@test_list_item = "
|
444
|
-
@test_list_item += "<a class=\"coruncopia-report-link\" href=\"#{folder_name}/index.html\" target=\"_blank\">".html_safe
|
445
|
-
@test_list_item += @test_name
|
446
|
-
@test_list_item += "</a>\n".html_safe
|
447
|
-
@test_list_item += "</li>\n".html_safe
|
458
|
+
@test_list_item = body_list_item(@test_name, File.join(folder_name, "index.html"))
|
448
459
|
|
449
460
|
@test_list_item
|
450
461
|
end
|
@@ -628,14 +639,16 @@ module Cornucopia
|
|
628
639
|
padded_val << "</div>".html_safe
|
629
640
|
end
|
630
641
|
|
631
|
-
def unique_file_name(file_base_name)
|
642
|
+
def unique_file_name(file_base_name, base_folder = nil)
|
632
643
|
file_parts = file_base_name.split(".")
|
633
644
|
base_name = file_parts[0..-2].join(".")
|
634
645
|
extension = file_parts[-1]
|
635
646
|
|
647
|
+
base_folder ||= report_test_folder_name
|
648
|
+
|
636
649
|
unique_num = 1
|
637
650
|
num_string = ""
|
638
|
-
while File.exists?(File.join(
|
651
|
+
while File.exists?(File.join(base_folder, "#{base_name}#{num_string}.#{extension}"))
|
639
652
|
num_string = "_#{unique_num}"
|
640
653
|
unique_num += 1
|
641
654
|
end
|
@@ -643,16 +656,32 @@ module Cornucopia
|
|
643
656
|
"#{base_name}#{num_string}.#{extension}"
|
644
657
|
end
|
645
658
|
|
646
|
-
def unique_folder_name(folder_base_name)
|
659
|
+
def unique_folder_name(folder_base_name, base_folder = nil)
|
647
660
|
unique_num = 1
|
648
661
|
num_string = ""
|
649
|
-
|
662
|
+
|
663
|
+
base_folder ||= report_test_folder_name
|
664
|
+
|
665
|
+
while File.exists?(File.join(base_folder, "#{folder_base_name}#{num_string}"))
|
650
666
|
num_string = "_#{unique_num}"
|
651
667
|
unique_num += 1
|
652
668
|
end
|
653
669
|
|
654
670
|
"#{folder_base_name}#{num_string}"
|
655
671
|
end
|
672
|
+
|
673
|
+
def backup_log_files
|
674
|
+
log_folder = unique_folder_name "log_files", report_folder_name
|
675
|
+
|
676
|
+
Cornucopia::Util::LogCapture.backup_log_files File.join(report_folder_name, log_folder)
|
677
|
+
|
678
|
+
log_files = Dir[File.join(report_folder_name, log_folder, "**", "*")]
|
679
|
+
log_files.each do |log_file|
|
680
|
+
@report_body += body_list_item(File.basename(log_file), log_file[report_folder_name.length..-1])
|
681
|
+
end
|
682
|
+
|
683
|
+
rebuild_report_holder_page
|
684
|
+
end
|
656
685
|
end
|
657
686
|
end
|
658
687
|
end
|
data/lib/cornucopia/version.rb
CHANGED
@@ -76,7 +76,7 @@ describe "Cornucopia::Util::Configuration" do
|
|
76
76
|
expect(Cornucopia::Util::Configuration.grab_logs).to be_truthy
|
77
77
|
end
|
78
78
|
|
79
|
-
it "can set the
|
79
|
+
it "can set the grab_logs value" do
|
80
80
|
begin
|
81
81
|
Cornucopia::Util::Configuration.grab_logs = false
|
82
82
|
|
@@ -86,6 +86,20 @@ describe "Cornucopia::Util::Configuration" do
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
+
it "backs up logs on failure by default" do
|
90
|
+
expect(Cornucopia::Util::Configuration.backup_logs_on_failure).to be_truthy
|
91
|
+
end
|
92
|
+
|
93
|
+
it "can set the backup_logs_on_failure value" do
|
94
|
+
begin
|
95
|
+
Cornucopia::Util::Configuration.backup_logs_on_failure = false
|
96
|
+
|
97
|
+
expect(Cornucopia::Util::Configuration.backup_logs_on_failure).to be_falsey
|
98
|
+
ensure
|
99
|
+
Cornucopia::Util::Configuration.backup_logs_on_failure = true
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
89
103
|
it "has no custom files by default" do
|
90
104
|
expect(Cornucopia::Util::Configuration.user_log_files).to be == {}
|
91
105
|
end
|
@@ -3,12 +3,16 @@ require ::File.expand_path("../../../lib/cornucopia/util/log_capture", File.dirn
|
|
3
3
|
|
4
4
|
describe Cornucopia::Util::LogCapture do
|
5
5
|
let(:file_name) { Rails.root.join("sample_log.log") }
|
6
|
+
let(:dest_folder) { Rails.root.join("fake_logs/") }
|
6
7
|
|
7
8
|
around(:each) do |example|
|
9
|
+
pwd = FileUtils.pwd
|
10
|
+
|
8
11
|
expect(File.directory?(Rails.root.join("cornucopia_report/"))).to be_falsey
|
9
12
|
expect(File.directory?(Rails.root.join("spec/cornucopia_report/"))).to be_falsey
|
10
13
|
expect(File.directory?(Rails.root.join("features/cornucopia_report/"))).to be_falsey
|
11
14
|
expect(File.exists?(file_name)).to be_falsey
|
15
|
+
expect(File.directory?(dest_folder)).to be_falsey
|
12
16
|
|
13
17
|
begin
|
14
18
|
example.run
|
@@ -22,6 +26,13 @@ describe Cornucopia::Util::LogCapture do
|
|
22
26
|
FileUtils.rm_rf Rails.root.join("features/cornucopia_report/")
|
23
27
|
FileUtils.rm_rf Rails.root.join("features") if Dir[Rails.root.join("features/*")].empty?
|
24
28
|
FileUtils.rm_rf file_name
|
29
|
+
FileUtils.rm_rf dest_folder
|
30
|
+
|
31
|
+
Dir[File.join(dest_folder, "sample_log*.log")].each do |file_name|
|
32
|
+
FileUtils.rm_rf file_name
|
33
|
+
end
|
34
|
+
|
35
|
+
FileUtils.cd pwd
|
25
36
|
end
|
26
37
|
end
|
27
38
|
|
@@ -88,6 +99,69 @@ describe Cornucopia::Util::LogCapture do
|
|
88
99
|
end
|
89
100
|
end
|
90
101
|
|
102
|
+
describe "#backup_log_files" do
|
103
|
+
before(:each) do
|
104
|
+
FileUtils.mkdir_p dest_folder
|
105
|
+
Cornucopia::Util::FileAsset.asset("report.js").add_file(file_name)
|
106
|
+
end
|
107
|
+
|
108
|
+
after(:each) do
|
109
|
+
Cornucopia::Util::Configuration.remove_log_file("sample_log.log")
|
110
|
+
end
|
111
|
+
|
112
|
+
it "goes up one level if you are in spec or features" do
|
113
|
+
Cornucopia::Util::Configuration.add_log_file("sample_log.log")
|
114
|
+
|
115
|
+
expect(File.exists?(file_name)).to be_truthy
|
116
|
+
expect(File.exists?(File.join(dest_folder, "sample_log.log"))).to be_falsey
|
117
|
+
|
118
|
+
new_root = Rails.root.join(%w(features spec).sample).to_s
|
119
|
+
expect(Rails).to receive(:root).at_least(1).and_return(new_root)
|
120
|
+
|
121
|
+
Cornucopia::Util::LogCapture.backup_log_files(dest_folder)
|
122
|
+
|
123
|
+
expect(File.exists?(File.join(dest_folder, "sample_log.log"))).to be_truthy
|
124
|
+
end
|
125
|
+
|
126
|
+
it "resolves file conflicts" do
|
127
|
+
file_num = rand(1..5)
|
128
|
+
Cornucopia::Util::Configuration.add_log_file("sample_log.log")
|
129
|
+
|
130
|
+
expect(File.exists?(file_name)).to be_truthy
|
131
|
+
FileUtils.cp file_name, File.join(dest_folder, "sample_log.log")
|
132
|
+
expect(File.exists?(File.join(dest_folder, "sample_log.log"))).to be_truthy
|
133
|
+
|
134
|
+
index = 1
|
135
|
+
while index < file_num
|
136
|
+
FileUtils.cp file_name, File.join(dest_folder, "sample_log_#{index}.log")
|
137
|
+
expect(File.exists?(File.join(dest_folder, "sample_log_#{index}.log"))).to be_truthy
|
138
|
+
index += 1
|
139
|
+
end
|
140
|
+
expect(File.exists?(File.join(dest_folder, "sample_log_#{file_num}.log"))).to be_falsey
|
141
|
+
|
142
|
+
new_root = Rails.root.join(%w(features spec).sample).to_s
|
143
|
+
expect(Rails).to receive(:root).at_least(1).and_return(new_root)
|
144
|
+
|
145
|
+
Cornucopia::Util::LogCapture.backup_log_files(dest_folder)
|
146
|
+
|
147
|
+
expect(File.exists?(File.join(dest_folder, "sample_log_#{file_num}.log"))).to be_truthy
|
148
|
+
end
|
149
|
+
|
150
|
+
it "does not require Rails" do
|
151
|
+
Cornucopia::Util::Configuration.add_log_file("sample_log.log")
|
152
|
+
|
153
|
+
expect(File.exists?(file_name)).to be_truthy
|
154
|
+
expect(File.exists?(File.join(dest_folder, "sample_log.log"))).to be_falsey
|
155
|
+
|
156
|
+
FileUtils.cd Rails.root.to_s
|
157
|
+
expect(Object).to receive(:const_defined?).at_least(1).with("Rails").and_return(false)
|
158
|
+
|
159
|
+
Cornucopia::Util::LogCapture.backup_log_files(dest_folder)
|
160
|
+
|
161
|
+
expect(File.exists?(File.join(dest_folder, "sample_log.log"))).to be_truthy
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
91
165
|
describe "#capture_logs" do
|
92
166
|
after(:each) do
|
93
167
|
Cornucopia::Util::Configuration.remove_log_file("sample_log.log")
|
@@ -120,7 +194,7 @@ describe Cornucopia::Util::LogCapture do
|
|
120
194
|
write_file.write(lines.join("\n"))
|
121
195
|
end
|
122
196
|
|
123
|
-
new_root = Rails.root.join(%w(features
|
197
|
+
new_root = Rails.root.join(%w(features spec).sample).to_s
|
124
198
|
expect(Rails).to receive(:root).at_least(1).and_return(new_root)
|
125
199
|
Cornucopia::Util::LogCapture.capture_logs(nil)
|
126
200
|
|
@@ -163,7 +163,13 @@ describe Cornucopia::Util::ReportBuilder do
|
|
163
163
|
end
|
164
164
|
|
165
165
|
it "calls #pretty_format on a sub-array after it is converted to a string" do
|
166
|
-
expect(Cornucopia::Util::ReportBuilder).
|
166
|
+
expect(Cornucopia::Util::ReportBuilder).
|
167
|
+
to receive(:pretty_format).
|
168
|
+
with(anything, in_pretty_print: true).
|
169
|
+
exactly(4).
|
170
|
+
times.
|
171
|
+
and_call_original
|
172
|
+
|
167
173
|
array_values << [1, 2, 3]
|
168
174
|
|
169
175
|
formatted_code = Cornucopia::Util::ReportBuilder.pretty_array(array_values)
|
@@ -171,6 +177,17 @@ describe Cornucopia::Util::ReportBuilder do
|
|
171
177
|
expect(formatted_code).to be_html_safe
|
172
178
|
expect(formatted_code).to be == "Turner &amp; Hooch\nBarney Rubble\nHarvey\n[1, 2, 3]"
|
173
179
|
end
|
180
|
+
|
181
|
+
it "doesn't call #pretty_format on values if told not to" do
|
182
|
+
expect(Cornucopia::Util::ReportBuilder).not_to receive(:pretty_format)
|
183
|
+
|
184
|
+
array_values << [1, 2, 3]
|
185
|
+
|
186
|
+
formatted_code = Cornucopia::Util::ReportBuilder.pretty_array(array_values, false)
|
187
|
+
|
188
|
+
expect(formatted_code).to be_html_safe
|
189
|
+
expect(formatted_code).to be == "Turner & Hooch\nBarney Rubble\nHarvey\n[1, 2, 3]"
|
190
|
+
end
|
174
191
|
end
|
175
192
|
|
176
193
|
describe "#pretty_object" do
|
@@ -1051,9 +1068,11 @@ describe Cornucopia::Util::ReportBuilder do
|
|
1051
1068
|
|
1052
1069
|
report_page = Capybara::Node::Simple.new(File.read(current_report.report_base_page_name))
|
1053
1070
|
|
1054
|
-
expect(report_page.all(".coruncopia-report-link").length).to eq
|
1071
|
+
expect(report_page.all(".coruncopia-report-link").length).to eq 2
|
1055
1072
|
expect(report_page.all(".coruncopia-report-link")[0].text).to eq test_names[0]
|
1056
1073
|
expect(report_page.all(".coruncopia-report-link")[0]["href"]).to eq "test_1/index.html"
|
1074
|
+
expect(report_page.all(".coruncopia-report-link")[1].text).to eq "test.log"
|
1075
|
+
expect(report_page.all(".coruncopia-report-link")[1]["href"]).to eq "log_files/test.log"
|
1057
1076
|
end
|
1058
1077
|
|
1059
1078
|
it "doesn't output anything if nothing is written to a section or table" do
|
@@ -1087,12 +1106,14 @@ describe Cornucopia::Util::ReportBuilder do
|
|
1087
1106
|
|
1088
1107
|
report_page = Capybara::Node::Simple.new(File.read(current_report.report_base_page_name))
|
1089
1108
|
|
1090
|
-
expect(report_page.all(".coruncopia-report-link").length).to eq test_names.length
|
1109
|
+
expect(report_page.all(".coruncopia-report-link").length).to eq (test_names.length + 1)
|
1091
1110
|
|
1092
1111
|
test_names.each_with_index do |test_name, test_index|
|
1093
1112
|
expect(report_page.all(".coruncopia-report-link")[test_index].text).to eq test_name
|
1094
1113
|
expect(report_page.all(".coruncopia-report-link")[test_index]["href"]).to eq "test_#{test_index + 1}/index.html"
|
1095
1114
|
end
|
1115
|
+
expect(report_page.all(".coruncopia-report-link")[-1].text).to eq "test.log"
|
1116
|
+
expect(report_page.all(".coruncopia-report-link")[-1]["href"]).to eq "log_files/test.log"
|
1096
1117
|
end
|
1097
1118
|
|
1098
1119
|
it "handles a test within a test as an independent test" do
|
@@ -1117,11 +1138,13 @@ describe Cornucopia::Util::ReportBuilder do
|
|
1117
1138
|
|
1118
1139
|
report_page = Capybara::Node::Simple.new(File.read(current_report.report_base_page_name))
|
1119
1140
|
|
1120
|
-
expect(report_page.all(".coruncopia-report-link").length).to eq
|
1141
|
+
expect(report_page.all(".coruncopia-report-link").length).to eq 3
|
1121
1142
|
expect(report_page.all(".coruncopia-report-link")[0].text).to eq test_names[0]
|
1122
1143
|
expect(report_page.all(".coruncopia-report-link")[0]["href"]).to eq "test_1/index.html"
|
1123
1144
|
expect(report_page.all(".coruncopia-report-link")[1].text).to eq test_names[1]
|
1124
1145
|
expect(report_page.all(".coruncopia-report-link")[1]["href"]).to eq "test_2/index.html"
|
1146
|
+
expect(report_page.all(".coruncopia-report-link")[2].text).to eq "test.log"
|
1147
|
+
expect(report_page.all(".coruncopia-report-link")[2]["href"]).to eq "log_files/test.log"
|
1125
1148
|
|
1126
1149
|
report_page = Capybara::Node::Simple.new(File.read(File.join(current_report.report_folder_name, "test_1/report_contents.html")))
|
1127
1150
|
expect(report_page.all(".cornucopia-section-label").length).to eq 1
|
@@ -1160,11 +1183,13 @@ describe Cornucopia::Util::ReportBuilder do
|
|
1160
1183
|
|
1161
1184
|
report_page = Capybara::Node::Simple.new(File.read(current_report.report_base_page_name))
|
1162
1185
|
|
1163
|
-
expect(report_page.all(".coruncopia-report-link").length).to eq
|
1186
|
+
expect(report_page.all(".coruncopia-report-link").length).to eq 3
|
1164
1187
|
expect(report_page.all(".coruncopia-report-link")[0].text).to eq test_names[0]
|
1165
1188
|
expect(report_page.all(".coruncopia-report-link")[0]["href"]).to eq "test_1/index.html"
|
1166
1189
|
expect(report_page.all(".coruncopia-report-link")[1].text).to eq test_names[1]
|
1167
1190
|
expect(report_page.all(".coruncopia-report-link")[1]["href"]).to eq "test_2/index.html"
|
1191
|
+
expect(report_page.all(".coruncopia-report-link")[2].text).to eq "test.log"
|
1192
|
+
expect(report_page.all(".coruncopia-report-link")[2]["href"]).to eq "log_files/test.log"
|
1168
1193
|
|
1169
1194
|
report_page = Capybara::Node::Simple.new(File.read(File.join(current_report.report_folder_name, "test_1/report_contents.html")))
|
1170
1195
|
expect(report_page.all(".cornucopia-section-label").length).to eq 2
|
@@ -1191,12 +1216,14 @@ describe Cornucopia::Util::ReportBuilder do
|
|
1191
1216
|
|
1192
1217
|
report_page = Capybara::Node::Simple.new(File.read(current_report.report_base_page_name))
|
1193
1218
|
|
1194
|
-
expect(report_page.all(".coruncopia-report-link").length).to eq
|
1219
|
+
expect(report_page.all(".coruncopia-report-link").length).to eq 3
|
1195
1220
|
|
1196
1221
|
expect(report_page.all(".coruncopia-report-link")[0].text).to eq test_names[0]
|
1197
1222
|
expect(report_page.all(".coruncopia-report-link")[0]["href"]).to eq "test_1/index.html"
|
1198
1223
|
expect(report_page.all(".coruncopia-report-link")[1].text).to eq test_names[-1]
|
1199
1224
|
expect(report_page.all(".coruncopia-report-link")[1]["href"]).to eq "test_2/index.html"
|
1225
|
+
expect(report_page.all(".coruncopia-report-link")[2].text).to eq "test.log"
|
1226
|
+
expect(report_page.all(".coruncopia-report-link")[2]["href"]).to eq "log_files/test.log"
|
1200
1227
|
end
|
1201
1228
|
end
|
1202
1229
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cornucopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RealNobody
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|