From 011bf0a51c852c4cb77b950aeb4a56887629caee Mon Sep 17 00:00:00 2001 From: Jim Menard Date: Mon, 1 Dec 2008 20:20:00 -0500 Subject: [PATCH] More tests. Expanded README. --- README | 50 +++++++++++++++++++++++++++++++++++++++++- lib/mongo/util/uuid.rb | 1 + tests/test_db_api.rb | 13 +++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) diff --git a/README b/README index 0906b22..6405262 100644 --- a/README +++ b/README @@ -1 +1,49 @@ -This is a simple pure-Ruby driver for the 10gen MongoDB. += Introduction + +This is a simple pure-Ruby driver for the 10gen Mongo DB. For more information +about Mongo, see http://www.mongodb.org. + += Demo + + $ ruby examples/demo.rb + +Mongo must be running, of course. + += Testing + + $ rake test + +The tests assume that the Mongo database is running on the default port. + += License + +== Mongo Ruby Driver + +Copyright (C) 2008 10gen Inc. + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU Affero General Public License, version 3, as published by +the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more +details. + +See http://www.gnu.org/licenses/ for a copy of the GNU Affero General Public +License. + +== UUID + +This driver uses the UUID generator by Assaf Arkin and Eric Hodel, which uses +the MIT license (see the top of the file lib/mongo/util/uuid.rb). + +== MAC Address Finder + +This driver uses the MAC address finder found at +http://codeforpeople.com/lib/ruby/macaddr/macaddr-1.0.0/lib/macaddr.rb, which +uses Ruby's license (see http://codeforpeople.com/lib/license.txt). + +# Local Variables: +# mode:rdoc +# End: diff --git a/lib/mongo/util/uuid.rb b/lib/mongo/util/uuid.rb index e170643..89b5c8f 100644 --- a/lib/mongo/util/uuid.rb +++ b/lib/mongo/util/uuid.rb @@ -1,3 +1,4 @@ +# From http://github.com/assaf/uuid/tree/master # # = uuid.rb - UUID generator # diff --git a/tests/test_db_api.rb b/tests/test_db_api.rb index fcdcacf..6c1a7a5 100644 --- a/tests/test_db_api.rb +++ b/tests/test_db_api.rb @@ -21,4 +21,17 @@ class DBAPITest < Test::Unit::TestCase @coll.clear assert_equal 0, @coll.count end + + def test_insert + @coll.insert('a' => 1) + @coll.insert('a' => 2) + @coll.insert('b' => 3) + + assert_equal 3, @coll.count + docs = @coll.find().collect + assert_equal 3, docs.length + assert docs.include?('a' => 1) + assert docs.include?('a' => 2) + assert docs.include?('b' => 3) + end end