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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef45d4d18ad938d5938b24b72aef051e32bac2ba
4
- data.tar.gz: 790fdc748ce0c81864570425f5a3fc780fd1c5b5
3
+ metadata.gz: 935a830f6ee463eeed47e9205eb2c4e6beed72ec
4
+ data.tar.gz: 3b06aa0ab914fe774a42160e963b8acbc9c26740
5
5
  SHA512:
6
- metadata.gz: c2a910e0e709f6a6369896afca72449b310233ed70d509000a439691b708e8862a7ead7d441d8c64baf320dd1fad062916c3634d3bdccd60893a1e2c3ae564be
7
- data.tar.gz: a73bb3a1dc30aead997a617341ed25e799cf3185659b9a49648c3720289493e5804e933fa90a69a44ea9708f03261fb126c327ee84e8436f212a7e7dc3316390
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 &]*(?:\:[^\:\r\n\>& ]*)?)/,
52
- "\\1 <span class=\"cornucopia-app-file\">\\2\\3</span> ").html_safe
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
@@ -1,3 +1,3 @@
1
1
  module Cornucopia
2
- VERSION = "0.1.24"
2
+ VERSION = "0.1.25"
3
3
  end
@@ -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> &gt; :in `block (2 levels) in &lt;top (required)&gt;&#39;"
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 &lt;top (required)&gt;&#39;"
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> &gt; :in `block (2 levels) in &lt;top (required)&gt;&#39;"
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> &gt; :in `block (2 levels) in &lt;top (required)&gt;&#39;"
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> &gt; :in `block (2 levels) in &lt;top (required)&gt;&#39;"
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> &gt; :in `block (2 levels) in &lt;top (required)&gt;&#39;
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> &gt; :in `block (2 levels) in &lt;top (required)&gt;&#39;"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cornucopia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.24
4
+ version: 0.1.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - RealNobody