Sha256: 595cd6077384e8809da964ac96d5e4d62b0bb64a396b80adbc6f80ae922e5159

Contents?: true

Size: 557 Bytes

Versions: 2

Compression:

Stored size: 557 Bytes

Contents

require 'rspec/core/formatters/base_formatter'

module RSpecSearchAndDestroy
  class OrderFormatter < RSpec::Core::Formatters::BaseFormatter
    def stop
      if enabled?
        File.open(filename, 'wb') do |f|
          Marshal.dump(results, f)
        end
      end

      super
    end

    private

    def enabled?
      filename
    end

    def filename
      ENV['RSPEC_SAD_RESULTS']
    end

    def results
      examples.map do |e|
        {
          location: e.location,
          failed: !!e.exception
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-search-and-destroy-0.0.4 lib/rspec-search-and-destroy/order_formatter.rb
rspec-search-and-destroy-0.0.3 lib/rspec-search-and-destroy/order_formatter.rb