allure-ruby-commons 2.21.0 → 2.21.2
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 +4 -4
- data/lib/allure_ruby_commons/_json_helper.rb +4 -0
- data/lib/allure_ruby_commons/testplan.rb +19 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd98c6464edda2d8f2095866f00cb567c6f3daeb4d591a4e742fbf814b365ded
|
4
|
+
data.tar.gz: 0f01fffeda2b9957de193a23070864070cc7ee7adddcbdcfbd8d238db1739567
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 157cee12a334d96847540fc49096d2d34f2f41e64a38e285f43fee9beb8751a0c7f751d5b13ec99ae02e9dffa4edf68c40af9877fc177ac105d89a050b633c87
|
7
|
+
data.tar.gz: 372b8b2cade3f8d461b989087c56fea808e049d272f007aacea695b5e8319b3e0c128170c1dd2d27b3866697e3a1a67387f0b5a7d84f3b3751a99ec914fd7d66
|
@@ -28,9 +28,12 @@ module Allure
|
|
28
28
|
define_method(:load_json) do |json|
|
29
29
|
Oj.load_file(json, symbol_keys: true)
|
30
30
|
rescue Oj::ParseError
|
31
|
+
Allure.configuration.logger.error("Failed to parse json: #{json}")
|
31
32
|
nil
|
32
33
|
end
|
33
34
|
rescue LoadError
|
35
|
+
require "json"
|
36
|
+
|
34
37
|
define_method(:dump_json) do |obj|
|
35
38
|
JSON.generate(obj)
|
36
39
|
end
|
@@ -38,6 +41,7 @@ module Allure
|
|
38
41
|
define_method(:load_json) do |json|
|
39
42
|
JSON.parse(File.read(json), symbolize_names: true)
|
40
43
|
rescue JSON::ParserError
|
44
|
+
Allure.configuration.logger.error("Failed to parse json: #{json}")
|
41
45
|
nil
|
42
46
|
end
|
43
47
|
end
|
@@ -28,7 +28,25 @@ module Allure
|
|
28
28
|
#
|
29
29
|
# @return [Array<Hash>]
|
30
30
|
def tests
|
31
|
-
@tests ||= load_json(
|
31
|
+
@tests ||= load_json(test_plan_path)&.fetch(:tests) if test_plan_path
|
32
|
+
end
|
33
|
+
|
34
|
+
# Fetch test plan path
|
35
|
+
#
|
36
|
+
# @return [<String, nil>]
|
37
|
+
def test_plan_path
|
38
|
+
return @test_plan_path if defined?(@test_plan_path)
|
39
|
+
|
40
|
+
@test_plan_path = ENV[TESTPLAN_PATH].then do |path|
|
41
|
+
next unless path
|
42
|
+
next path if File.file?(path)
|
43
|
+
|
44
|
+
json = File.join(path, "testplan.json")
|
45
|
+
next json if File.exist?(json)
|
46
|
+
|
47
|
+
Allure.configuration.logger.warn("'ALLURE_TESTPLAN_PATH' env var is set, but no testplan.json found!")
|
48
|
+
nil
|
49
|
+
end
|
32
50
|
end
|
33
51
|
end
|
34
52
|
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.
|
4
|
+
version: 2.21.2
|
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-
|
11
|
+
date: 2023-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|