Fix DB#error and DB#last_status deprecation warnings in unit tests.

This commit is contained in:
Hongli Lai (Phusion) 2010-09-07 14:47:43 +02:00 committed by Kyle Banker
parent 56f37e49b6
commit 05772177f7
4 changed files with 5 additions and 5 deletions

View File

@ -108,7 +108,7 @@ class TestCollection < Test::Unit::TestCase
a = {"hello" => "world"}
@@test.insert(a)
@@test.insert(a)
assert(@@db.error.include?("E11000"))
assert(@@db.get_last_error.include?("E11000"))
assert_raise OperationFailure do
@@test.insert(a, :safe => true)

View File

@ -10,6 +10,6 @@ class DBConnectionTest < Test::Unit::TestCase
db = Connection.new(host, port).db(MONGO_TEST_DB)
coll = db.collection('test')
coll.remove
db.error
db.get_last_error
end
end

View File

@ -203,10 +203,10 @@ class DBTest < Test::Unit::TestCase
@@db['test'].save("i" => 1)
@@db['test'].update({"i" => 1}, {"$set" => {"i" => 2}})
assert @@db.last_status()["updatedExisting"]
assert @@db.get_last_error()["updatedExisting"]
@@db['test'].update({"i" => 1}, {"$set" => {"i" => 500}})
assert !@@db.last_status()["updatedExisting"]
assert !@@db.get_last_error()["updatedExisting"]
end
def test_text_port_number_raises_no_errors

View File

@ -71,7 +71,7 @@ class DBTest < Test::Unit::TestCase
should "raise an error if getlasterror fails" do
@db.expects(:command).returns({})
assert_raise Mongo::MongoDBError do
@db.error
@db.get_last_error
end
end