Sha256: 6ca16db8d2b827f2637de173331edecf533a661012f6333ca739eec60105dfdb

Contents?: true

Size: 598 Bytes

Versions: 9

Compression:

Stored size: 598 Bytes

Contents

require 'rubygems'
require 'pathname'

root_path = Pathname(__FILE__).dirname.join('..').expand_path
lib_path  = root_path.join('lib')
$:.unshift(lib_path)

require 'adapter/mongo'

client  = Mongo::Connection.new.db('adapter')['testing']
adapter = Adapter[:mongo].new(client)
adapter.clear

adapter.write('foo', 'bar')
puts 'Should be bar: ' + adapter.read('foo').inspect

adapter.delete('foo')
puts 'Should be nil: ' + adapter.read('foo').inspect

adapter.write('foo', 'bar')
adapter.clear
puts 'Should be nil: ' + adapter.read('foo').inspect

puts 'Should be bar: ' + adapter.fetch('foo', 'bar')

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
adapter-mongo-0.7.0 examples/mongo.rb
adapter-mongo-0.6.0 examples/mongo.rb
adapter-mongo-0.5.6 examples/mongo.rb
adapter-mongo-0.5.5 examples/mongo.rb
adapter-mongo-0.5.4 examples/mongo.rb
adapter-mongo-0.5.3 examples/mongo.rb
adapter-mongo-0.5.2 examples/mongo.rb
adapter-mongo-0.5.1 examples/mongo.rb
adapter-mongo-0.5 examples/mongo.rb