Skip to content

Commit f8430b4

Browse files
authored
Remove max nesting limit when creating results (#151)
1 parent 8070472 commit f8430b4

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

allure-ruby-commons/lib/allure_ruby_commons/file_writer.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@ class FileWriter
1818
# @param [Allure::TestResult] test_result
1919
# @return [void]
2020
def write_test_result(test_result)
21-
write("#{test_result.uuid}#{TEST_RESULT_SUFFIX}", test_result.to_json)
21+
write("#{test_result.uuid}#{TEST_RESULT_SUFFIX}", JSON.generate(test_result, max_nesting: false))
2222
end
2323

2424
# Write test result container
2525
# @param [Allure::TestResultContainer] test_container_result
2626
# @return [void]
2727
def write_test_result_container(test_container_result)
28-
write("#{test_container_result.uuid}#{TEST_RESULT_CONTAINER_SUFFIX}", test_container_result.to_json)
28+
write(
29+
"#{test_container_result.uuid}#{TEST_RESULT_CONTAINER_SUFFIX}",
30+
JSON.generate(test_container_result, max_nesting: false),
31+
)
2932
end
3033

3134
# Write allure attachment file

allure-ruby-commons/lib/allure_ruby_commons/model/jsonable.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ module Allure
66
# General jsonable object implementation
77
class JSONable
88
# Return object has represantation
9-
# @param [Hash] _options
9+
# @param [Array<Object>] _options
1010
# @return [Hash]
11-
def as_json(_options = {})
11+
def as_json(*_options)
1212
instance_variables.each_with_object({}) do |var, map|
1313
key = camelcase(var.to_s.delete_prefix("@"))
1414
value = instance_variable_get(var)
@@ -20,7 +20,7 @@ def as_json(_options = {})
2020
# @param [Array<Object>] options
2121
# @return [String]
2222
def to_json(*options)
23-
as_json(*options).to_json(*options)
23+
as_json.to_json(*options)
2424
end
2525

2626
# Object comparator

0 commit comments

Comments
 (0)