pretty_face 0.10.2 → 0.10.3
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/ChangeLog +3 -0
- data/features/step_definitions/report_steps.rb +2 -2
- data/lib/pretty_face/formatter/html.rb +3 -3
- data/lib/pretty_face/formatter/report.rb +7 -2
- data/lib/pretty_face/templates/feature.erb +5 -3
- data/lib/pretty_face/version.rb +1 -1
- data/spec/lib/customization_spec.rb +3 -3
- data/spec/lib/html_formatter_spec.rb +49 -49
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41294070b2073474df6f23b32f9d9635fa6e1496
|
4
|
+
data.tar.gz: 2bbd6c2564c79e8b29bdc0ac44f5a592a6c1fe7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4ca6f847ea979f8cdda0283cb1d16b8af689b78d5be3526476267abe19d76715be909c5a883b2cb0dff2db64d8fed476d19434f1a41dc8d96e738a025ec2d74
|
7
|
+
data.tar.gz: 9b9959330f568d4a0032891cb7de498df895e07116fb10c6a27cb8360e654564c2701521c3d694184ec018cbefc335259c2c0bcedb3de76bb7871db46bf4b0eb
|
data/ChangeLog
CHANGED
@@ -27,10 +27,10 @@ end
|
|
27
27
|
Then(/^the background of the error message row should be "(.*?)"$/) do |background|
|
28
28
|
@browser = Watir::Browser.new :firefox
|
29
29
|
visit ErrorDisplay do |page|
|
30
|
-
page.error_background.
|
30
|
+
expect(page.error_background).to include background
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
Then(/^the text of the of the error message row should be "(.*?)"$/) do |color|
|
35
|
-
on(ErrorDisplay).error_text_color.
|
35
|
+
expect(on(ErrorDisplay).error_text_color).to include color
|
36
36
|
end
|
@@ -51,9 +51,9 @@ module PrettyFace
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def embed_image(src, label)
|
54
|
-
@report.current_scenario.image
|
55
|
-
@report.current_scenario.image_label
|
56
|
-
@report.current_scenario.image_id
|
54
|
+
@report.current_scenario.image << src.split(separator).last
|
55
|
+
@report.current_scenario.image_label << label
|
56
|
+
@report.current_scenario.image_id << "img_#{@img_id}"
|
57
57
|
@img_id += 1
|
58
58
|
filename = "#{File.dirname(@path)}#{separator}images"
|
59
59
|
FileUtils.cp src, filename
|
@@ -166,6 +166,9 @@ module PrettyFace
|
|
166
166
|
|
167
167
|
def initialize(scenario)
|
168
168
|
@steps = []
|
169
|
+
@image = []
|
170
|
+
@image_label = []
|
171
|
+
@image_id = []
|
169
172
|
@start = Time.now
|
170
173
|
end
|
171
174
|
|
@@ -256,10 +259,12 @@ module PrettyFace
|
|
256
259
|
|
257
260
|
def lines_around(file, line)
|
258
261
|
if File.file?(file)
|
259
|
-
lines = File.open(file).read.split("\n")
|
262
|
+
# lines = File.open(file).read.split("\n")
|
263
|
+
lines = File.readlines(file)
|
260
264
|
min = [0, line-3].max
|
261
265
|
max = [line+1, lines.length-1].min
|
262
|
-
lines[min..max].join("\n")
|
266
|
+
# lines[min..max].join("\n")
|
267
|
+
lines[min..max].join
|
263
268
|
else
|
264
269
|
"# Couldn't get snippet for #{file}"
|
265
270
|
end
|
@@ -114,9 +114,11 @@
|
|
114
114
|
|
115
115
|
<div class="img_container">
|
116
116
|
<% if scenario.has_image? %>
|
117
|
-
|
118
|
-
|
119
|
-
|
117
|
+
<% scenario.image.length.times do |i| %>
|
118
|
+
<a href='' onclick="img=document.getElementById('<%= scenario.image_id[i] %>'); img.style.display = (img.style.display == 'none' ? 'block' : 'none');return false"><%= "#{scenario.image_label[i]}" %></a><br />
|
119
|
+
<img id='<%= scenario.image_id[i] %>' style='display: none' src='<%= feature.directory_prefix_for(feature.file) %>images/<%= scenario.image[i] %>'/>
|
120
|
+
<% end %>
|
121
|
+
<% end %>
|
120
122
|
<br /><br />
|
121
123
|
<% end %>
|
122
124
|
</div>
|
data/lib/pretty_face/version.rb
CHANGED
@@ -13,9 +13,9 @@ describe PrettyFace::Formatter::Html do
|
|
13
13
|
|
14
14
|
context "when not customizing the report" do
|
15
15
|
it "indicates that there are no custom components" do
|
16
|
-
formatter.custom_suite_header
|
17
|
-
formatter.custom_feature_header
|
18
|
-
formatter.send(:logo_file).
|
16
|
+
expect(formatter.custom_suite_header?).to be false
|
17
|
+
expect(formatter.custom_feature_header?).to be false
|
18
|
+
expect(formatter.send(:logo_file)).to be nil
|
19
19
|
end
|
20
20
|
|
21
21
|
end
|
@@ -9,131 +9,131 @@ describe PrettyFace::Formatter::Html do
|
|
9
9
|
|
10
10
|
context "when building the header for the main page" do
|
11
11
|
it "should know the start time" do
|
12
|
-
formatter.
|
12
|
+
allow(formatter).to receive(:make_output_directories)
|
13
13
|
formatter.before_features(nil)
|
14
|
-
formatter.start_time.
|
14
|
+
expect(formatter.start_time).to eql Time.now.strftime("%a %B %-d, %Y at %H:%M:%S")
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should know how long it takes" do
|
18
|
-
formatter.
|
19
|
-
formatter.
|
20
|
-
formatter.
|
21
|
-
formatter.
|
18
|
+
expect(formatter).to receive(:generate_report)
|
19
|
+
expect(formatter).to receive(:copy_images)
|
20
|
+
expect(formatter).to receive(:copy_stylesheets)
|
21
|
+
allow(formatter).to receive(:make_output_directories)
|
22
22
|
formatter.before_features(nil)
|
23
23
|
|
24
24
|
formatter.after_features(nil)
|
25
|
-
formatter.total_duration.
|
25
|
+
expect(formatter.total_duration).to include '0.0'
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
context "when building the report for scenarios" do
|
30
30
|
it "should track number of scenarios" do
|
31
|
-
step_mother.
|
32
|
-
formatter.scenario_count.
|
31
|
+
expect(step_mother).to receive(:scenarios).and_return([1,2,3])
|
32
|
+
expect(formatter.scenario_count).to eql 3
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should keep track of passing scenarios" do
|
36
|
-
step_mother.
|
37
|
-
step_mother.
|
38
|
-
formatter.scenarios_summary_for(:passed).
|
36
|
+
expect(step_mother).to receive(:scenarios).with(:passed).and_return([1,2])
|
37
|
+
expect(step_mother).to receive(:scenarios).and_return([1,2])
|
38
|
+
expect(formatter.scenarios_summary_for(:passed)).to eql "2 <span class=\"percentage\">(100.0%)</span>"
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should keep track of failing scenarios" do
|
42
|
-
step_mother.
|
43
|
-
step_mother.
|
44
|
-
formatter.scenarios_summary_for(:failed).
|
42
|
+
expect(step_mother).to receive(:scenarios).with(:failed).and_return([1,2])
|
43
|
+
expect(step_mother).to receive(:scenarios).and_return([1,2])
|
44
|
+
expect(formatter.scenarios_summary_for(:failed)).to eql "2 <span class=\"percentage\">(100.0%)</span>"
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should keep track of pending scenarios" do
|
48
|
-
step_mother.
|
49
|
-
step_mother.
|
50
|
-
formatter.scenarios_summary_for(:pending).
|
48
|
+
expect(step_mother).to receive(:scenarios).with(:pending).and_return([1,2])
|
49
|
+
expect(step_mother).to receive(:scenarios).and_return([1,2])
|
50
|
+
expect(formatter.scenarios_summary_for(:pending)).to eql "2 <span class=\"percentage\">(100.0%)</span>"
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should keep track of undefined scenarios" do
|
54
|
-
step_mother.
|
55
|
-
step_mother.
|
56
|
-
formatter.scenarios_summary_for(:undefined).
|
54
|
+
expect(step_mother).to receive(:scenarios).with(:undefined).and_return([1,2])
|
55
|
+
expect(step_mother).to receive(:scenarios).and_return([1,2])
|
56
|
+
expect(formatter.scenarios_summary_for(:undefined)).to eql "2 <span class=\"percentage\">(100.0%)</span>"
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should keep track of skipped scenarios" do
|
60
|
-
step_mother.
|
61
|
-
step_mother.
|
62
|
-
formatter.scenarios_summary_for(:skipped).
|
60
|
+
expect(step_mother).to receive(:scenarios).with(:skipped).and_return([1,2])
|
61
|
+
expect(step_mother).to receive(:scenarios).and_return([1,2])
|
62
|
+
expect(formatter.scenarios_summary_for(:skipped)).to eql "2 <span class=\"percentage\">(100.0%)</span>"
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
context "when building the report for steps" do
|
67
67
|
it "should track number of steps" do
|
68
|
-
step_mother.
|
69
|
-
formatter.step_count.
|
68
|
+
expect(step_mother).to receive(:steps).and_return([1,2])
|
69
|
+
expect(formatter.step_count).to eql 2
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should keep track of passing steps" do
|
73
|
-
step_mother.
|
74
|
-
step_mother.
|
75
|
-
formatter.steps_summary_for(:passed).
|
73
|
+
expect(step_mother).to receive(:steps).with(:passed).and_return([1,2])
|
74
|
+
expect(step_mother).to receive(:steps).and_return([1,2])
|
75
|
+
expect(formatter.steps_summary_for(:passed)).to eql "2 <span class=\"percentage\">(100.0%)</span>"
|
76
76
|
end
|
77
77
|
|
78
78
|
it "should keep track of failing steps" do
|
79
|
-
step_mother.
|
80
|
-
step_mother.
|
81
|
-
formatter.steps_summary_for(:failed).
|
79
|
+
expect(step_mother).to receive(:steps).with(:failed).and_return([1,2])
|
80
|
+
expect(step_mother).to receive(:steps).and_return([1,2])
|
81
|
+
expect(formatter.steps_summary_for(:failed)).to eql "2 <span class=\"percentage\">(100.0%)</span>"
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should keep track of skipped steps" do
|
85
|
-
step_mother.
|
86
|
-
step_mother.
|
87
|
-
formatter.steps_summary_for(:skipped).
|
85
|
+
expect(step_mother).to receive(:steps).with(:skipped).and_return([1,2])
|
86
|
+
expect(step_mother).to receive(:steps).and_return([1,2])
|
87
|
+
expect(formatter.steps_summary_for(:skipped)).to eql "2 <span class=\"percentage\">(100.0%)</span>"
|
88
88
|
end
|
89
89
|
|
90
90
|
it "should keep track of pending steps" do
|
91
|
-
step_mother.
|
92
|
-
step_mother.
|
93
|
-
formatter.steps_summary_for(:pending).
|
91
|
+
expect(step_mother).to receive(:steps).with(:pending).and_return([1,2])
|
92
|
+
expect(step_mother).to receive(:steps).and_return([1,2])
|
93
|
+
expect(formatter.steps_summary_for(:pending)).to eql "2 <span class=\"percentage\">(100.0%)</span>"
|
94
94
|
end
|
95
95
|
|
96
96
|
it "should keep track of undefined steps" do
|
97
|
-
step_mother.
|
98
|
-
step_mother.
|
99
|
-
formatter.steps_summary_for(:undefined).
|
97
|
+
expect(step_mother).to receive(:steps).with(:undefined).and_return([1,2])
|
98
|
+
expect(step_mother).to receive(:steps).and_return([1,2])
|
99
|
+
expect(formatter.steps_summary_for(:undefined)).to eql "2 <span class=\"percentage\">(100.0%)</span>"
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
103
|
context "when embedding an image" do
|
104
104
|
before(:each) do
|
105
105
|
cuke_feature = double('cuke_feature')
|
106
|
-
cuke_feature.
|
106
|
+
expect(cuke_feature).to receive(:description)
|
107
107
|
report_feature = ReportFeature.new(cuke_feature, 'foo')
|
108
108
|
formatter.report.features << report_feature
|
109
109
|
@scenario = ReportScenario.new(nil)
|
110
110
|
formatter.report.current_feature.scenarios << @scenario
|
111
|
-
File.
|
112
|
-
FileUtils.
|
111
|
+
allow(File).to receive(:dirname).and_return('')
|
112
|
+
allow(FileUtils).to receive(:cp)
|
113
113
|
end
|
114
114
|
|
115
115
|
it "should generate an id" do
|
116
116
|
formatter.embed('image.png', 'image/png', 'the label')
|
117
|
-
@scenario.image_id.
|
117
|
+
expect(@scenario.image_id).to include 'img_0'
|
118
118
|
end
|
119
119
|
|
120
120
|
it "should get the filename from the src" do
|
121
121
|
formatter.embed('directory/image.png', 'image/png', 'the label')
|
122
|
-
@scenario.image.
|
122
|
+
expect(@scenario.image).to include 'image.png'
|
123
123
|
end
|
124
124
|
|
125
125
|
it "should get the image label" do
|
126
126
|
formatter.embed('directory/image.png', 'image/png', 'the label')
|
127
|
-
@scenario.image_label.
|
127
|
+
expect(@scenario.image_label).to include 'the label'
|
128
128
|
end
|
129
129
|
|
130
130
|
it "scenario should know if it has an image" do
|
131
131
|
formatter.embed('directory/image.png', 'image/png', 'the label')
|
132
|
-
@scenario.
|
132
|
+
expect(@scenario).to have_image
|
133
133
|
end
|
134
134
|
|
135
135
|
it "should copy the image to the output directory" do
|
136
|
-
FileUtils.
|
136
|
+
expect(FileUtils).to receive(:cp).with('directory/image.png', '/images')
|
137
137
|
formatter.embed('directory/image.png', 'image/png', 'the label')
|
138
138
|
end
|
139
139
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pretty_face
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey S. Morgan
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-
|
15
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: actionpack
|
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
187
|
version: '0'
|
188
188
|
requirements: []
|
189
189
|
rubyforge_project: pretty_face
|
190
|
-
rubygems_version: 2.0.
|
190
|
+
rubygems_version: 2.0.14
|
191
191
|
signing_key:
|
192
192
|
specification_version: 4
|
193
193
|
summary: HTML Report/Formatter for Cucumber and RSpec
|