Class: Dragnet::Exporters::JSONExporter

Inherits:
Exporter
  • Object
show all
Defined in:
lib/dragnet/exporters/json_exporter.rb

Overview

Exports the results for the Manual Test Record verification to a JSON string.

Instance Attribute Summary

Attributes inherited from Exporter

#errors, #logger, #repository, #test_records

Instance Method Summary collapse

Methods inherited from Exporter

#initialize

Constructor Details

This class inherits a constructor from Dragnet::Exporters::Exporter

Instance Method Details

#exportString

Returns A JSON string containing an array of objects, one for each Test Record.

Returns:

  • (String)

    A JSON string containing an array of objects, one for each Test Record.



16
17
18
19
20
21
22
23
# File 'lib/dragnet/exporters/json_exporter.rb', line 16

def export
  logger.info 'Exporting data to JSON'
  test_records.map do |test_record|
    ::Dragnet::Exporters::Serializers::TestRecordSerializer
      .new(test_record, repository).serialize
      .merge(id: id_generator.id_for(test_record))
  end.to_json
end