Ruby mogilefs-client 3.12.2
[ruby-mogilefs-client.git] / test / test_nhp_compat.rb
blob282dcf50574d535b62ec242b6d3dd094975e2bca
1 require 'test/unit'
3 class TestNhpCompat < Test::Unit::TestCase
5   def test_nhp_compat
6     ver_test_nhp('~> 2.9')
7     ver_test_nhp('~> 3.0')
8   end
10   def ver_test_nhp(verspec)
11     pid = fork do
12       begin
13         gem 'net-http-persistent', verspec
14       rescue LoadError => e
15         warn "SKIPPING net-http-persistent #{verspec}\n" \
16              "#{e.message} (#{e.class})\n"
17       end
18       require 'mogilefs'
19       mg = MogileFS::MogileFS.new :hosts => %w(127.0.0.1:7500), :domain => 'x'
20       exit!(Net::HTTP::Persistent === mg.nhp_new('foo'))
21     end
22     _, status = Process.waitpid2(pid)
23     assert status.success?, status.inspect
24   end
25 end