Sha256: 5663eb5f6d603f475c40b6bf340e87de556dfb5a974b6563b02cd03742f808b5
Contents?: true
Size: 918 Bytes
Versions: 3
Compression:
Stored size: 918 Bytes
Contents
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'rubygems' if ENV['C_EXT'] require 'mongo' require 'test/unit' begin require 'rubygems' require 'shoulda' require 'mocha' rescue LoadError puts <<MSG This test suite requires shoulda and mocha. You can install them as follows: gem install shoulda gem install mocha MSG exit end require 'bson_ext/cbson' if ENV['C_EXT'] MONGO_TEST_DB = 'mongo-ruby-test' # NOTE: most tests assume that MongoDB is running. class Test::Unit::TestCase include Mongo include BSON # Generic code for rescuing connection failures and retrying operations. # This could be combined with some timeout functionality. def rescue_connection_failure success = false while !success begin yield success = true rescue Mongo::ConnectionFailure puts "Rescuing" sleep(1) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongo-1.0 | test/test_helper.rb |
mongo-0.20.1 | test/test_helper.rb |
mongo-0.20 | test/test_helper.rb |