Sha256: 40c36c27cb32c403a9f7aaa49a2611abd48d9d609a36efbae963176de560513a

Contents?: true

Size: 711 Bytes

Versions: 1

Compression:

Stored size: 711 Bytes

Contents

# frozen_string_literal: true

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

1 entries across 1 versions & 1 rubygems

Version Path
hotch-0.7.0 lib/hotch/memory/minitest.rb