allure-rspec 2.18.0 → 2.19.0

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: f7c21e789e71fdd7eb259f45f6d3ff464c703c920145db58635097115b8f6c2e
4
- data.tar.gz: 1caaf99dd6991bf6d6804fb12b7de12771e90513a3a89e8db2a9a647bfaa5773
3
+ metadata.gz: de7455867459ef68f72755b931fd0a850c0d83d97ee242511dd0bf051a771ef7
4
+ data.tar.gz: 793b869aa5fb9549499cb48e64e39b2c0d40099850b01bcf738090a51beef97d
5
5
  SHA512:
6
- metadata.gz: cd499fd9ca2c764c76fafe386f51542a12dbfc7e040df43052df65c531ddc5b64fae42592f15c67940a06afd2e82b094d226577fddb4cbe62639f8f8b8c39d9f
7
- data.tar.gz: d9dc3811ab13356dccb5ce0c77800a644926a41946e22bec19870f407ba7a8695899a57e98147c964154e352906e0dde1110a7b247c878d717104cfed69439ea
6
+ metadata.gz: 9719183b03cfabba95267ff95ab303bcb4079f416ad8ce4871df6c10df6009922ce25e0ac43dda82c181911d453294fd7bf28ee1ca192efd327161c659059d67
7
+ data.tar.gz: 45261d1206d7cefac2f3af59f56d710f604a7215055f16e2aebc7dd8ef195ab1741a0f25aecdb6de802ce2fac88b8fbaeb1b4b02cd765f375cb13815b0e3a07a
data/README.md CHANGED
@@ -144,18 +144,28 @@ end
144
144
 
145
145
  ### Adding additional labels to allure test case
146
146
 
147
- Additional labels can be added using `allure_` pattern:
147
+ - All metadata tags that have no value are added as labels:
148
148
 
149
149
  ```ruby
150
- it "some test case", allure_1: "visual_test", allure_2: "core_functionality" do
150
+ it "some test case", :visual_test, :core_functionality do
151
151
  # test
152
152
  end
153
153
  ```
154
154
 
155
- All other metadata tags are also automatically added as labels:
155
+ - For tags that define value as string or symbol, value is added as label:
156
156
 
157
157
  ```ruby
158
- it "some test case", :visual_test, :core_functionality do
158
+ it "some test case", test_type: "visual_test", functionality: "core_functionality" do
159
+ # test
160
+ end
161
+ ```
162
+
163
+ will add `visual_test` and `core_functionality` labels to test case.
164
+
165
+ - Tags that have value as `false` will not be added as labels:
166
+
167
+ ```ruby
168
+ it "some test case", skipped: false do
159
169
  # test
160
170
  end
161
171
  ```
@@ -114,11 +114,14 @@ module AllureRspec
114
114
  end
115
115
 
116
116
  # Get custom labels
117
+ # skip tags that are set to false explicitly
118
+ # use value as label when it's a string or a symbol
119
+ #
117
120
  # @return [Array<Allure::Label>]
118
121
  def tag_labels
119
122
  metadata
120
123
  .reject { |k| RSPEC_IGNORED_METADATA.include?(k) || special_metadata_tag?(k) }
121
- .map { |k, v| allure?(k) ? Allure::ResultUtils.tag_label(v) : Allure::ResultUtils.tag_label(k.to_s) }
124
+ .filter_map { |k, v| custom_label(k, v) }
122
125
  end
123
126
 
124
127
  # Get behavior labels
@@ -148,6 +151,18 @@ module AllureRspec
148
151
  .map { |key, value| Allure::ResultUtils.public_send("#{type}_link", key.to_s, value, link_pattern) }
149
152
  end
150
153
 
154
+ # Label value from custom metadata
155
+ #
156
+ # @param [String, Symbol] key
157
+ # @param [Object] value
158
+ # @return [Allure::Label]
159
+ def custom_label(key, value)
160
+ return if value == false
161
+ return Allure::ResultUtils.tag_label(value.to_s) if value.is_a?(String) || value.is_a?(Symbol)
162
+
163
+ Allure::ResultUtils.tag_label(key.to_s)
164
+ end
165
+
151
166
  # Special allure metadata tags
152
167
  #
153
168
  # @param [Symbol] key
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allure-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.18.0
4
+ version: 2.19.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: 2022-05-23 00:00:00.000000000 Z
11
+ date: 2022-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: allure-ruby-commons
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.18.0
19
+ version: 2.19.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.18.0
26
+ version: 2.19.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec-core
29
29
  requirement: !ruby/object:Gem::Requirement