Use "ruby-mongo-" as db name prefix for all tests.
This commit is contained in:
parent
e17681829f
commit
128b11e92c
|
@ -14,31 +14,41 @@ class MongoTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_database_info
|
def test_database_info
|
||||||
|
@mongo.drop_database('ruby-mongo-info-test')
|
||||||
|
@mongo.db('ruby-mongo-info-test').collection('info-test').insert('a' => 1)
|
||||||
|
|
||||||
info = @mongo.database_info
|
info = @mongo.database_info
|
||||||
assert_not_nil info
|
assert_not_nil info
|
||||||
assert_kind_of Hash, info
|
assert_kind_of Hash, info
|
||||||
assert_not_nil info['admin']
|
assert_not_nil info['ruby-mongo-info-test']
|
||||||
assert info['admin'] > 0
|
assert info['ruby-mongo-info-test'] > 0
|
||||||
|
|
||||||
|
@mongo.drop_database('ruby-mongo-info-test')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_database_names
|
def test_database_names
|
||||||
|
@mongo.drop_database('ruby-mongo-info-test')
|
||||||
|
@mongo.db('ruby-mongo-info-test').collection('info-test').insert('a' => 1)
|
||||||
|
|
||||||
names = @mongo.database_names
|
names = @mongo.database_names
|
||||||
assert_not_nil names
|
assert_not_nil names
|
||||||
assert_kind_of Array, names
|
assert_kind_of Array, names
|
||||||
assert names.length >= 1
|
assert names.length >= 1
|
||||||
assert names.include?('admin')
|
assert names.include?('ruby-mongo-info-test')
|
||||||
|
|
||||||
|
@mongo.drop_database('ruby-mongo-info-test')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_drop_database
|
def test_drop_database
|
||||||
db = @mongo.db('will-be-deleted')
|
db = @mongo.db('ruby-mongo-will-be-deleted')
|
||||||
coll = db.collection('temp')
|
coll = db.collection('temp')
|
||||||
coll.clear
|
coll.clear
|
||||||
coll.insert(:name => 'temp')
|
coll.insert(:name => 'temp')
|
||||||
assert_equal 1, coll.count()
|
assert_equal 1, coll.count()
|
||||||
assert @mongo.database_names.include?('will-be-deleted')
|
assert @mongo.database_names.include?('ruby-mongo-will-be-deleted')
|
||||||
|
|
||||||
@mongo.drop_database('will-be-deleted')
|
@mongo.drop_database('ruby-mongo-will-be-deleted')
|
||||||
assert !@mongo.database_names.include?('will-be-deleted')
|
assert !@mongo.database_names.include?('ruby-mongo-will-be-deleted')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_pair
|
def test_pair
|
||||||
|
|
Loading…
Reference in New Issue