FIX: Made turbo_rspec display errors in shared groups correctly

This commit is contained in:
Daniel Waterworth 2019-08-29 12:40:06 +01:00
parent 120077ebee
commit 6b9784cf8a
2 changed files with 23 additions and 2 deletions

View File

@ -57,11 +57,23 @@ module TurboTests
class FakeExample
def self.from_obj(obj)
obj = obj.symbolize_keys
metadata =
obj[:metadata].symbolize_keys
metadata[:shared_group_inclusion_backtrace]
.map! { |frame|
frame = frame.symbolize_keys
RSpec::Core::SharedExampleGroupInclusionStackFrame.new(
frame[:shared_group_name],
frame[:inclusion_location]
)
}
new(
FakeExecutionResult.from_obj(obj[:execution_result]),
obj[:location],
obj[:full_description],
obj[:metadata].symbolize_keys,
metadata,
obj[:location_rerun_argument],
)
end

View File

@ -39,6 +39,13 @@ module TurboTests
}
end
def stack_frame_to_json(frame)
{
shared_group_name: frame.shared_group_name,
inclusion_location: frame.inclusion_location
}
end
def example_to_json(example)
{
execution_result: execution_result_to_json(example.execution_result),
@ -46,7 +53,9 @@ module TurboTests
full_description: example.full_description,
metadata: {
shared_group_inclusion_backtrace:
example.metadata[:shared_group_inclusion_backtrace]
example
.metadata[:shared_group_inclusion_backtrace]
.map(&method(:stack_frame_to_json))
},
location_rerun_argument: example.location_rerun_argument
}