minor: test fixes
This commit is contained in:
parent
a698415fa5
commit
7bebcd0499
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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']
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue