allure-rspec 2.18.0 → 2.20.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: f7c21e789e71fdd7eb259f45f6d3ff464c703c920145db58635097115b8f6c2e
4
- data.tar.gz: 1caaf99dd6991bf6d6804fb12b7de12771e90513a3a89e8db2a9a647bfaa5773
3
+ metadata.gz: b7dca74b7a95c1d8bd4b051066a47a891d54c16a79f0582f625cf55378f5c636
4
+ data.tar.gz: 18210d0b3123b469fb7e7f8edc996a54dae9b59011bc4dab796b096eba3da61a
5
5
  SHA512:
6
- metadata.gz: cd499fd9ca2c764c76fafe386f51542a12dbfc7e040df43052df65c531ddc5b64fae42592f15c67940a06afd2e82b094d226577fddb4cbe62639f8f8b8c39d9f
7
- data.tar.gz: d9dc3811ab13356dccb5ce0c77800a644926a41946e22bec19870f407ba7a8695899a57e98147c964154e352906e0dde1110a7b247c878d717104cfed69439ea
6
+ metadata.gz: 217a347f6efdd37551ef1e63303da9bd25c7fd0a9a91a3f3b14603b1154fe264eb2d1cb49439da0bdb8ce7a6ab2a043764040924b70b19c0000f992c85c8e306
7
+ data.tar.gz: 8f27c2219fa211358805970158908bc59b857505cf3b61011d6174d2a66d6af85d535030f6f78c1cb35f27c37ec4939615f8256f2ae04dfccc6b4132ab6cbe20
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
  ```
@@ -124,7 +124,7 @@ module AllureRspec
124
124
  test_case.stage = Allure::Stage::FINISHED
125
125
  test_case.status = status(result)
126
126
  test_case.status_details.message = status_detail.message
127
- test_case.status_details.trace = status_detail.trace
127
+ test_case.status_details.trace = status_detail.trace&.gsub(/\e\[(\d+)(?:;\d+)*m/, "")
128
128
  end
129
129
  end
130
130
  end
@@ -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.20.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-28 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.20.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.20.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec-core
29
29
  requirement: !ruby/object:Gem::Requirement