mogilefs-client.git  about / heads / tags
MogileFS client library for Ruby
blob 282dcf50574d535b62ec242b6d3dd094975e2bca 649 bytes (raw)
$ git show HEAD:test/test_nhp_compat.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
require 'test/unit'

class TestNhpCompat < Test::Unit::TestCase

  def test_nhp_compat
    ver_test_nhp('~> 2.9')
    ver_test_nhp('~> 3.0')
  end

  def ver_test_nhp(verspec)
    pid = fork do
      begin
        gem 'net-http-persistent', verspec
      rescue LoadError => e
        warn "SKIPPING net-http-persistent #{verspec}\n" \
             "#{e.message} (#{e.class})\n"
      end
      require 'mogilefs'
      mg = MogileFS::MogileFS.new :hosts => %w(127.0.0.1:7500), :domain => 'x'
      exit!(Net::HTTP::Persistent === mg.nhp_new('foo'))
    end
    _, status = Process.waitpid2(pid)
    assert status.success?, status.inspect
  end
end

git clone https://yhbt.net/mogilefs-client.git