Sha256: baf0ab262068e5c68a943e7888731c13358d6f2b88119a3143bd68877f992ffa
Contents?: true
Size: 1.31 KB
Versions: 3
Compression:
Stored size: 1.31 KB
Contents
require 'mongo-db-utils/models' describe MongoDbUtils::Model do it "should parse mongo uris" do uri = "mongodb://localhost:27017/ed-backup" db = MongoDbUtils::Model::Db.from_uri(uri) db.to_s.should eql(uri) db.host.should eql("localhost") db.port.should eql("27017") db.name.should eql("ed-backup") db.username.should eql("") db.authentication_required?.should eql(false) end it "should parse mongo uris" do uri = "mongodb://ed:password@localhost:27017/ed-backup" db = MongoDbUtils::Model::Db.from_uri(uri) db.to_s.should eql(uri) db.host.should eql("localhost") db.port.should eql("27017") db.name.should eql("ed-backup") db.username.should eql("ed") db.password.should eql("password") db.authentication_required?.should eql(true) end it "should return nil if its a bad uri" do uri = "" db = MongoDbUtils::Model::Db.from_uri(uri) db.should be(nil) end class MockWriter def save(config) end def flush end end it "config should add dbs" do config = MongoDbUtils::Model::Config.new config.writer = MockWriter.new config.add_db_from_uri("mongodb://blah:3333/blah") config.dbs.length.should eql(1) config.add_db_from_uri("mongodb://blah:3333/blah") config.dbs.length.should eql(2) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongo-db-utils-0.0.5 | spec/mongo_db_utils_spec.rb |
mongo-db-utils-0.0.4 | spec/mongo_db_utils_spec.rb |
mongo-db-utils-0.0.3 | spec/mongo_db_utils_spec.rb |