Sha256: e3399b708965dc8ea7c79f35947a3fa4a8ed28c18e22788d6b9c042cae02dc8e

Contents?: true

Size: 618 Bytes

Versions: 2

Compression:

Stored size: 618 Bytes

Contents

# frozen_string_literal: true

module RShade
  # rubocop:disable Style/MutableConstant
  REPORTS = []
  # rubocop:enable Style/MutableConstant

  module RSpecHelper
    def rshade_reveal(options = {}, &block)
      raise 'No block given' unless block_given?

      options.merge!(formatter: Formatter::String) { |_key, v1, _v2| v1 }
      result = Trace.reveal(options, &block)
      REPORTS.push result.show
    end
  end
end

if defined? RSpec
  RSpec.configure do |c|
    c.include RShade::RSpecHelper

    c.after(:suite) do
      RShade::REPORTS.each(&method(:puts))
      RShade::REPORTS.clear
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rshade-0.2.2 lib/rshade/rspec/rspec.rb
rshade-0.2.1 lib/rshade/rspec/rspec.rb