Sha256: 40dd4b50f75190f08116672c83ce92b196ef903a3bc616b6de0c2dfc59d1f9d7

Contents?: true

Size: 592 Bytes

Versions: 1

Compression:

Stored size: 592 Bytes

Contents

require 'rspec/core/formatters/base_formatter'
require 'multi_json'
require 'airborne_report/report'
require 'airborne_report/storage/tests'

module AirborneReport
  class RspecJsonFormatter < RSpec::Core::Formatters::BaseFormatter
    RSpec::Core::Formatters.register self, :stop

    def stop(notification)
      tests = AirborneReport::Storage::Tests.all

      report = Report.new(tests, notification).to_hash
      craft_json(report)
    end

    def craft_json(report)
      File.open('report.json', 'w') do |file|
        file.write(MultiJson.dump(report))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
airborne_report-0.2.0 lib/airborne_report/rspec_json_formatter.rb