allure-ruby-commons 2.14.4 → 2.14.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c0de1e98a75e290b8d066efde7d33692cd5debc19f447366e04f7a92485d98a
4
- data.tar.gz: f23e6231dfff4143a1708d4eaa93595753ead503935cc5e59c50bcbc4361c2b4
3
+ metadata.gz: 35b9aec57c1f8d285f55f1463266c70daec925400f3880ddf6cacd2b237eb120
4
+ data.tar.gz: 5fe9f0fcef4d39ed38cec526856712948f77c72529e13fe342e507ffcdf2ad2b
5
5
  SHA512:
6
- metadata.gz: 171e1b60a3b68fce23f6147287f66b70a981b034cd4edba79c9da87284b7c7b1243936c4cbf34227973e0b6ad4213b10372db6293e5b176e3c5c9d1a83430376
7
- data.tar.gz: d3c7c64d174b8fd53ca389dadb083efc52b75ec4e8413daa17e4e4ff8d82f9978f62a714d21adb08639292abaa8b5c40f027ea1db7a2cbba1eadcdfe52ac9e87
6
+ metadata.gz: b0d038d11530965ea7cc37135496fe4e0071a8fb8f975d9bad3be724e5c04b9b88ae6027a2cd6a2ed227e499742e2ec35cb63e87062bbcec0696b6def3609ed8
7
+ data.tar.gz: 7a9dca1b51f2d0948aec73ef6749a289a8ef6be9831dcca3ba80292defedb42c58ad47e2cfce8b810bf2845ea0e02963bb5b9135bb29b422e9b854b9385b5dab
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "socket"
4
+ require "uri"
4
5
 
5
6
  module Allure
6
7
  # Variouse helper methods
@@ -133,16 +134,18 @@ module Allure
133
134
  # @param [String] value
134
135
  # @param [String] link_pattern
135
136
  # @return [Allure::Link]
136
- def tms_link(value, link_pattern)
137
- Link.new(TMS_LINK_TYPE, value, url(value, link_pattern))
137
+ def tms_link(name, value, link_pattern)
138
+ link_name = url?(value) ? name : value
139
+ Link.new(TMS_LINK_TYPE, link_name, url(value, link_pattern))
138
140
  end
139
141
 
140
142
  # Issue link
141
143
  # @param [String] value
142
144
  # @param [String] link_pattern
143
145
  # @return [Allure::Link]
144
- def issue_link(value, link_pattern)
145
- Link.new(ISSUE_LINK_TYPE, value, url(value, link_pattern))
146
+ def issue_link(name, value, link_pattern)
147
+ link_name = url?(value) ? name : value
148
+ Link.new(ISSUE_LINK_TYPE, link_name, url(value, link_pattern))
146
149
  end
147
150
 
148
151
  # Get status based on exception type
@@ -171,6 +174,19 @@ module Allure
171
174
 
172
175
  private
173
176
 
177
+ # Check if value is full url
178
+ #
179
+ # @param [String] value
180
+ # @return [Boolean]
181
+ def url?(value)
182
+ URI.parse(value.to_s).scheme
183
+ end
184
+
185
+ # Construct url from pattern
186
+ #
187
+ # @param [String] value
188
+ # @param [String] link_pattern
189
+ # @return [String]
174
190
  def url(value, link_pattern)
175
191
  link_pattern.sub("{}", value)
176
192
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allure-ruby-commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.14.4
4
+ version: 2.14.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrejs Cunskis