Sha256: 372aee222c0f626ae7ae962438ff6c825429758312691ec68adbd3345858d0bf
Contents?: true
Size: 1.68 KB
Versions: 4
Compression:
Stored size: 1.68 KB
Contents
require 'rspec/core/formatters/base_formatter' require 'json' module RSpec module Core module Formatters class GorgonRspecFormatter < BaseFormatter if Formatters.respond_to? :register Formatters.register self, :message, :stop, :close end attr_reader :output def initialize(output) super @failures = [] end def message(message) @failures += message unless @failures.empty? end def stop(notification=nil) @failures += failures(notification).map do |failure| { test_name: "#{failure.full_description}: line #{failure.metadata[:line_number]}", description: failure.description, full_description: failure.full_description, status: :failed, file_path: failure.metadata[:file_path], line_number: failure.metadata[:line_number], }.tap do |hash| exception = failure.exception unless exception.nil? hash[:class] = exception.class.name hash[:message] = exception.message hash[:location] = exception.backtrace end end end end def failures(notification) if !notification.nil? notification.examples.select { |e| e.execution_result.status == :failed } else examples.select { |e| e.execution_result[:status] == "failed" } end end def close(_notification=nil) output.write @failures.to_json output.close if IO === output && output != $stdout end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems