examples/mongo.rb in adapter-mongo-0.7.0 vs examples/mongo.rb in adapter-mongo-0.8.0

- old
+ new

@@ -5,20 +5,21 @@ lib_path = root_path.join('lib') $:.unshift(lib_path) require 'adapter/mongo' -client = Mongo::Connection.new.db('adapter')['testing'] +key = BSON::ObjectId.new +client = Mongo::MongoClient.new.db('adapter')['testing'] adapter = Adapter[:mongo].new(client) adapter.clear -adapter.write('foo', 'bar') -puts 'Should be bar: ' + adapter.read('foo').inspect +adapter.write(key, {'some' => 'thing'}) +puts 'Should be {"some" => "thing"}: ' + adapter.read(key).inspect -adapter.delete('foo') -puts 'Should be nil: ' + adapter.read('foo').inspect +adapter.delete(key) +puts 'Should be nil: ' + adapter.read(key).inspect -adapter.write('foo', 'bar') +adapter.write(key, {'some' => 'thing'}) adapter.clear -puts 'Should be nil: ' + adapter.read('foo').inspect +puts 'Should be nil: ' + adapter.read(key).inspect -puts 'Should be bar: ' + adapter.fetch('foo', 'bar') \ No newline at end of file +puts 'Should be {"some" => "thing"}: ' + adapter.fetch(key, {'some' => 'thing'}).inspect