minor: test fixes

This commit is contained in:
Kyle Banker 2009-12-29 11:31:59 -05:00
parent a698415fa5
commit 7bebcd0499
4 changed files with 6 additions and 6 deletions

View File

@ -40,7 +40,7 @@ module Mongo #:nodoc:
order_by[param[0]] = sort_value(param[1]) unless param[1].nil?
end
end
else
elsif !value.empty?
if order_by.size == 1
order_by[value.first] = 1
else

View File

@ -6,9 +6,9 @@ require 'mongo/util/ordered_hash'
class ConversionsTest < Test::Unit::TestCase
include Mongo::Conversions
def test_array_as_sort_parameters_with_array_of_strings
params = array_as_sort_parameters(["field1", "field2"])
assert_equal({ "field1" => 1, "field2" => 1 }, params)
def test_array_as_sort_parameters_with_array_of_key_and_value
params = array_as_sort_parameters(["field1", "asc"])
assert_equal({"field1" => 1}, params)
end
def test_array_as_sort_parameters_with_array_of_string_and_values

View File

@ -180,7 +180,7 @@ class DBAPITest < Test::Unit::TestCase
assert_equal 3, docs[2]['a']
assert_equal 4, docs[3]['a']
docs = @@coll.find({'a' => { '$lt' => 10 }}, :sort => ['b', 'a']).to_a
docs = @@coll.find({'a' => { '$lt' => 10 }}, :sort => [['b', 'asc'], ['a', 'asc']]).to_a
assert_equal 4, docs.size
assert_equal 2, docs[0]['a']
assert_equal 4, docs[1]['a']

View File

@ -4,7 +4,7 @@ class TestThreading < Test::Unit::TestCase
include Mongo
@@db = Connection.new('localhost', 27017, :pool_size => 1, :timeout => 3).db('ruby-mongo-test')
@@db = Connection.new('localhost', 27017, :pool_size => 1, :timeout => 5).db('ruby-mongo-test')
@@coll = @@db.collection('thread-test-collection')
def set_up_safe_data