allure-ruby-commons 2.13.4 → 2.13.5.rc.1

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: d4e1e312da2184e17972a4064fce982fe5e38c9708990eed6b9a7845f05b15a6
4
- data.tar.gz: add1145dc2d915489946708972dd873651faea543778a17689c33351ca912348
3
+ metadata.gz: b5e32590e85ab38aeb176662bbc9347d4db8f403b1a79faff049d54cc42ef148
4
+ data.tar.gz: a9fac0c1035c7a7e17aa4f08f07f461cf08c6d4dad69f10a935b08d0bb1393c1
5
5
  SHA512:
6
- metadata.gz: d3f7eed0cceceadb095fdb7297ae8f10322f9faa02b65f6e7ab0c664a0fab1ea87de633a933fb8fed236d9ceaa95b196cd8be34ba6f217d99742b09954469178
7
- data.tar.gz: 97513d224b1630d37260cc86889c42edb655d26b0ca37daf0bd67e9bb6d07ee0d10f06b492984399a72830694dabaffa559467db74e2c1c22f011e506891b358
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]
@@ -3,8 +3,8 @@
3
3
  require_relative "jsonable"
4
4
 
5
5
  module Allure
6
+ # Defects category
6
7
  class Category < JSONable
7
- # Defects category
8
8
  # @param [String] name
9
9
  # @param [Array<Allure::Status>] matched_statuses
10
10
  # @param [String, Regexp] message_regex
@@ -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
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-02-25 00:00:00.000000000 Z
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: '0'
131
+ version: 1.3.1
132
132
  requirements: []
133
133
  rubygems_version: 3.1.2
134
134
  signing_key: