cornucopia 0.1.24 → 0.1.25
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/lib/cornucopia/util/report_builder.rb +2 -2
- data/lib/cornucopia/version.rb +1 -1
- data/spec/lib/util/report_builder_spec.rb +48 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 935a830f6ee463eeed47e9205eb2c4e6beed72ec
|
4
|
+
data.tar.gz: 3b06aa0ab914fe774a42160e963b8acbc9c26740
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cce1b9e5d66f6ae8145ca30ee35c1c4d6b34c10bf74eb24c8b9fed087cf8272147a58def17e757ca7c61a3a1805557ad96d3f2e4739ebb8ebaad3f035c5ee7d
|
7
|
+
data.tar.gz: f0d35c59e261ded4d4f4efa8d518f2c0635e00ef3d11ae85588c3f9b4933ad6b888715350a94a80448376d0887c0429313a82f114934a5d6f56cea068e49c5ca
|
@@ -48,8 +48,8 @@ module Cornucopia
|
|
48
48
|
def format_code_refs(value)
|
49
49
|
safe_text = Cornucopia::Util::ReportBuilder.escape_string(value)
|
50
50
|
|
51
|
-
safe_text = safe_text.gsub(/(#{Cornucopia::Util::ReportBuilder.root_folder}|\.\/|(?=(?:^features|^spec)\/))([^\:\r\n &]*(
|
52
|
-
"\\1 <span class=\"cornucopia-app-file\">\\2
|
51
|
+
safe_text = safe_text.gsub(/(#{Cornucopia::Util::ReportBuilder.root_folder}|\.\/|(?=(?:^features|^spec)\/))([^\:\r\n &]*(?: *\: *[0-9]+)?)/,
|
52
|
+
"\\1 <span class=\"cornucopia-app-file\">\\2</span> ").html_safe
|
53
53
|
|
54
54
|
safe_text
|
55
55
|
end
|
data/lib/cornucopia/version.rb
CHANGED
@@ -122,6 +122,54 @@ describe Cornucopia::Util::ReportBuilder do
|
|
122
122
|
|
123
123
|
expect(Cornucopia::Util::ReportBuilder.format_code_refs(sample_string)).to be_html_safe
|
124
124
|
end
|
125
|
+
|
126
|
+
it "formats the refs in a string" do
|
127
|
+
sample_string = "This is a sample string ./features/admin2/step_definitions/daily_email_deal_scheduling_steps.rb:445 > :in `block (2 levels) in <top (required)>'"
|
128
|
+
result_string = "This is a sample string ./ <span class=\"cornucopia-app-file\">features/admin2/step_definitions/daily_email_deal_scheduling_steps.rb:445</span> > :in `block (2 levels) in <top (required)>'"
|
129
|
+
|
130
|
+
expect(Cornucopia::Util::ReportBuilder.format_code_refs(sample_string)).to be == result_string
|
131
|
+
end
|
132
|
+
|
133
|
+
it "formats the refs in a string but not the : after unless it has a number" do
|
134
|
+
sample_string = "This is a sample string ./features/admin2/step_definitions/daily_email_deal_scheduling_steps.rb :in `block (2 levels) in <top (required)>'"
|
135
|
+
result_string = "This is a sample string ./ <span class=\"cornucopia-app-file\">features/admin2/step_definitions/daily_email_deal_scheduling_steps.rb</span> :in `block (2 levels) in <top (required)>'"
|
136
|
+
|
137
|
+
expect(Cornucopia::Util::ReportBuilder.format_code_refs(sample_string)).to be == result_string
|
138
|
+
end
|
139
|
+
|
140
|
+
it "formats the refs in a string starting with features" do
|
141
|
+
sample_string = "features/admin2/step_definitions/daily_email_deal_scheduling_steps.rb : 445 > :in `block (2 levels) in <top (required)>'"
|
142
|
+
result_string = " <span class=\"cornucopia-app-file\">features/admin2/step_definitions/daily_email_deal_scheduling_steps.rb : 445</span> > :in `block (2 levels) in <top (required)>'"
|
143
|
+
|
144
|
+
expect(Cornucopia::Util::ReportBuilder.format_code_refs(sample_string)).to be == result_string
|
145
|
+
end
|
146
|
+
|
147
|
+
it "formats the refs in a string starting with spec" do
|
148
|
+
sample_string = "spec/admin2/step_definitions/daily_email_deal_scheduling_steps.rb : 445 > :in `block (2 levels) in <top (required)>'"
|
149
|
+
result_string = " <span class=\"cornucopia-app-file\">spec/admin2/step_definitions/daily_email_deal_scheduling_steps.rb : 445</span> > :in `block (2 levels) in <top (required)>'"
|
150
|
+
|
151
|
+
expect(Cornucopia::Util::ReportBuilder.format_code_refs(sample_string)).to be == result_string
|
152
|
+
end
|
153
|
+
|
154
|
+
it "formats the refs root refs in a string" do
|
155
|
+
sample_string = "This is a sample string c:/bizarro/features/admin2/step_definitions/daily_email_deal_scheduling_steps.rb:445 > :in `block (2 levels) in <top (required)>'"
|
156
|
+
result_string = "This is a sample string c:/bizarro/ <span class=\"cornucopia-app-file\">features/admin2/step_definitions/daily_email_deal_scheduling_steps.rb:445</span> > :in `block (2 levels) in <top (required)>'"
|
157
|
+
|
158
|
+
allow(Cornucopia::Util::ReportBuilder).to receive(:root_folder).and_return("c:/bizarro/")
|
159
|
+
|
160
|
+
expect(Cornucopia::Util::ReportBuilder.format_code_refs(sample_string)).to be == result_string
|
161
|
+
end
|
162
|
+
|
163
|
+
it "formats multiple refs root refs in a string" do
|
164
|
+
sample_string = "This is a sample string c:/bizarro/features/admin2/step_definitions/daily_email_deal_scheduling_steps.rb:445 > :in `block (2 levels) in <top (required)>'
|
165
|
+
This is a sample string c:/bizarro/features/admin2/step_definitions/daily_email_deal_scheduling_steps.rb:445 > :in `block (2 levels) in <top (required)>'"
|
166
|
+
result_string = "This is a sample string c:/bizarro/ <span class=\"cornucopia-app-file\">features/admin2/step_definitions/daily_email_deal_scheduling_steps.rb:445</span> > :in `block (2 levels) in <top (required)>'
|
167
|
+
This is a sample string c:/bizarro/ <span class=\"cornucopia-app-file\">features/admin2/step_definitions/daily_email_deal_scheduling_steps.rb:445</span> > :in `block (2 levels) in <top (required)>'"
|
168
|
+
|
169
|
+
allow(Cornucopia::Util::ReportBuilder).to receive(:root_folder).and_return("c:/bizarro/")
|
170
|
+
|
171
|
+
expect(Cornucopia::Util::ReportBuilder.format_code_refs(sample_string)).to be == result_string
|
172
|
+
end
|
125
173
|
end
|
126
174
|
|
127
175
|
describe "#root_folder" do
|