Sha256: 9ee2513b0a2f707c6c190a4c01058e91c0a9583c80be851b4666430f033976aa
Contents?: true
Size: 956 Bytes
Versions: 4
Compression:
Stored size: 956 Bytes
Contents
gemfile <<-RB gem 'mongo', '1.9.2' gem 'bson_ext', :platforms => :ruby RB gemfile <<-RB gem 'mongo', '~>1.8.6' gem 'bson_ext', :platforms => :ruby RB # Newest unsupported version of the driver! gemfile <<-RB gem 'mongo', '~>1.7.1' gem 'bson_ext', :platforms => :ruby RB require 'timeout' require 'socket' class PreExistingMongo attr_reader :host, :port def initialize(host, port) @host = host @port = port end def stop(*_) end end $mongo = PreExistingMongo.new("localhost", 27017) def mongo_running? Timeout::timeout(1) do begin TCPSocket.new($mongo.host, $mongo.port).close true rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH false end end rescue Timeout::Error false end before_suite do if !mongo_running? require File.join(File.dirname(__FILE__), 'helpers', 'mongo_server') $mongo = MongoServer.new $mongo.start(false) end end after_suite do $mongo.stop end
Version data entries
4 entries across 4 versions & 1 rubygems