minor: fixes for tests in Ruby 1.8.7

This commit is contained in:
Tyler Brock 2012-02-18 19:24:27 -05:00
parent 4db19610d6
commit c802c7eba3
3 changed files with 14 additions and 5 deletions

View File

@ -1,6 +1,6 @@
require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'bson') require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'bson')
require 'rubygems' if RUBY_VERSION < '1.9.0' && ENV['C_EXT'] require 'rubygems' if RUBY_VERSION < '1.9.0'
gem 'test-unit' if RUBY_VERSION > '1.9.0' gem 'test-unit'
require 'test/unit' require 'test/unit'
def silently def silently

View File

@ -89,7 +89,16 @@ class BasicTest < Test::Unit::TestCase
rescue SystemStackError rescue SystemStackError
end end
end end
end
context "checking out readers" do
setup do
seeds = build_seeds(3)
args = {:name => @rs.name}
@con = ReplSetConnection.new(seeds, args)
@coll = @con[MONGO_TEST_DB]['test-connection-exceptions']
end
should "close the connection on receive_message for major exceptions" do should "close the connection on receive_message for major exceptions" do
@con.expects(:checkout_reader).raises(SystemStackError) @con.expects(:checkout_reader).raises(SystemStackError)
@con.expects(:close) @con.expects(:close)

View File

@ -1,7 +1,7 @@
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rubygems' if RUBY_VERSION < '1.9.0' && ENV['C_EXT'] require 'rubygems' if RUBY_VERSION
require 'mongo' require 'mongo'
gem 'test-unit' if RUBY_VERSION > '1.9.0' gem 'test-unit'
require 'test/unit' require 'test/unit'
def silently def silently