From c802c7eba3edf4b2cb26a23877b80e8a010fd779 Mon Sep 17 00:00:00 2001 From: Tyler Brock Date: Sat, 18 Feb 2012 19:24:27 -0500 Subject: [PATCH] minor: fixes for tests in Ruby 1.8.7 --- test/bson/test_helper.rb | 4 ++-- test/replica_sets/basic_test.rb | 11 ++++++++++- test/test_helper.rb | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/test/bson/test_helper.rb b/test/bson/test_helper.rb index d69e7cc..2272668 100644 --- a/test/bson/test_helper.rb +++ b/test/bson/test_helper.rb @@ -1,6 +1,6 @@ require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'bson') -require 'rubygems' if RUBY_VERSION < '1.9.0' && ENV['C_EXT'] -gem 'test-unit' if RUBY_VERSION > '1.9.0' +require 'rubygems' if RUBY_VERSION < '1.9.0' +gem 'test-unit' require 'test/unit' def silently diff --git a/test/replica_sets/basic_test.rb b/test/replica_sets/basic_test.rb index 10d63ac..8e36428 100644 --- a/test/replica_sets/basic_test.rb +++ b/test/replica_sets/basic_test.rb @@ -89,7 +89,16 @@ class BasicTest < Test::Unit::TestCase rescue SystemStackError 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 @con.expects(:checkout_reader).raises(SystemStackError) @con.expects(:close) diff --git a/test/test_helper.rb b/test/test_helper.rb index f502247..bfd0acb 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,7 +1,7 @@ $:.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' -gem 'test-unit' if RUBY_VERSION > '1.9.0' +gem 'test-unit' require 'test/unit' def silently