From ce406d92f7306d42883e219a4d8ac3edaf718a23 Mon Sep 17 00:00:00 2001 From: Mike Dirolf Date: Thu, 12 Mar 2009 17:25:23 -0400 Subject: [PATCH] test and update gemspec --- mongo-ruby-driver.gemspec | 1 + tests/test_db_api.rb | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/mongo-ruby-driver.gemspec b/mongo-ruby-driver.gemspec index 4e6a479..ea61735 100644 --- a/mongo-ruby-driver.gemspec +++ b/mongo-ruby-driver.gemspec @@ -35,6 +35,7 @@ PACKAGE_FILES = ['README.rdoc', 'Rakefile', 'mongo-ruby-driver.gemspec', 'lib/mongo/mongo.rb', 'lib/mongo/query.rb', 'lib/mongo/types/binary.rb', + 'lib/mongo/types/code.rb', 'lib/mongo/types/dbref.rb', 'lib/mongo/types/objectid.rb', 'lib/mongo/types/regexp_of_holding.rb', diff --git a/tests/test_db_api.rb b/tests/test_db_api.rb index 40ff134..c0a5a0d 100644 --- a/tests/test_db_api.rb +++ b/tests/test_db_api.rb @@ -442,6 +442,15 @@ class DBAPITest < Test::Unit::TestCase assert_equal "#{@@db.host}:#{@@db.port}", @@db.master end + def test_where + @@coll.insert('a' => 2) + @@coll.insert('a' => 3) + + assert_equal 3, @@coll.count + assert_equal 1, @@coll.find('$where' => Code.new('this.a > 2')).count + assert_equal 2, @@coll.find('$where' => Code.new('this.a > i', {'i' => 1})).count + end + def test_hint name = @@coll.create_index('a') begin