Fix DB#error and DB#last_status deprecation warnings in unit tests.
This commit is contained in:
parent
56f37e49b6
commit
05772177f7
|
@ -108,7 +108,7 @@ class TestCollection < Test::Unit::TestCase
|
||||||
a = {"hello" => "world"}
|
a = {"hello" => "world"}
|
||||||
@@test.insert(a)
|
@@test.insert(a)
|
||||||
@@test.insert(a)
|
@@test.insert(a)
|
||||||
assert(@@db.error.include?("E11000"))
|
assert(@@db.get_last_error.include?("E11000"))
|
||||||
|
|
||||||
assert_raise OperationFailure do
|
assert_raise OperationFailure do
|
||||||
@@test.insert(a, :safe => true)
|
@@test.insert(a, :safe => true)
|
||||||
|
|
|
@ -10,6 +10,6 @@ class DBConnectionTest < Test::Unit::TestCase
|
||||||
db = Connection.new(host, port).db(MONGO_TEST_DB)
|
db = Connection.new(host, port).db(MONGO_TEST_DB)
|
||||||
coll = db.collection('test')
|
coll = db.collection('test')
|
||||||
coll.remove
|
coll.remove
|
||||||
db.error
|
db.get_last_error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -203,10 +203,10 @@ class DBTest < Test::Unit::TestCase
|
||||||
@@db['test'].save("i" => 1)
|
@@db['test'].save("i" => 1)
|
||||||
|
|
||||||
@@db['test'].update({"i" => 1}, {"$set" => {"i" => 2}})
|
@@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}})
|
@@db['test'].update({"i" => 1}, {"$set" => {"i" => 500}})
|
||||||
assert !@@db.last_status()["updatedExisting"]
|
assert !@@db.get_last_error()["updatedExisting"]
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_text_port_number_raises_no_errors
|
def test_text_port_number_raises_no_errors
|
||||||
|
|
|
@ -71,7 +71,7 @@ class DBTest < Test::Unit::TestCase
|
||||||
should "raise an error if getlasterror fails" do
|
should "raise an error if getlasterror fails" do
|
||||||
@db.expects(:command).returns({})
|
@db.expects(:command).returns({})
|
||||||
assert_raise Mongo::MongoDBError do
|
assert_raise Mongo::MongoDBError do
|
||||||
@db.error
|
@db.get_last_error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue