Sha256: ae26eb140777b359ca95baab8d53aca6c006db248f20b3eea440b84d632b470d

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

require 'rubygems'
require 'test-unit'
require 'uri'
require 'http/cookie'

module Test
  module Unit
    module Assertions
      def assert_warn(pattern, message = nil, &block)
        class << (output = +"")
          alias write <<
        end
        stderr, $stderr = $stderr, output
        yield
        assert_match(pattern, output, message)
      ensure
        $stderr = stderr
      end

      def assert_warning(pattern, message = nil, &block)
        verbose, $VERBOSE = $VERBOSE, true
        assert_warn(pattern, message, &block)
      ensure
        $VERBOSE = verbose
      end
    end
  end
end

module Enumerable
  def combine
    masks = inject([[], 1]){|(ar, m), e| [ar << m, m << 1 ] }[0]
    all = masks.inject(0){ |al, m| al|m }

    result = []
    for i in 1..all do
      tmp = []
      each_with_index do |e, idx|
        tmp << e unless (masks[idx] & i) == 0
      end
      result << tmp
    end
    result
  end
end

def test_file(filename)
  File.expand_path(filename, File.dirname(__FILE__))
end

def sleep_until(time)
  if (s = time - Time.now) > 0
    sleep s + 0.01
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
http-cookie-1.0.8 test/helper.rb
http-cookie-1.0.7 test/helper.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/http-cookie-1.0.6/test/helper.rb
http-cookie-1.0.6 test/helper.rb