class Rutema::Reporters::JSON

Experimental reporter used to dump the data of a run on disk

The following configuration keys are used by Rutema::Reporters::JSON

filename - the filename to use to save the YAML dump. Default is 'rutema.results.json'

Constants

DEFAULT_FILENAME

Default report filename

Public Class Methods

new(configuration,dispatcher) click to toggle source
Calls superclass method Rutema::Reporters::BlockReporter::new
# File lib/rutema/reporters/json.rb, line 16
def initialize configuration,dispatcher
  super(configuration,dispatcher)
  @filename=configuration.reporters.fetch(self.class,{}).fetch("filename",DEFAULT_FILENAME)
end

Public Instance Methods

report(specs,states,errors) click to toggle source

We get all the data from a test run in here.

# File lib/rutema/reporters/json.rb, line 21
def report specs,states,errors
  run_entry={}
  run_entry["specs"]=specs.size
  if @configuration && @configuration.context
    run_entry["context"]=@configuration.context
  end
  run_entry["errors"]=errors
  run_entry["states"]=states
  
  Rutema::Utilities.write_file(@filename,::JSON.dump(run_entry))
end