Trying to make 1.9 pass the tests too

This commit is contained in:
Adrian Madrid 2008-12-30 17:52:51 -07:00
parent 572f341bee
commit 173177e015

View File

@ -30,14 +30,14 @@ class DBAPITest < Test::Unit::TestCase
@coll.insert('b' => 3) @coll.insert('b' => 3)
assert_equal 3, @coll.count assert_equal 3, @coll.count
docs = @coll.find().collect docs = @coll.find().collect{|x| x}
assert_equal 3, docs.length assert_equal 3, docs.length
assert docs.detect { |row| row['a'] == 1 } assert docs.detect { |row| row['a'] == 1 }
assert docs.detect { |row| row['a'] == 2 } assert docs.detect { |row| row['a'] == 2 }
assert docs.detect { |row| row['b'] == 3 } assert docs.detect { |row| row['b'] == 3 }
@coll << {'b' => 4} @coll << {'b' => 4}
docs = @coll.find().collect docs = @coll.find().collect{|x| x}
assert_equal 4, docs.length assert_equal 4, docs.length
assert docs.detect { |row| row['b'] == 4 } assert docs.detect { |row| row['b'] == 4 }
end end
@ -168,7 +168,7 @@ class DBAPITest < Test::Unit::TestCase
def test_collections_info def test_collections_info
cursor = @db.collections_info cursor = @db.collections_info
rows = cursor.collect rows = cursor.collect{|x| x}
assert rows.length >= 1 assert rows.length >= 1
row = rows.detect { |r| r['name'] == @coll_full_name } row = rows.detect { |r| r['name'] == @coll_full_name }
assert_not_nil row assert_not_nil row
@ -207,7 +207,7 @@ class DBAPITest < Test::Unit::TestCase
def test_array def test_array
@coll << {'b' => [1, 2, 3]} @coll << {'b' => [1, 2, 3]}
rows = @coll.find({}, {:fields => ['b']}).collect rows = @coll.find({}, {:fields => ['b']}).collect{|x| x}
assert_equal 1, rows.length assert_equal 1, rows.length
assert_equal [1, 2, 3], rows[0]['b'] assert_equal [1, 2, 3], rows[0]['b']
end end
@ -215,7 +215,7 @@ class DBAPITest < Test::Unit::TestCase
def test_regex def test_regex
regex = /foobar/i regex = /foobar/i
@coll << {'b' => regex} @coll << {'b' => regex}
rows = @coll.find({}, {:fields => ['b']}).collect rows = @coll.find({}, {:fields => ['b']}).collect{|x| x}
assert_equal 1, rows.length assert_equal 1, rows.length
assert_equal regex, rows[0]['b'] assert_equal regex, rows[0]['b']
end end