test/db_test.rb in mongo-1.0.1 vs test/db_test.rb in mongo-1.0.2
- old
+ new
@@ -150,22 +150,31 @@
def test_logout
assert @@db.logout
end
+ def test_command
+ assert_raise OperationFailure do
+ @@db.command({:non_command => 1}, :check_response => true)
+ end
+
+ result = @@db.command({:non_command => 1}, :check_response => false)
+ assert !Mongo::Support.ok?(result)
+ end
+
def test_error
@@db.reset_error_history
assert_nil @@db.error
assert !@@db.error?
assert_nil @@db.previous_error
- @@db.send(:command, :forceerror => 1)
+ @@db.command({:forceerror => 1}, :check_response => false)
assert @@db.error?
assert_not_nil @@db.error
assert_not_nil @@db.previous_error
- @@db.send(:command, :forceerror => 1)
+ @@db.command({:forceerror => 1}, :check_response => false)
assert @@db.error?
assert @@db.error
prev_error = @@db.previous_error
assert_equal 1, prev_error['nPrev']
assert_equal prev_error["err"], @@db.error
@@ -201,10 +210,10 @@
end
def test_check_command_response
command = {:forceerror => 1}
assert_raise OperationFailure do
- @@db.command(command, false, true)
+ @@db.command(command)
end
end
def test_last_status
@@db['test'].remove