allure-ruby-commons 2.13.4 → 2.13.5.rc.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5e32590e85ab38aeb176662bbc9347d4db8f403b1a79faff049d54cc42ef148
|
4
|
+
data.tar.gz: a9fac0c1035c7a7e17aa4f08f07f461cf08c6d4dad69f10a935b08d0bb1393c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f101580f643b021d6854a9eb21e5aad0ff0d52a379b6dde1777390a50274bc9a513f51c0546729f3500f0d82759e6704fb25176d980e16db73064da79cb8131
|
7
|
+
data.tar.gz: d7acaf42f7f33cc2b7dd6fd81d99a40055603abe06cd1df1136e1472c0de6e2c18824f0b26e520e1ddf7a76be606940dc7de737dcc14a2131a829eccfd5e8c04
|
@@ -195,7 +195,7 @@ module Allure
|
|
195
195
|
# @param [Boolean] test_case add attachment to current test case
|
196
196
|
# @return [void]
|
197
197
|
def add_attachment(name:, source:, type:, test_case: false)
|
198
|
-
attachment = prepare_attachment(name, type) || begin
|
198
|
+
attachment = ResultUtils.prepare_attachment(name, type) || begin
|
199
199
|
return logger.error("Can't add attachment, unrecognized mime type: #{type}")
|
200
200
|
end
|
201
201
|
executable_item = (test_case && @current_test_case) || current_executable
|
@@ -205,16 +205,6 @@ module Allure
|
|
205
205
|
write_attachment(source, attachment)
|
206
206
|
end
|
207
207
|
|
208
|
-
# Create attachment object
|
209
|
-
# @param [String] name
|
210
|
-
# @param [String] type
|
211
|
-
# @return [Allure::Attachment]
|
212
|
-
def prepare_attachment(name, type)
|
213
|
-
extension = ContentType.to_extension(type) || return
|
214
|
-
file_name = "#{UUID.generate}-attachment.#{extension}"
|
215
|
-
Attachment.new(name: name, source: file_name, type: type)
|
216
|
-
end
|
217
|
-
|
218
208
|
# Add step to current fixture|step|test case
|
219
209
|
# @param [Allure::StepResult] step_result
|
220
210
|
# @return [Allure::StepResult]
|
@@ -5,6 +5,9 @@ require "json"
|
|
5
5
|
module Allure
|
6
6
|
# General jsonable object implementation
|
7
7
|
class JSONable
|
8
|
+
# Return object has represantation
|
9
|
+
# @param [Hash] _options
|
10
|
+
# @return [Hash]
|
8
11
|
def as_json(_options = {})
|
9
12
|
instance_variables.each_with_object({}) do |var, map|
|
10
13
|
key = camelcase(var.to_s.delete_prefix("@"))
|
@@ -13,22 +16,33 @@ module Allure
|
|
13
16
|
end
|
14
17
|
end
|
15
18
|
|
19
|
+
# Convert object to json string
|
20
|
+
# @param [Array<Object>] options
|
21
|
+
# @return [String]
|
16
22
|
def to_json(*options)
|
17
23
|
as_json(*options).to_json(*options)
|
18
24
|
end
|
19
25
|
|
26
|
+
# Object comparator
|
27
|
+
# @param [JSONable] other
|
28
|
+
# @return [Booelan]
|
20
29
|
def ==(other)
|
21
30
|
self.class == other.class && state == other.state
|
22
31
|
end
|
23
32
|
|
24
33
|
protected
|
25
34
|
|
35
|
+
# Object state
|
36
|
+
# @return [Array]
|
26
37
|
def state
|
27
38
|
instance_variables.map { |var| instance_variable_get(var) }
|
28
39
|
end
|
29
40
|
|
30
41
|
private
|
31
42
|
|
43
|
+
# Covert string to camelcase
|
44
|
+
# @param [String] str
|
45
|
+
# @return [String]
|
32
46
|
def camelcase(str)
|
33
47
|
str = str.gsub(/(?:_+)([a-z])/) { Regexp.last_match(1).upcase }
|
34
48
|
str.gsub(/(\A|\s)([A-Z])/) { Regexp.last_match(1) + Regexp.last_match(2).downcase }
|
@@ -46,10 +46,15 @@ module Allure
|
|
46
46
|
Label.new(HOST_LABEL_NAME, Socket.gethostname)
|
47
47
|
end
|
48
48
|
|
49
|
+
# Language label
|
50
|
+
# @return [Allure::Label]
|
49
51
|
def language_label
|
50
52
|
Label.new(LANGUAGE_LABEL_NAME, "ruby")
|
51
53
|
end
|
52
54
|
|
55
|
+
# Framework label
|
56
|
+
# @param [String] value
|
57
|
+
# @return [Allure::Label]
|
53
58
|
def framework_label(value)
|
54
59
|
Label.new(FRAMEWORK_LABEL_NAME, value)
|
55
60
|
end
|
@@ -145,6 +150,16 @@ module Allure
|
|
145
150
|
StatusDetails.new(message: exception&.message, trace: exception&.backtrace&.join("\n"))
|
146
151
|
end
|
147
152
|
|
153
|
+
# Allure attachment object
|
154
|
+
# @param [String] name
|
155
|
+
# @param [String] type
|
156
|
+
# @return [Allure::Attachment]
|
157
|
+
def prepare_attachment(name, type)
|
158
|
+
extension = ContentType.to_extension(type) || return
|
159
|
+
file_name = "#{UUID.generate}-attachment.#{extension}"
|
160
|
+
Attachment.new(name: name, source: file_name, type: type)
|
161
|
+
end
|
162
|
+
|
148
163
|
private
|
149
164
|
|
150
165
|
def tms_url(value)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allure-ruby-commons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.13.
|
4
|
+
version: 2.13.5.rc.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrejs Cunskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uuid
|
@@ -126,9 +126,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: 2.5.0
|
127
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - ">"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 1.3.1
|
132
132
|
requirements: []
|
133
133
|
rubygems_version: 3.1.2
|
134
134
|
signing_key:
|