allure-ruby-commons 2.16.0 → 2.17.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: 1693932b785f983a4fbf0578d91210b32cb01d9a54d2e75867d484bdaa5e3017
4
- data.tar.gz: 63903a5a5e38fef5f5db1a4b263a6aa0da6ab18cd7217530fa448c626684d257
3
+ metadata.gz: 5184aecf13d09a0047b56c75f07c39d8697e7e1f45572088a823c5fe919d683e
4
+ data.tar.gz: 98862beedc730ac669137beba90027e3f1bc1abf17ae838d3e8f0b40786a084c
5
5
  SHA512:
6
- metadata.gz: 9f4bdd16a55c95f1c8c47751d7123eec6d3fd6edb9bd4e0064e657b23a4791eb5c00753f5381079122d6630d7cb726ed3f1d8f3e6c384070a513943af056d3e0
7
- data.tar.gz: d371fb2e1e508e1f5959ba0dd88eb61fa0a10ba00a767607a59c86af6d8a996cf2ef964d320a7bb994b000890d69ad4d57e9042321fb1a5a32ff52d3a1832df3
6
+ metadata.gz: 5efb3f03645ed43d5fc5e64d72c8af77c5cb5eed5711d0e3c357ed0e0bb6e4ed300071117760d084670f93e56661acd9885d1dddc19159bd6048d71bf9460d72
7
+ data.tar.gz: 3c1c26e729c5d25e3e8a491aa590cf3a1ef8e16ac0b55fc8bd2c778ff0446f478200bea49e63fcf66560114f1508b263ff6a7aa629db058e1651ce0f449fafe8
@@ -179,6 +179,33 @@ module Allure
179
179
  lifecycle.write_categories(categories)
180
180
  end
181
181
 
182
+ # Set test case status detail to flaky
183
+ #
184
+ # @return [void]
185
+ def set_flaky
186
+ lifecycle.update_test_case do |test_case|
187
+ test_case.status_details.flaky = true
188
+ end
189
+ end
190
+
191
+ # Set test case status detail to muted
192
+ #
193
+ # @return [void]
194
+ def set_muted
195
+ lifecycle.update_test_case do |test_case|
196
+ test_case.status_details.muted = true
197
+ end
198
+ end
199
+
200
+ # Set test case status detail to known
201
+ #
202
+ # @return [void]
203
+ def set_known
204
+ lifecycle.update_test_case do |test_case|
205
+ test_case.status_details.known = true
206
+ end
207
+ end
208
+
182
209
  # Add step with provided name and optional status to current test step, fixture or test case
183
210
  # @param [String] name
184
211
  # @param [Symbol] status {Status}, {Status::PASSED} by default
@@ -16,7 +16,6 @@ module Allure
16
16
  @step_context = []
17
17
  @config = config
18
18
  @logger = config.logger
19
- @file_writer = FileWriter.new(config.results_directory)
20
19
  end
21
20
 
22
21
  attr_reader :config
@@ -259,7 +258,11 @@ module Allure
259
258
 
260
259
  private
261
260
 
262
- attr_reader :logger, :file_writer
261
+ attr_reader :logger
262
+
263
+ def file_writer
264
+ @file_writer ||= FileWriter.new(config.results_directory)
265
+ end
263
266
 
264
267
  def current_executable
265
268
  current_test_step || @current_fixture || @current_test_case
@@ -13,6 +13,8 @@ module Allure
13
13
  ENVIRONMENT_FILE = "environment.properties"
14
14
  # @return [String] categories definition json
15
15
  CATEGORIES_FILE = "categories.json"
16
+ # @return [Hash] Oj json options
17
+ OJ_OPTIONS = { mode: :custom, use_to_hash: true, ascii_only: true }.freeze
16
18
 
17
19
  # File writer instance
18
20
  #
@@ -25,14 +27,14 @@ module Allure
25
27
  # @param [Allure::TestResult] test_result
26
28
  # @return [void]
27
29
  def write_test_result(test_result)
28
- write("#{test_result.uuid}#{TEST_RESULT_SUFFIX}", Oj.dump(test_result))
30
+ write("#{test_result.uuid}#{TEST_RESULT_SUFFIX}", Oj.dump(test_result, OJ_OPTIONS))
29
31
  end
30
32
 
31
33
  # Write test result container
32
34
  # @param [Allure::TestResultContainer] test_container_result
33
35
  # @return [void]
34
36
  def write_test_result_container(test_container_result)
35
- write("#{test_container_result.uuid}#{TEST_RESULT_CONTAINER_SUFFIX}", Oj.dump(test_container_result))
37
+ write("#{test_container_result.uuid}#{TEST_RESULT_CONTAINER_SUFFIX}", Oj.dump(test_container_result, OJ_OPTIONS))
36
38
  end
37
39
 
38
40
  # Write allure attachment file
@@ -59,7 +61,7 @@ module Allure
59
61
  if categories.is_a?(File)
60
62
  copy(categories.path, CATEGORIES_FILE)
61
63
  else
62
- write(CATEGORIES_FILE, Oj.dump(categories))
64
+ write(CATEGORIES_FILE, Oj.dump(categories, OJ_OPTIONS))
63
65
  end
64
66
  end
65
67
 
@@ -5,8 +5,6 @@ require "oj"
5
5
  module Allure
6
6
  # General jsonable object implementation
7
7
  class JSONable
8
- Oj.default_options = { mode: :custom, use_to_hash: true, ascii_only: true }
9
-
10
8
  # Return object hash represantation
11
9
  # @return [Hash]
12
10
  def to_hash
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.16.0
4
+ version: 2.17.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-01-22 00:00:00.000000000 Z
11
+ date: 2022-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  - !ruby/object:Gem::Version
146
146
  version: '0'
147
147
  requirements: []
148
- rubygems_version: 3.3.3
148
+ rubygems_version: 3.3.7
149
149
  signing_key:
150
150
  specification_version: 4
151
151
  summary: Common library for allure results generation