From 294fa97454c95d36090ef71073441e12942bac00 Mon Sep 17 00:00:00 2001 From: Jim Menard Date: Tue, 9 Dec 2008 07:45:48 -0500 Subject: [PATCH] Use OrderedHash for sorts. --- tests/test_db_api.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_db_api.rb b/tests/test_db_api.rb index a2c4b14..e6f4a12 100644 --- a/tests/test_db_api.rb +++ b/tests/test_db_api.rb @@ -107,12 +107,16 @@ class DBAPITest < Test::Unit::TestCase @coll.insert('b' => 3) # Sorting (ascending) - docs = @coll.find({'a' => { '$lt' => 10 }}, :sort => { 'a' => 1 }).map + order_by = OrderedHash.new + order_by['a'] = 1 + docs = @coll.find({'a' => { '$lt' => 10 }}, :sort => order_by).map assert_equal 2, docs.size assert_equal 1, docs.first['a'] # Sorting (descending) - docs = @coll.find({'a' => { '$lt' => 10 }}, :sort => { 'a' => -1 }).map + order_by = OrderedHash.new + order_by['a'] = -1 + docs = @coll.find({'a' => { '$lt' => 10 }}, :sort => order_by).map assert_equal 2, docs.size assert_equal 2, docs.first['a'] end