allure-ruby-commons 2.21.2 → 2.22.0

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: bd98c6464edda2d8f2095866f00cb567c6f3daeb4d591a4e742fbf814b365ded
4
- data.tar.gz: 0f01fffeda2b9957de193a23070864070cc7ee7adddcbdcfbd8d238db1739567
3
+ metadata.gz: '099ba3dddaa422aadd6805174b9ea6355be15b89b0587baf39d379dfda0763ad'
4
+ data.tar.gz: 066eb591f740c700e09f712b86b83c28bac6fd903321d8643426872a0ba61bbe
5
5
  SHA512:
6
- metadata.gz: 157cee12a334d96847540fc49096d2d34f2f41e64a38e285f43fee9beb8751a0c7f751d5b13ec99ae02e9dffa4edf68c40af9877fc177ac105d89a050b633c87
7
- data.tar.gz: 372b8b2cade3f8d461b989087c56fea808e049d272f007aacea695b5e8319b3e0c128170c1dd2d27b3866697e3a1a67387f0b5a7d84f3b3751a99ec914fd7d66
6
+ metadata.gz: c6f36b3ecdc794f0ddb952e125a9cd55600763478038dd7634ff40e7131f75f246a726bf189871f6581a4a051b5c095b605ffcc464389dcb8538eed5bcdf3cf5
7
+ data.tar.gz: 94efb6010db9cbca76f4136567a6c4330108ec6b2d140f36d007dcb5c64ae53fd5ed4dd05cb7184119af04d894f4eea1f5da78238bf7377c823e947d614edd56
@@ -6,9 +6,9 @@ module Allure
6
6
  # Return object hash represantation
7
7
  # @return [Hash]
8
8
  def to_hash
9
- instance_variables.each_with_object({}) do |var, map|
10
- key = camelcase(var.to_s.delete_prefix("@"))
11
- value = instance_variable_get(var)
9
+ json_attributes.each_with_object({}) do |attribute, map|
10
+ key = camelcase(attribute)
11
+ value = send(attribute) # fetch via reader for dynamically generated attributes
12
12
  map[key] = value unless value.nil?
13
13
  end
14
14
  end
@@ -33,7 +33,7 @@ module Allure
33
33
  # Object state
34
34
  # @return [Array]
35
35
  def state
36
- instance_variables.map { |var| instance_variable_get(var) }
36
+ json_attributes.map { |attribute| send(attribute) }
37
37
  end
38
38
 
39
39
  private
@@ -45,5 +45,12 @@ module Allure
45
45
  str = str.gsub(/(?:_+)([a-z])/) { Regexp.last_match(1).upcase }
46
46
  str.gsub(/(\A|\s)([A-Z])/) { Regexp.last_match(1) + Regexp.last_match(2).downcase }
47
47
  end
48
+
49
+ # Json attribute names
50
+ #
51
+ # @return [Array<String>]
52
+ def json_attributes
53
+ @json_attributes ||= instance_variables.map { |attribute| attribute.to_s.delete_prefix("@") }
54
+ end
48
55
  end
49
56
  end
@@ -15,5 +15,7 @@ module Allure
15
15
  @message_regex = message_regex
16
16
  @trace_regex = trace_regex
17
17
  end
18
+
19
+ attr_reader :name, :matched_statuses, :message_regex, :trace_regex
18
20
  end
19
21
  end
@@ -24,7 +24,7 @@ module Allure
24
24
 
25
25
  @name = options[:name]
26
26
  @uuid = uuid
27
- @history_id = Digest::MD5.hexdigest("#{history_id}#{environment}")
27
+ @history_id = history_id
28
28
  @full_name = options[:full_name] || "Unnamed"
29
29
  @labels = options[:labels] || []
30
30
  @links = options[:links] || []
@@ -32,9 +32,26 @@ module Allure
32
32
  end
33
33
 
34
34
  attr_accessor :uuid,
35
- :history_id,
36
35
  :full_name,
37
36
  :labels,
38
37
  :links
38
+
39
+ attr_writer :history_id
40
+
41
+ # History id
42
+ #
43
+ # @return [String]
44
+ def history_id
45
+ Digest::MD5.hexdigest("#{@history_id}#{parameters_string}")
46
+ end
47
+
48
+ private
49
+
50
+ # All parameters string
51
+ #
52
+ # @return [String]
53
+ def parameters_string
54
+ parameters.map { |p| "#{p.name}=#{p.value}" }.join(";")
55
+ end
39
56
  end
40
57
  end
@@ -14,6 +14,15 @@ module Allure
14
14
  @links = []
15
15
  end
16
16
 
17
- attr_accessor :uuid, :name, :description, :description_html, :start, :stop, :children, :befores, :afters, :links
17
+ attr_accessor :uuid,
18
+ :name,
19
+ :description,
20
+ :description_html,
21
+ :start,
22
+ :stop,
23
+ :children,
24
+ :befores,
25
+ :afters,
26
+ :links
18
27
  end
19
28
  end
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.21.2
4
+ version: 2.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrejs Cunskis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-31 00:00:00.000000000 Z
11
+ date: 2023-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types
@@ -133,14 +133,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
133
  requirements:
134
134
  - - ">="
135
135
  - !ruby/object:Gem::Version
136
- version: 2.7.0
136
+ version: 3.0.0
137
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  requirements:
139
139
  - - ">="
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubygems_version: 3.3.7
143
+ rubygems_version: 3.4.10
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Common library for allure results generation