Sha256: e92f8a7f6f8f777bcbcda046470bcae211a1c7e061879d11bc6f540352690d49

Contents?: true

Size: 680 Bytes

Versions: 3

Compression:

Stored size: 680 Bytes

Contents

require "hotch/memory"

class Hotch
  class Memory
    module Minitest
      # Usage in test/test_helper.rb:
      #
      #     require 'hotch/memory/minitest'
      #
      #     Hotch::Memory::Minitest.run
      #     Hotch::Memory::Minitest.run(name: "my name")
      def self.run(**options)
        ::Minitest.singleton_class.prepend Hotch::Memory::Minitest.aggregate(**options)
      end

      def self.aggregate(**options)
        Module.new do
          define_method(:run_one_method) do |*args|
            options[:aggregate] = true
            Hotch.memory(**options) do
              super(*args)
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hotch-0.6.0 lib/hotch/memory/minitest.rb
hotch-0.5.1 lib/hotch/memory/minitest.rb
hotch-0.5.0 lib/hotch/memory/minitest.rb