From 01c15907444549ef4174ba4b6fce998977dde23a Mon Sep 17 00:00:00 2001 From: Jim Menard Date: Mon, 1 Dec 2008 19:39:39 -0500 Subject: [PATCH] Start of new DB API tests. --- tests/test_db_api.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/test_db_api.rb diff --git a/tests/test_db_api.rb b/tests/test_db_api.rb new file mode 100644 index 0000000..fcdcacf --- /dev/null +++ b/tests/test_db_api.rb @@ -0,0 +1,24 @@ +$LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib') +require 'mongo' +require 'test/unit' + +# NOTE: assumes Mongo is running +class DBAPITest < Test::Unit::TestCase + + def setup + @db = XGen::Mongo::Driver::Mongo.new.db('ruby-mongo-test') + @coll = @db.collection('test') + @coll.clear + end + + def teardown + @coll.clear + end + + def test_clear + @coll.insert('a' => 1) + assert_equal 1, @coll.count + @coll.clear + assert_equal 0, @coll.count + end +end