Class: FlakyTestTracker::Serializers::TestHTMLSerializer
- Inherits:
-
Object
- Object
- FlakyTestTracker::Serializers::TestHTMLSerializer
- Defined in:
- lib/flaky_test_tracker/serializers/test_html_serializer.rb
Overview
Test HTML serializer.
Instance Attribute Summary collapse
-
#html_serializer ⇒ Object
readonly
Returns the value of attribute html_serializer.
Instance Method Summary collapse
- #deserialize(html) ⇒ FlakyTestTracker::Test
-
#initialize(html_serializer: HTMLCommentSerializer.new) ⇒ TestHTMLSerializer
constructor
A new instance of TestHTMLSerializer.
-
#serialize(test) ⇒ String
The HTML representing the test serialized.
Constructor Details
#initialize(html_serializer: HTMLCommentSerializer.new) ⇒ TestHTMLSerializer
Returns a new instance of TestHTMLSerializer.
20 21 22 |
# File 'lib/flaky_test_tracker/serializers/test_html_serializer.rb', line 20 def initialize(html_serializer: HTMLCommentSerializer.new) @html_serializer = html_serializer end |
Instance Attribute Details
#html_serializer ⇒ Object (readonly)
Returns the value of attribute html_serializer.
17 18 19 |
# File 'lib/flaky_test_tracker/serializers/test_html_serializer.rb', line 17 def html_serializer @html_serializer end |
Instance Method Details
#deserialize(html) ⇒ FlakyTestTracker::Test
35 36 37 38 39 40 41 |
# File 'lib/flaky_test_tracker/serializers/test_html_serializer.rb', line 35 def deserialize(html) from_json( html_serializer.deserialize(html) ) rescue ActiveSupport::JSON.parse_error raise FlakyTestTracker::Error::DeserializeError end |
#serialize(test) ⇒ String
Returns The HTML representing the test serialized.
26 27 28 29 30 |
# File 'lib/flaky_test_tracker/serializers/test_html_serializer.rb', line 26 def serialize(test) html_serializer.serialize( to_json(test) ) end |