Sha256: 4de4141eef88abbfda2174b95f2fdf30a58de23c390fbbe1d041e393a0d91a89

Contents?: true

Size: 1.05 KB

Versions: 15

Compression:

Stored size: 1.05 KB

Contents

# encoding: ASCII-8BIT
module TestUtil
  # MT-unsafe
  def self.require(dir, *features)
    begin
      # avoid 'already initialized constant FizzBuzz' warning
      silent do
        $:.unshift(dir)
        features.each do |feature|
          Kernel.require feature
        end
        $:.shift
      end
    ensure
      features.each do |feature|
        $".delete(feature)
      end
    end
  end

  # MT-unsafe
  def self.silent
    if $DEBUG
      yield
    else
      back = $VERBOSE
      $VERBOSE = nil
      begin
        yield
      ensure
        $VERBOSE = back
      end
    end
  end

  def self.filecompare(expectedfile, actualfile)
    expected = loadfile(expectedfile)
    actual = loadfile(actualfile)
    if expected != actual
      raise "#{File.basename(actualfile)} is different from #{File.basename(expectedfile)}"
    end
  end

  def self.loadfile(file)
    File.open(file) { |f| f.read }
  end

  def self.start_server_thread(server)
    t = Thread.new {
      Thread.current.abort_on_exception = true
      server.start
    }
    t
  end
end

Version data entries

15 entries across 15 versions & 9 rubygems

Version Path
malagant-soap4r-1.5.8.20141127181857 test/testutil.rb
rtiss_soap4r-1.6.1 test/testutil.rb
rtiss_soap4r-1.6.0 test/testutil.rb
eSpace_soap4r-1.5.8 test/testutil.rb
soap4r-ruby19-1.5.9 test/testutil.rb
tomdz-soap4r-1.5.8.20120202093209 test/testutil.rb
soap5r-2.0.3 test/testutil.rb
soap5r-2.0.2 test/testutil.rb
soap5r-2.0.1 test/testutil.rb
soap5r-2.0.0 test/testutil.rb
soap5r-2.0.0.20120130130121 test/testutil.rb
soap4r-sgonyea-1.5.9 test/testutil.rb
sunteya-soap4r-1.5.8.0 test/testutil.rb
tomdz-soap4r-1.5.8.20111103171510 test/testutil.rb
rubyjedi-soap4r-1.5.8.20100619003610 test/testutil.rb