From 05772177f795a70701f5814513201549911f97cf Mon Sep 17 00:00:00 2001 From: "Hongli Lai (Phusion)" Date: Tue, 7 Sep 2010 14:47:43 +0200 Subject: [PATCH] Fix DB#error and DB#last_status deprecation warnings in unit tests. --- test/collection_test.rb | 2 +- test/db_connection_test.rb | 2 +- test/db_test.rb | 4 ++-- test/unit/db_test.rb | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/collection_test.rb b/test/collection_test.rb index 54222e3..8b1bd32 100644 --- a/test/collection_test.rb +++ b/test/collection_test.rb @@ -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) diff --git a/test/db_connection_test.rb b/test/db_connection_test.rb index c24bd70..3221ab3 100644 --- a/test/db_connection_test.rb +++ b/test/db_connection_test.rb @@ -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 diff --git a/test/db_test.rb b/test/db_test.rb index d72406c..c9433bc 100644 --- a/test/db_test.rb +++ b/test/db_test.rb @@ -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 diff --git a/test/unit/db_test.rb b/test/unit/db_test.rb index 01ec9c3..08ae117 100644 --- a/test/unit/db_test.rb +++ b/test/unit/db_test.rb @@ -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