lib/cucumber/messages.deserializers.rb in cucumber-messages-20.0.0 vs lib/cucumber/messages.deserializers.rb in cucumber-messages-21.0.0
- old
+ new
@@ -86,10 +86,30 @@
undefined_parameter_type: UndefinedParameterType.from_h(hash[:undefinedParameterType]),
)
end
end
+ class Exception
+
+ ##
+ # Returns a new Exception from the given hash.
+ # If the hash keys are camelCased, they are properly assigned to the
+ # corresponding snake_cased attributes.
+ #
+ # Cucumber::Messages::Exception.from_h(some_hash) # => #<Cucumber::Messages::Exception:0x... ...>
+ #
+
+ def self.from_h(hash)
+ return nil if hash.nil?
+
+ self.new(
+ type: hash[:type],
+ message: hash[:message],
+ )
+ end
+ end
+
class GherkinDocument
##
# Returns a new GherkinDocument from the given hash.
# If the hash keys are camelCased, they are properly assigned to the
@@ -1052,10 +1072,11 @@
self.new(
message: hash[:message],
success: hash[:success],
timestamp: Timestamp.from_h(hash[:timestamp]),
+ exception: Exception.from_h(hash[:exception]),
)
end
end
class TestRunStarted
@@ -1114,9 +1135,10 @@
self.new(
duration: Duration.from_h(hash[:duration]),
message: hash[:message],
status: hash[:status],
+ exception: Exception.from_h(hash[:exception]),
)
end
end
class TestStepStarted