pax_global_header00006660000000000000000000000064123215356550014521gustar00rootroot0000000000000052 comment=73dfbd9bb1fea56fa05dbb010be4ef3b75718cb6 ruby-moneta-0.7.20/000077500000000000000000000000001232153565500140515ustar00rootroot00000000000000ruby-moneta-0.7.20/.gitignore000066400000000000000000000001351232153565500160400ustar00rootroot00000000000000.yardoc doc attic spec/tmp *~ *.swp *.rdb .#* script/benchmarks.tmp Gemfile.lock logs secure ruby-moneta-0.7.20/.travis.yml000066400000000000000000000032601232153565500161630ustar00rootroot00000000000000language: ruby rvm: - 2.0.0 - 1.9.3 - 1.8.7 - jruby-19mode - jruby-18mode - rbx-19mode - rbx-18mode before_install: #- script/install-kyotocabinet - sudo apt-get install -qq libtokyocabinet8 libtokyocabinet-dev liblzo2-dev libtdb-dev libleveldb-dev tokyotyrant - script/start-services - script/install-bundle - script/upload-bundle - script/wait-services install: 'echo "Bundle installed"' before_script: - mysql -e 'create database moneta;' - mysql -e 'create database moneta_activerecord1;' - mysql -e 'create database moneta_activerecord2;' env: global: - secure: "dtM4n7FP8P0UI9Iq+nsvQ7/yfDqsxhfCO9i8zMxm/f9Kxj5Z/4C7jsXsLA+e\n/7FZ9+ld2QjPSPU0LUiDpj/z81bxyZHwqocQ7Nb0DVvO3JRHpr4/iBQQQHd3\n0jvou3mRbu5mBlUjf1/ALaZA+b+vcnsF9fd86UnkY+ChriylGnM=" matrix: - "SCRIPT='parallel-tests 1/10'" - "SCRIPT='parallel-tests 2/10'" - "SCRIPT='parallel-tests 3/10'" - "SCRIPT='parallel-tests 4/10'" - "SCRIPT='parallel-tests 5/10'" - "SCRIPT='parallel-tests 6/10'" - "SCRIPT='parallel-tests 7/10'" - "SCRIPT='parallel-tests 8/10'" - "SCRIPT='parallel-tests 9/10'" - "SCRIPT='parallel-tests 10/10'" - "SCRIPT='parallel-tests unstable'" - "SCRIPT='benchmarks uniform_small'" - "SCRIPT='benchmarks uniform_medium'" - "SCRIPT='benchmarks uniform_large'" - "SCRIPT='benchmarks normal_small'" - "SCRIPT='benchmarks normal_medium'" - "SCRIPT='benchmarks normal_large'" matrix: allow_failures: - rvm: jruby-18mode - rvm: jruby-19mode - rvm: rbx-18mode - rvm: rbx-19mode - env: "SCRIPT='parallel-tests unstable'" script: "eval bundle exec ruby script/$SCRIPT" branches: only: - master - travis ruby-moneta-0.7.20/.yardopts000066400000000000000000000000611232153565500157140ustar00rootroot00000000000000- README.md SPEC.md CHANGES LICENSE CONTRIBUTORS ruby-moneta-0.7.20/CHANGES000066400000000000000000000103571232153565500150520ustar00rootroot000000000000000.7.20 * Adapters::LRUHash: add option :max_value * Moneta.new(:Couch, :Riak, :RestClient): use urlencode instead of base64 for key encoding) * Transformer: Add :hex encoder * Transformer: Don't wrap object in array for JSON serialization * Transformer: Add :php serializer * Moneta.new(:Sequel) - Don't encode blob data using base64 * Moneta::Adapters::LMDB added (Symas Lightning Memory-Mapped Database) * Moneta::Adapters::Sequel - Fix for https://github.com/jeremyevans/sequel/issues/715 0.7.19 * ActionDispatch::Session::MonetaStore fixed for Rails 4 * Moneta::Server: Tries now to remove stale unix socket * Moneta::Server: More robust and better performance 0.7.18 * Adapters::File#increment and #create fixed on JRuby * Adapters::Couch and Adapters::Mongo can store hashes directly as documents. It is not necessary to serialize values as strings anymore. * Adapters::Couch#create added * Pool thread safety improved * Transformer: Add CityHash 0.7.17 * Transformer: LZ4 compression added 0.7.16 * Better builder validation * Adapters::Sequel: check for correct exceptions 0.7.15 * CONTRIBUTORS file added * Adapters::File#increment fixed 0.7.14 * Adapters::ActiveRecord, Adapters::Sequel: store values as blobs * Adapters::ActiveRecord fixed and improved 0.7.13 * Adapters::ActiveRecord: Use connection_pool * Adapters::File: Race condition in #increment fixed 0.7.12 * Concurrency tests added * Bugfixes for File, Sqlite, Sequel and Datamapper, ActiveRecord 0.7.11 * Logger: Add option :file * Adapters::TokyoTyrant supports both native (ruby-tokyotyrant) and pure-ruby tokyotyrant gems * Adapters::Couch use Faraday directly instead of buggy CouchRest * Adapters::RestClient use Faraday * Transformer: add quoted printable encoding (:qp) 0.7.10 * Adapters::TokyoTyrant added * Add attr_reader :backend and option :backend to some adapters * Cache rename #backend to #adapter 0.7.9 * Adapters::KyotoCabinet added * Feature detection methods #features and #supports? added * Validity checks added which check features 0.7.8 * Adapters::Memcached: switched to Dalli by default * Adapters::Daybreak: add option :sync to load and store * Adapters::LRUHash: add option :max_count * Adapters::Mongo: add options :user and :password * Adapters::Mongo: Correctly close connection * Adapters::Redis: Correctly close connection * Transformer: add inspect key transformer * Added #create method to atomically create entries * Added WeakCreate and WeakIncrement proxies * Added Mutex and Semaphore synchronization primitives for shared/distributed database locks * Rename unix socket options from :file to :socket 0.7.6 * Adapters::Daybreak: api changed * Adapters::File: flock fix for jruby * Transformer: add to_s key transformer 0.7.5 * OptionsSupport#with: Add support to insert additional proxies * Builder#adapter: Accepts Moneta store instance now 0.7.4 * Transformer: fix truncate * Adapters::RestClient: raise error if store fails * Adapters::TDB added * Adapters::Daybreak added * Adapters::Mongo - Expiration and increment support added * Pool proxy added * Mixin ExpiresSupport added * Expiration value handling unified * 0 and false are interpreted as persist value * Adapters::RestClient uses net/http now 0.7.3 * Added Adapters::RestClient * Added Rack::MonetaRest * Added Rack::MonetaStore 0.7.2 * Renamed WithOptions to OptionSupport * Refactored Base in Defaults mixin * Removed Transformer option :quiet * Transformer might raise an exception if an invalid value is transformed * Expires middleware only wraps Arrays and nils in an Array if no expiration time is given (backward compatible change) * Moneta middlewares are not allowed to modify option hash given to functions like #load and #store 0.7.1 * Memcached: Use binary protocol and no base64 encoding of the keys * Transformer: Remove newlines from base64 encodes values * Server: Add method #run which will block and #running? to allow forking * SDBM: #store might raise errors (Don't use SDBM, it is unstable!) * Add #decrement method * Fix #fetch to handle false correctly * Fix Expires middleware to handle boolean and nil values correctly * Base64 encode Riak keys since Riak needs valid UTF-8 for the REST interface 0.7.0 * Major rewrite by Daniel Mendler 0.6.0 * First public release by Yehuda Katz ruby-moneta-0.7.20/CONTRIBUTORS000066400000000000000000000014571232153565500157400ustar00rootroot00000000000000Adrian Madrid Alejandro Crosa Anthony Eden Benjamin Yu Ben Schwarz Daniel Mendler Derek Kastner Dylan Egan Hampton Catlin Hannes Georg Hendrik Beskow Jari Bakken Jeremy Voorhis Jon Crosby lakshan Piotr Murach Potapov Sergey Quin Hoxie Ryan T. Hosford Scott Wadden Tom Meier Xavier Shay Yehuda Katz ruby-moneta-0.7.20/Gemfile000066400000000000000000000044261232153565500153520ustar00rootroot00000000000000# Rails 4 requires Ruby >= 1.9 def rails_version v = ['>= 3.2.11'] v << '< 4.0.0' unless RUBY_VERSION >= '1.9' v end source 'https://rubygems.org' gemspec # Testing gem 'rspec' gem 'rspec-retry' # Serializer used by Transformer gem 'tnetstring' gem 'bencode' gem 'multi_json' gem 'bson_ext', :platforms => :ruby gem 'bson', :platforms => :jruby gem 'ox', :platforms => :ruby gem 'msgpack', :platforms => :ruby gem 'msgpack-jruby', :platforms => :jruby gem 'bert', :platforms => :ruby gem 'php_serialize' # Compressors used by Transformer if RUBY_VERSION < '2.0' gem 'bzip2-ruby', :platforms => :mri # Only on mri currently end gem 'lz4-ruby', :platforms => :ruby gem 'ruby-lzma', :platforms => :ruby gem 'lzoruby', :platforms => :ruby gem 'snappy', :platforms => :ruby gem 'qlzruby', :platforms => :ruby # Hash transformer library gem 'cityhash', :platforms => :ruby # Backends gem 'faraday' gem 'daybreak' gem 'dm-core' gem 'dm-migrations' gem 'dm-mysql-adapter' # FIXME: Use fog master because of failing tests, fixed after 1.11.1 gem 'fog', :github => 'fog/fog' gem 'activerecord', *rails_version gem 'redis' gem 'mongo' gem 'sequel' gem 'dalli' gem 'riak-client' gem 'cassandra' gem 'tokyotyrant' #gem 'ruby-tokyotyrant', :platforms => :ruby #gem 'hbaserb' #gem 'localmemcache' gem 'tdb', :platforms => :ruby gem 'leveldb-ruby', :platforms => :ruby if RUBY_VERSION >= '1.9' gem 'lmdb', :platforms => :mri end if RUBY_VERSION < '2.0' gem 'tokyocabinet', :platforms => :ruby end #if RUBY_VERSION < '2.0' && !defined?(JRUBY_VERSION) # FIXME: We have to check manually for jruby # otherwise bundle install --deployment doesn't work # gem 'kyotocabinet-ruby', :github => 'minad/kyotocabinet-ruby' #end gem 'memcached', :platforms => :ruby gem 'jruby-memcached', :platforms => :jruby gem 'sqlite3', :platforms => :ruby gem 'activerecord-jdbc-adapter', :platforms => :jruby gem 'activerecord-jdbcmysql-adapter', :platforms => :jruby gem 'mysql2', '>= 0.3.12b5', :platforms => :ruby # gdbm for jruby needs ffi gem 'ffi', :platforms => :jruby gem 'gdbm', :platforms => :jruby # Rack integration testing gem 'rack' gem 'rack-cache' # Rails integration testing gem 'actionpack', *rails_version gem 'minitest', '~> 4.7.4' # Fix versions for old ruby 1.8 if RUBY_VERSION < '1.9' gem 'nokogiri', '< 1.6' end ruby-moneta-0.7.20/LICENSE000066400000000000000000000020661232153565500150620ustar00rootroot00000000000000Copyright (c) 2009 - 2013 Daniel Mendler, Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ruby-moneta-0.7.20/README.md000066400000000000000000001270571232153565500153440ustar00rootroot00000000000000# Moneta: A unified interface for key/value stores [![Gem Version](https://badge.fury.io/rb/moneta.png)](http://rubygems.org/gems/moneta) [![Build Status](https://secure.travis-ci.org/minad/moneta.png?branch=master)](http://travis-ci.org/minad/moneta) [![Dependency Status](https://gemnasium.com/minad/moneta.png?travis)](https://gemnasium.com/minad/moneta) [![Code Climate](https://codeclimate.com/github/minad/moneta.png)](https://codeclimate.com/github/minad/moneta) Moneta provides a standard interface for interacting with various kinds of key/value stores. Moneta supports the well-known NoSQL and document based stores. A short overview of the features: * Supports a lot of backends with consistent behaviour (See below) * Allows a full configuration of the serialization -> compression -> adapter stack using proxies (Similar to [Rack middlewares](http://rack.github.com/)) * Configurable serialization via `Moneta::Transformer` proxy (Marshal/JSON/YAML and many more) * Configurable value compression via `Moneta::Transformer` proxy (Zlib, Snappy, LZMA, ...) * Configurable key transformation via `Moneta::Transformer` proxy * Expiration for all stores (Added via proxy `Moneta::Expires` if not supported natively) * Atomic operations * Atomic incrementation and decrementation for most stores (Method `#increment` and `#decrement`) * Atomic creation of entries (Method `#create`) * Shared/distributed database-wide synchronization primitives `Moneta::Mutex` and `Moneta::Semaphore` * Includes a simple pure-ruby key/value server (`Moneta::Server`) and client (`Moneta::Adapters::Client`) * Integration with [Rails](http://rubyonrails.org/), [Rack](http://rack.github.com/)/[Rack-Cache](https://github.com/rtomayko/rack-cache), [Sinatra](http://sinatrarb.com/) and [Ramaze](http://ramaze.net/). If you are not yet convinced, you might ask why? What are the goals of the project? * Get people started quickly with key/value stores! Therefore all the adapters are included in the gem and you are ready to go. [Tilt](https://github.com/rtomayko/tilt) does the same for template languages. * Make it easy to compare different key/value stores and benchmark them * To hide a lot of different and maybe complex APIs behind one well-designed and simple Moneta API * Give people a starting point or example code to start working with their favourite key/value store. Feel free to copy code, please mention Moneta then :) * Create a reusable piece of code, since similar things are solved over and over again ([Rails](http://rubyonrails.org/) brings its own cache stores, and many frameworks do the same...) * See also http://yehudakatz.com/2009/02/12/whats-the-point/ Moneta is tested thoroughly using [Travis-CI](http://travis-ci.org/minad/moneta). ------ ## Getting started Install Moneta via Rubygems ~~~ $ gem install moneta ~~~ or add it to your Gemfile ~~~ ruby gem 'moneta' ~~~ Now you are ready to go: ~~~ ruby require 'moneta' # Create a simple file store store = Moneta.new(:File, :dir => 'moneta') # Store some entries store['key'] = 'value' # Read entry store.key?('key') # returns true store['key'] # returns 'value' store.close ~~~ ------ ## Links * Source: * Bugs: * Tests and benchmarks: * API documentation: * Latest Gem: * GitHub master: ------ ## Supported backends Out of the box, it supports the following backends. Use the backend name symbol in the Moneta constructor (e.g. `Moneta.new(:Memory)`). * Memory: * In-memory store (`:Memory`) * LRU hash - prefer this over :Memory! (`:LRUHash`) * [LocalMemCache](http://localmemcache.rubyforge.org/) (`:LocalMemCache`) * [Memcached](http://memcached.org/) store (`:Memcached`, `:MemcachedNative` and `:MemcachedDalli`) * Relational Databases: * [DataMapper](http://datamapper.org/) (`:DataMapper`) * [ActiveRecord](https://rubygems.org/gems/activerecord) (`:ActiveRecord`) * [Sequel](http://sequel.rubyforge.org/) (`:Sequel`) * [Sqlite3](http://sqlite.org/) (`:Sqlite`) * Filesystem: * [PStore](http://ruby-doc.org/stdlib/libdoc/pstore/rdoc/PStore.html) (`:PStore`) * [YAML](http://www.ruby-doc.org/stdlib/libdoc/yaml/rdoc/YAML/Store.html) store (`:YAML`) * Filesystem directory store (`:File`) * Filesystem directory store which spreads files in subdirectories using md5 hash (`:HashFile`) * Key/value databases: * [Berkeley DB using DBM interface or NDBM (Depends on Ruby environment)](http://www.ruby-doc.org/stdlib/libdoc/dbm/rdoc/DBM.html) (`:DBM`) * [Cassandra](http://cassandra.apache.org/) (`:Cassandra`) * [Daybreak](http://propublica.github.com/daybreak/) (`:Daybreak`) * [GDBM](http://www.ruby-doc.org/stdlib/libdoc/gdbm/rdoc/GDBM.html) (`:GDBM`) * [HBase](http://hbase.apache.org/) (`:HBase`) * [LevelDB](http://code.google.com/p/leveldb/) (`:LevelDB`) * [LMDB](http://symas.com/mdb/) (`:LMDB`) * [Redis](http://redis.io/) (`:Redis`) * [Riak](http://docs.basho.com/) (`:Riak`) * [SDBM](http://www.ruby-doc.org/stdlib/libdoc/sdbm/rdoc/SDBM.html) (`:SDBM`) * [KyotoCabinet](http://fallabs.com/kyotocabinet/) (`:KyotoCabinet`) * [TokyoCabinet](http://fallabs.com/tokyocabinet/) (`:TokyoCabinet`) * [TokyoTyrant](http://fallabs.com/tokyotyrant/) (`:TokyoTyrant`) * [Simple Samba database TDB](http://tdb.samba.org/) (`:TDB`) * Document databases: * [CouchDB](http://couchdb.apache.org/) (`:Couch`) * [MongoDB](http://www.mongodb.org/) (`:Mongo`) * Moneta network protocols: * Moneta key/value client (`:Client` works with `Moneta::Server`) * Moneta HTTP/REST client (`:RestClient` works with `Rack::MonetaRest`) * Other * [Fog](http://fog.io/) cloud storage which supports Amazon S3, Rackspace, etc. (`:Fog`) * Storage which doesn't store anything (`:Null`) Some of the backends are not exactly based on key/value stores, e.g. the relational ones. These are useful if you already use the corresponding backend in your application. You get a key/value store for free then without installing any additional services and you still have the possibility to upgrade to a real key/value store. ### Backend feature matrix __NOTE:__ The backend matrix is much more readable on rubydoc.info than on github. [Go there!](http://rubydoc.info/github/minad/moneta/master/file/README.md#backend-matrix)
AdapterRequired gemsMulti-thread safe[1]Multi-process safe[2]Atomic increment[8]Atomic create[9]Native expires[3]PersistentDescription
Persistent stores
MongomongoMongoDB database
RedisredisRedis database
ActiveRecordactiverecordActiveRecord ORM
File-File store
LMDBlmdbSymas Lightning Memory-Mapped Database (LMDB)
SequelsequelSequel ORM
TokyoTyranttokyotyrant or ruby-tokyotyrantTokyoTyrant database
PStore-[10]PStore store
YAML-[10]YAML store
Sqlitesqlite3?[10]Sqlite3 database
Daybreakdaybreak(✓)[7]Incredibly fast pure-ruby key/value store Daybreak
DBM-Berkeley DB using DBM interface or NDBM (Depends on Ruby environment)
GDBM-GDBM database
LevelDBleveldbLevelDB database
SDBM-SDBM database
TDBtdbTDB database
KyotoCabinetkyotocabinetKyotoCabinet database
TokyoCabinettokyocabinetTokyoCabinet database
DataMapperdm-core, dm-migrationsDataMapper ORM
Couchfaraday, multi_jsonCouchDB database
HBasehbaserb?HBase database
Cassandracassandra?Cassandra distributed database
LocalMemCachelocalmemcacheLocalMemCache database
Fogfog?Fog cloud store
Riakriak-clientRiak database
Non persistent stores
MemcachedDallidalli[4]Memcached database with Dalli library
Memcacheddalli or memcached?[4]Memcached database
MemcachedNativememcached[4]Memcached database with native library
Cookie-(✓)[6]Cookie in memory store
LRUHash-(✓)[6]LRU memory store
Memory-(✓)[6]Memory store
Null-No database
Client-?[5]?[5]?[5]?[5]Moneta client adapter
RestClientfaraday?[5]Moneta REST client adapter
* [1]: Make adapters thread-safe by using `Moneta::Lock` or by passing the option `:threadsafe => true` to `Moneta#new`. There is also `Moneta::Pool` which can be used to share a store between multiple threads if the store is multi-process safe. I recommend to add the option `:threadsafe` to ensure thread-safety since for example under JRuby and Rubinius even the basic datastructures are not thread safe due to the lack of a global interpreter lock (GIL). This differs from MRI where some adapters might appear thread safe already but only due to the GIL. * [2]: Share a Moneta store between multiple processes using `Moneta::Shared` (See below). * [3]: Add expiration support by using `Moneta::Expires` or by passing the option `:expires => true` to `Moneta#new`. * [4]: There are some servers which use the memcached protocol but which are persistent (e.g. [MemcacheDB](http://memcachedb.org/), [Kai](http://sourceforge.net/apps/mediawiki/kai), [IronCache](http://dev.iron.io/cache/reference/memcache/), [Roma](https://github.com/roma/roma/tree), [Flare](http://labs.gree.jp/Top/OpenSource/Flare-en.html) and [Kumofs](https://github.com/etolabo/kumofs)) * [5]: Depends on server * [6]: Store is multi-process safe because it is an in-memory store, values are not shared between multiple processes * [7]: Store is multi-process safe, but not synchronized automatically between multiple processes * [8]: If a store provides atomic increment it can be used with `Moneta::Semaphore`. You can add weak `#increment` support using the `Moneta::WeakIncrement` proxy. * [9]: If a store provides atomic creation it can be used with `Moneta::Mutex`. You can add weak `#create` support using the `Moneta::WeakCreate` proxy. * [10]: Sqlite/YAML/PStore are multiprocess safe, but the performance suffers badly since the whole database file must be locked for writing. Use a key/value server if you want multiprocess concurrency! ------ ## Proxies In addition it supports proxies (Similar to [Rack middlewares](http://rack.github.com/)) which add additional features to storage backends: * `Moneta::Proxy` and `Moneta::Wrapper` proxy base classes * `Moneta::Expires` to add expiration support to stores which don't support it natively. Add it in the builder using `use :Expires`. * `Moneta::Stack` to stack multiple stores (Read returns result from first where the key is found, writes go to all stores). Add it in the builder using `use(:Stack) {}`. * `Moneta::Transformer` transforms keys and values (Marshal, YAML, JSON, Base64, MD5, ...). Add it in the builder using `use :Transformer`. * `Moneta::Cache` combine two stores, one as backend and one as cache (e.g. `Moneta::Adapters::File` + `Moneta::Adapters::LRUHash`). Add it in the builder using `use(:Cache) {}`. * `Moneta::Lock` to make store thread safe. Add it in the builder using `use :Lock`. * `Moneta::Pool` to create a pool of stores as a means of making the store thread safe. Add it in the builder using `use(:Pool) {}`. * `Moneta::Logger` to log database accesses. Add it in the builder using `use :Logger`. * `Moneta::Shared` to share a store between multiple processes. Add it in the builder using `use(:Shared) {}`. * `Moneta::WeakIncrement` and `Moneta::WeakCreate` to add `#create` and `#increment` support without atomicity (weak) to stores which don't support it. ### Serializers and compressors (`Moneta::Transformer`) Supported serializers: * BEncode (`:bencode`) * BERT (`:bert`) * BSON (`:bson`) * JSON (`:json`) * Marshal (`:marshal`) * MessagePack (`:msgpack`) * Ox (`:ox`) * PHP (`:php`) * TNetStrings (`:tnet`) * YAML (`:yaml`) Supported value compressors: * Bzip2 (`:bzip2`) * LZ4 (`:lz4`) * LZMA (`:lzma`) * LZO (`:lzo`) * Snappy (`:snappy`) * QuickLZ (`:quicklz`) * Zlib (`:zlib`) Supported encoders: * Base64 (`:base64`) * Url escape (`:escape`) * Hexadecimal (`:hex`) * QP (`:qp`) * UUEncode (`:uuencode`) Special transformers: * Digests (MD5, Shas, CityHash, ...) * Add prefix to keys (`:prefix`) * HMAC to verify values (`:hmac`, useful for `Rack::MonetaCookies`) ------ ## Moneta API The Moneta API is purposely extremely similar to the Hash API with a few minor additions. Every method takes also a optional option hash. In order so support an identical API across stores, Moneta does not support iteration or partial matches. ~~~ #initialize(options) options differs per-store, and is used to set up the store. #[](key) retrieve a key. If the key is not available, return nil. #load(key, options = {}) retrieve a key. If the key is not available, return nil. #fetch(key, options = {}, &block) retrieve a key. If the key is not available, execute the block and return its return value. #fetch(key, value, options = {}) retrieve a key. If the key is not available, return the value, #[]=(key, value) set a value for a key. If the key is already used, clobber it. keys set using []= will never expire. #store(key, value, options = {}) same as []=, but you can supply options. #delete(key, options = {}) delete the key from the store and return the current value. #key?(key, options = {}) true if the key exists, false if it does not. #increment(key, amount = 1, options = {}) increment numeric value. This is an atomic operation which is not supported by all stores. Returns current value. #decrement(key, amount = 1, options = {}) increment numeric value. This is an atomic operation which is not supported by all stores. Returns current value. This is just syntactic sugar for incrementing with a negative value. #create(key, value, options = {}) create entry. This is an atomic operation which is not supported by all stores. Returns true if the value was created. #clear(options = {}) clear all keys in this store. #close close database connection. #features return array of features, e.g. [:create, :expires, :increment] #supports?(feature) returns true if store supports a given feature ~~~ ### Creating a Store There is a simple interface to create a store using `Moneta.new`. You will get automatic key and value serialization which is provided by `Moneta::Transformer`. This allows you to store arbitrary Ruby objects. You can tune some options when you call `Moneta.new`. However for very fine tuning use `Moneta.build`. ~~~ ruby store = Moneta.new(:Memcached, :server => 'localhost:11211') store['key'] = 'value' store['hash_key'] = {:a => 1, :b => 2} store['object_key'] = MarshallableRubyObject.new ~~~ If you want to have control over the proxies, you have to use `Moneta.build`: ~~~ ruby store = Moneta.build do # Adds expires proxy use :Expires # Transform key using Marshal and Base64 and value using Marshal use :Transformer, :key => [:marshal, :base64], :value => :marshal # IMPORTANT: adapter must be defined last for the builder to function properly. # Memory backend adapter :Memory end ~~~ You can also directly access the underlying adapters if you don't want to use the Moneta stack. ~~~ ruby db = Moneta::Adapters::File.new(:dir => 'directory') db['key'] = {:a => 1, :b => 2} # This will fail since you can only store Strings # However for Mongo and Couch this works # The hash will be mapped directly to a Mongo/Couch document. db = Moneta::Adapters::Couch.new db['key'] = {:a => 1, :b => 2} db = Moneta::Adapters::Mongo.new db['key'] = {:a => 1, :b => 2} ~~~ ### Expiration The Cassandra, Memcached, Redis and Mongo backends support expiration natively. ~~~ ruby cache = Moneta::Adapters::Memcached.new # Or using the builder... cache = Moneta.build do adapter :Memcached end # Expires in 60 seconds cache.store(key, value, :expires => 60) # Never expire cache.store(key, value, :expires => 0) cache.store(key, value, :expires => false) # Update expires time if value is found cache.load(key, :expires => 30) cache.key?(key, :expires => 30) # Or remove the expiration if found cache.load(key, :expires => false) cache.key?(key, :expires => 0) ~~~ You can add the expires feature to other backends using the `Moneta::Expires` proxy. But be aware that expired values are not deleted automatically if they are not looked up. ~~~ ruby # Using the :expires option cache = Moneta.new(:File, :dir => '...', :expires => true) # or manually by using the proxy... cache = Moneta::Expires.new(Moneta::Adapters::File.new(:dir => '...')) # or using the builder... cache = Moneta.build do use :Expires adapter :File, :dir => '...' end ~~~ ### Atomic operations #### Atomic incrementation and raw access The stores support the `#increment` which allows atomic increments of unsigned integer values. If you increment a non existing value, it will be created. If you increment a non integer value an exception will be raised. ~~~ ruby store.increment('counter') # returns 1, counter created store.increment('counter') # returns 2 store.increment('counter', -1) # returns 1 store.increment('counter', 13) # returns 14 store.increment('counter', 0) # returns 14 store.decrement('counter') # returns 13 store['name'] = 'Moneta' store.increment('name') # raises an Exception ~~~ If you want to access the counter value you have to use raw access to the datastore. This is only important if you have a `Moneta::Transformer` somewhere in your proxy stack which transforms the values e.g. with `Marshal`. ~~~ ruby store.increment('counter') # returns 1, counter created store.load('counter', :raw => true) # returns 1 store.store('counter', '10', :raw => true) store.increment('counter') # returns 11 ~~~ Fortunately there is a nicer way to do this using some syntactic sugar! ~~~ ruby store.increment('counter') # returns 1, counter created store.raw['counter'] # returns 1 store.raw.load('counter') # returns 1 store.raw['counter'] = '10' store.increment('counter') # returns 11 ~~~ You can also keep the `raw` store in a variable and use it like this: ~~~ ruby counters = store.raw counters.increment('counter') # returns 1, counter created counters['counter'] # returns 1 counters.load('counter') # returns 1 counters['counter'] = '10' counters.increment('counter') # returns 11 ~~~ #### Atomic create The stores support the `#create` which allows atomic creation of entries. `#create` returns true if the value was created. ~~~ ruby store.create('key', 'value') # returns true store.create('key', 'other value') # returns false ~~~ #### Shared/distributed synchronization primitives Moneta provides shared/distributed synchronization primitives which are shared database-wide between all clients. `Moneta::Mutex` allows a single thread to enter a critical section. ~~~ ruby mutex = Moneta::Mutex.new(store, 'mutex_key') mutex.synchronize do mutex.locked? # returns true # Synchronized access to counter store['counter'] += 1 end begin mutex.lock mutex.locked? # returns true # ... ensure mutex.unlock end ~~~ `Moneta::Semaphore` allows `max_concurrent` threads to enter a critical section. ~~~ ruby semaphore = Moneta::Semaphore.new(store, 'semaphore_counter', max_concurrent) semaphore.synchronize do semaphore.locked? # returns true # ... end begin semaphore.enter semaphore.locked? # returns true # ... ensure semaphore.leave end ~~~ #### Weak atomic operations If an underlying adapter doesn't provide atomic `#create` or `#increment` and `#decrement` you can use the proxies `Moneta::WeakIncrement` and `Moneta::WeakCreate` to add support without atomicity. But then you have to ensure that the store is not shared by multiple processes and thread-safety is provided by `Moneta::Lock`. ### Syntactic sugar and option merger For raw data access as described before the class `Moneta::OptionMerger` is used. It works like this: ~~~ ruby # All methods after 'with' get the options passed store.with(:raw => true).load('key') # You can also specify the methods store.with(:raw => true, :only => :load).load('key') store.with(:raw => true, :except => [:key?, :increment]).load('key') # Syntactic sugar for raw access store.raw.load('key') # Access substore where all keys get a prefix substore = store.prefix('sub') substore['key'] = 'value' store['key'] # returns nil store['subkey'] # returns 'value' # Set expiration time for all keys short_lived_store = store.expires(60) short_lived_store['key'] = 'value' ~~~ ### Add proxies to existing store You can add proxies to an existing store. This is useful if you want to compress only a few values for example. ~~~ ruby compressed_store = store.with(:prefix => 'compressed') do use :Transformer, :value => :zlib end store['key'] = 'this value will not be compressed' compressed_store['key'] = 'value will be compressed' ~~~ ------ ## Framework Integration Inspired by [redis-store](https://github.com/jodosha/redis-store) there exist integration classes for [Rails](http://rubyonrails.org/) and [Rack](http://rack.github.com/)/[Rack-Cache](https://github.com/rtomayko/rack-cache). You can also use all the Rack middlewares together with Rails and the [Sinatra](http://sinatrarb.com/) framework. There exist the following integration classes: * Rack, Rails and Sinatra * `Rack::Session::Moneta` is a Rack middleware to use Moneta for storing sessions * `Rack::MonetaStore` is a Rack middleware which places a Moneta store in the environment and enables per-request caching * `Rack::MonetaCookies` is a Rack middleware which uses Moneta to store cookies * `Rack::MonetaRest` is a Rack application which exposes a Moneta store via REST/HTTP * `Rack::Cache::Moneta` provides meta and entity stores for Rack-Cache * Rails * `ActionDispatch::Session::MonetaStore` is a Rails middleware to use Moneta for storing sessions * `ActiveSupport::Cache::MonetaStore` is a Rails cache implementation which uses a Moneta store as backend * Ramaze * `Ramaze::Cache::Moneta` is integrated into the [Ramaze](http://ramaze.net/) project and allows Ramaze to use Moneta as caching store ### Rack #### Session store You can use Moneta as a [Rack](http://rack.github.com/) session store. Use it in your `config.ru` like this: ~~~ ruby require 'rack/session/moneta' # Use only the adapter name use Rack::Session::Moneta, :store => :Redis # Use Moneta.new use Rack::Session::Moneta, :store => Moneta.new(:Memory, :expires => true) # Use the Moneta builder use Rack::Session::Moneta do use :Expires adapter :Memory end ~~~ #### Moneta middleware There is a simple middleware which places a Moneta store in the Rack environment at `env['rack.moneta_store']`. It supports per-request caching if you add the option `:cache => true`. Use it in your `config.ru` like this: ~~~ ruby # Add Rack::MonetaStore somewhere in your rack stack use Rack::MonetaStore, :Memory, :cache => true run lambda { |env| env['rack.moneta_store'] # is a Moneta store with per-request caching } # Pass it a block like the one passed to Moneta.build use Rack::MonetaStore do use :Transformer, :value => :zlib adapter :Cookie end run lambda { |env| env['rack.moneta_store'] # is a Moneta store without caching } ~~~ #### REST server If you want to expose your Moneta key/value store via HTTP, you can use the Rack/Moneta REST service. Use it in your `config.ru` like this: ~~~ ruby require 'rack/moneta_rest' map '/moneta' do run Rack::MonetaRest.new(:Memory) end # Or pass it a block like the one passed to Moneta.build run Rack::MonetaRest.new do use :Transformer, :value => :zlib adapter :Memory end ~~~ #### Rack-Cache You can use Moneta as a [Rack-Cache](https://github.com/rtomayko/rack-cache) store. Use it in your `config.ru` like this: ~~~ ruby require 'rack/cache/moneta' use Rack::Cache, :metastore => 'moneta://Memory?expires=true', :entitystore => 'moneta://Memory?expires=true' # Or used named Moneta stores Rack::Cache::Moneta['named_metastore'] = Moneta.build do use :Expires adapter :Memory end use Rack::Cache, :metastore => 'moneta://named_metastore', :entity_store => 'moneta://named_entitystore' ~~~ #### Cookies Use Moneta to store cookies in [Rack](http://rack.github.com/). It uses the `Moneta::Adapters::Cookie`. You might wonder what the purpose of this store or Rack middleware is: It makes it possible to use all the transformers on the cookies (e.g. `:prefix`, `:marshal` and `:hmac` for value verification). ~~~ ruby require 'rack/moneta_cookies' use Rack::MonetaCookies, :domain => 'example.com', :path => '/path' run lambda { |env| req = Rack::Request.new(env) req.cookies #=> is now a Moneta store! env['rack.request.cookie_hash'] #=> is now a Moneta store! req.cookies['key'] #=> retrieves 'key' req.cookies['key'] = 'value' #=> sets 'key' req.cookies.delete('key') #=> removes 'key' [200, {}, []] } ~~~ ### Rails #### Session store Add the session store in your application configuration `config/environments/*.rb`. ~~~ ruby require 'moneta' # Only by adapter name config.cache_store :moneta_store, :store => :Memory # Use Moneta.new config.cache_store :moneta_store, :store => Moneta.new(:Memory) # Use the Moneta builder config.cache_store :moneta_store, :store => Moneta.build do use :Expires adapter :Memory end ~~~ #### Cache store Add the cache store in your application configuration `config/environments/*.rb`. Unfortunately the Moneta cache store doesn't support matchers. If you need these features use a different server-specific implementation. ~~~ ruby require 'moneta' # Only by adapter name config.cache_store :moneta_store, :store => :Memory # Use Moneta.new config.cache_store :moneta_store, :store => Moneta.new(:Memory) # Use the Moneta builder config.cache_store :moneta_store, :store => Moneta.build do use :Expires adapter :Memory end ~~~ ------ ## Advanced ### Build your own key value server You can use Moneta to build your own key/value server which is shared between multiple processes. If you run the following code in two different processes, they will share the same data which will also be persistet in the database `shared.db`. ~~~ ruby require 'moneta' store = Moneta.build do use :Transformer, :key => :marshal, :value => :marshal use :Shared do use :Cache do cache do adapter :LRUHash end backend do adapter :GDBM, :file => 'shared.db' end end end end ~~~ If you want to go further, you might want to take a look at `Moneta::Server` and `Moneta::Adapters::Client` which are used by `Moneta::Shared` and provide the networking communication. But be aware that they are experimental and subjected to change. They provide an acceptable performance (for being ruby only), but don't have a stable protocol yet. You might wonder why I didn't use [DRb](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/drb/rdoc/DRb.html) to implement server and client - in fact my first versions used it, but with much worse performance and it was real fun to implement the networking directly :) There is still much room for improvement and experiments, try [EventMachine](http://eventmachine.rubyforge.org/), try [Kgio](http://bogomips.org/kgio/), ... ### ToyStore ORM If you want something more advanced to handle your objects and relations, use John Nunemaker's [ToyStore](https://github.com/jnunemaker/toystore) which works together with Moneta. Assuming that `Person` is a `ToyStore::Object` you can add persistence using Moneta as follows: ~~~ ruby # Use the Moneta Redis backend Person.adapter :memory, Moneta.new(:Redis) ~~~ ------ ## Testing and Benchmarks Testing is done using [Travis-CI](http://travis-ci.org/minad/moneta). Currently we support Ruby 1.8.7 and 1.9.3. Benchmarks for each store are done on [Travis-CI](http://travis-ci.org/minad/moneta) for each build. Take a look there to compare the speed of the different key value stores for different key/value sizes and size distributions. Feel free to add your own configurations! The impact of Moneta should be minimal since it is only a thin layer on top of the different stores. ------ ## How to contribute? Always feel free to open an issue on https://github.com/minad/moneta/issues if something doesn't work as you expect it to work. Feedback is also very welcome! My only request about patches is that you please try to test them before submitting. ### Contribute an adapter If you want support for another adapter you can at first at it to the list of missing adapters at https://github.com/minad/moneta/issues/16 If you choose to implement an adapter please also add tests. Usually you only have to add a few lines to `script/generate-specs` to generate appropriate tests for your adapter. Please check also if travis.yml needs changes, for example if you need to start additional services. Check if the default settings in Moneta#new are appropriate for your adapter. If not specify a better one. Don't forget to edit the README.md and the CHANGES. ------ ## Alternatives * [Horcrux](https://github.com/technoweenie/horcrux): Used at github, supports batch operations but only Memcached backend * [ActiveSupport::Cache::Store](http://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html): The Rails cache store abstraction * [Padrino::Cache::Store](http://www.padrinorb.com/api/Padrino/Cache/Store.html): The Padrino cache store abstraction. Padrino is currently considering switching to Moneta, see https://github.com/padrino/padrino-framework/pull/1018 * [ToyStore](https://github.com/jnunemaker/toystore): ORM mapper for key/value stores * [ToyStore Adapter](https://github.com/jnunemaker/adapter): Adapter to key/value stores used by ToyStore, Moneta can be used directly with the ToyStore Memory adapter * [Cache](https://github.com/seamusabshere/cache): Rubygem cache wraps Memcached and Redis * [Ramaze::Cache](http://ramaze.net/documentation/Innate/Cache.html): Cache stores of the Ramaze framework with support for LocalMemCache, Memcached, Sequel, Redis, ... ------ ## Authors * [Daniel Mendler](https://github.com/minad) * [Hannes Georg](https://github.com/hannesg) * Originally by [Yehuda Katz](https://github.com/wycats) and contributors ruby-moneta-0.7.20/SPEC.md000066400000000000000000000126271232153565500151350ustar00rootroot00000000000000# Moneta Specification (See RFC 2119 for use of MUST, SHOULD, MAY, MUST NOT, and SHOULD NOT) The purpose of the moneta specification is to create a general-purpose API for interacting with key-value stores. In general, libraries that need to interact with key-value stores should be able to specify that they can use any "moneta-compliant store". Moneta ships with a set of executable specs which you can use to verify spec-compliance with your moneta adapter. ## Class Methods ### new(options[Hash] => {}) => Object Return an instance of the moneta adapter, with the instance methods listed below. The options hash is a required parameter, and the adapter may specify whatever additional requirements it needs to properly instantiate it. ## Instance Methods ### \[\](key[Object]) => Object Return the value stored in the key-value-store under the provided key. Adapters MUST return a duplicate of the original value, and consumers should expect that adapters might serialize and deserialize the key and value. As a result, both the key and value MUST be objects that can be serialized using Ruby's Marshal system. ### \[\]=(key[Object], value[Object]) => Object(value) Store the value in the key-value-store under the provided key. Adapters MAY serialize the value using Ruby's Marshal system, and MUST NOT store a reference to the original value in the store, unless Ruby disallows duplication of the original value. Adapters SHOULD NOT simply call dup on the value, unless the value stores no references to other Object. For example, an adapter MAY store a dup of a String, but SHOULD NOT store a dup of ["hello", "world"]. ### fetch(key[Object], options[Hash] => {}, &block) => Object Return the value stored in the key-value-store under the provided key. If no value is stored under the provided key, the adapter MUST yield to the block, and return the value. The adapter MUST NOT store the value returned from the block in the key-value-store. ### fetch(key[Object], value[Object], options[Hash] => {}) => Object Return the value stored in the key-value-store under the provided key. If no value is stored under the provided key, the adapter MUST return the default value provided. The adapter MUST NOT store the default value in the key-value-store. ### delete(key[Object], options[Hash] => {}) => Object Delete the value stored in the key-value-store for the key provided, and return the value previously stored there. After this operation, the key-value-store MUST behave as though no value was stored for the provided key. ### key?(key[Object], options[Hash] => {}) => [TrueClass, FalseClass] Determine whether a value exists in the key-value-store for the key provided. If a value exists, the adapter MUST return true. Otherwise, the adapter MUST return false. ### store(key[Object], value[Object], options[Hash] => {}) => Object(value) Behaves the same as []=, but allows the client to send additional options which can be specified by the adapter (and which may be specified by extensions to this specification). ### increment(key[Object], amount[Integer] = 1, options[Hash] => {}) => Integer(value) Increments a value atomically. This method is not supported by all stores and might raise a NotImplementedError. This method MUST accept negative amounts, but the result MUST be unsigned. ### decrement(key[Object], amount[Integer] = 1, options[Hash] => {}) => Integer(value) Decrements a value atomically. This method is not supported by all stores and might raise a NotImplementedError. This method MUST accept negative amounts, but the result MUST be unsigned. ### create(key[Object], value[Object], options[Hash] => {}) => [TrueClass, FalseClass] Creates a value atomically. This method is not supported by all stores and might raise a NotImplementedError. It MUST return true if the value was created. ### clear(options[Hash] => {}) Completely empty all keys and values from the key-value-store. Adapters MAY allow a namespace during initialization, which can scope this operation to a particular subset of keys. After calling clear, a [] operation MUST return nil for every possible key, and a key? query MUST return false for every possible key. ### close Closes the store ### features => Array<Symbol> and supports?(Symbol) => [TrueClass, FalseClass] Feature detection. Adapters MUST return :create and :increment if these methods are supported. ## Additional Options Hashes The following methods may all take an additional Hash as a final argument. This allows the client to send additional options which can be specified by the adapter (and which may be specified by extensions to this specification). The methods MUST NOT modify the supplied option hash. * fetch * load * store * delete * key? * increment * clear In the case of methods with optional arguments, the Hash MUST be provided as the final argument. Keys in this Hash MUST be Symbols. ## Atomicity The base Moneta specification does not specify any atomicity guarantees. However, extensions to this spec may specify extensions that define additional guarantees for any of the defined operations. ruby-moneta-0.7.20/checksums.yaml.gz000066400000000000000000000004141232153565500173400ustar00rootroot00000000000000BIRe;V0 "O_[JGG $ˢ8Щٙ]n+/~D#^>rZS}N<D`z@ fs8#~s9* l$ri@ӪH |Xh0<"ybduL&ЩIL,8{BR(pjS$N!m'vZ=|)mW%FΧ,}d2t0l Vӷhy>[0dNkSa^ Ĝr\~~;ruby-moneta-0.7.20/lib/000077500000000000000000000000001232153565500146175ustar00rootroot00000000000000ruby-moneta-0.7.20/lib/action_dispatch/000077500000000000000000000000001232153565500177535ustar00rootroot00000000000000ruby-moneta-0.7.20/lib/action_dispatch/middleware/000077500000000000000000000000001232153565500220705ustar00rootroot00000000000000ruby-moneta-0.7.20/lib/action_dispatch/middleware/session/000077500000000000000000000000001232153565500235535ustar00rootroot00000000000000ruby-moneta-0.7.20/lib/action_dispatch/middleware/session/moneta_store.rb000066400000000000000000000004651232153565500266040ustar00rootroot00000000000000require 'rack/session/moneta' require 'action_dispatch/middleware/session/abstract_store' module ActionDispatch module Session class MonetaStore < Rack::Session::Moneta include Compatibility include StaleSessionCheck include SessionObject if defined?(SessionObject) end end end ruby-moneta-0.7.20/lib/active_support/000077500000000000000000000000001232153565500176665ustar00rootroot00000000000000ruby-moneta-0.7.20/lib/active_support/cache/000077500000000000000000000000001232153565500207315ustar00rootroot00000000000000ruby-moneta-0.7.20/lib/active_support/cache/moneta_store.rb000066400000000000000000000033311232153565500237550ustar00rootroot00000000000000module ActiveSupport module Cache # @api public class MonetaStore < Store def initialize(options = nil) raise ArgumentError, 'Option :store is required' unless @store = options.delete(:store) @store = ::Moneta.new(@store, :expires => true) if Symbol === @store super(options) extend Strategy::LocalCache end def increment(key, amount = 1, options = nil) options = merged_options(options) instrument(:increment, key, :amount => amount) do @store.increment(namespaced_key(key, options), amount, moneta_options(options)) end end def decrement(key, amount = 1, options = nil) options = merged_options(options) instrument(:decrement, key, :amount => amount) do @store.increment(namespaced_key(key, options), -amount, moneta_options(options)) end end def clear(options = nil) options = merged_options(options) instrument(:clear, nil, nil) do @store.clear(moneta_options(options)) end end protected def read_entry(key, options) entry = @store.load(key, moneta_options(options)) entry && (ActiveSupport::Cache::Entry === entry ? entry : ActiveSupport::Cache::Entry.new(entry)) end def write_entry(key, entry, options) @store.store(key, entry, moneta_options(options)) true end def delete_entry(key, options) @store.delete(key, moneta_options(options)) true end private def moneta_options(options) options ||= {} options[:expires] = options.delete(:expires_in).to_i if options.include?(:expires_in) options end end end end ruby-moneta-0.7.20/lib/moneta.rb000066400000000000000000000155731232153565500164420ustar00rootroot00000000000000module Moneta autoload :Builder, 'moneta/builder' autoload :Cache, 'moneta/cache' autoload :CreateSupport, 'moneta/mixins' autoload :Defaults, 'moneta/mixins' autoload :ExpiresSupport, 'moneta/mixins' autoload :Expires, 'moneta/expires' autoload :HashAdapter, 'moneta/mixins' autoload :IncrementSupport, 'moneta/mixins' autoload :Lock, 'moneta/lock' autoload :Logger, 'moneta/logger' autoload :Mutex, 'moneta/synchronize' autoload :OptionMerger, 'moneta/optionmerger' autoload :OptionSupport, 'moneta/mixins' autoload :Pool, 'moneta/pool' autoload :Proxy, 'moneta/proxy' autoload :Semaphore, 'moneta/synchronize' autoload :Server, 'moneta/server' autoload :Shared, 'moneta/shared' autoload :Stack, 'moneta/stack' autoload :Transformer, 'moneta/transformer' autoload :Utils, 'moneta/utils' autoload :WeakCreate, 'moneta/weak' autoload :WeakIncrement, 'moneta/weak' autoload :Wrapper, 'moneta/wrapper' module Adapters autoload :ActiveRecord, 'moneta/adapters/activerecord' autoload :Cassandra, 'moneta/adapters/cassandra' autoload :Client, 'moneta/adapters/client' autoload :Cookie, 'moneta/adapters/cookie' autoload :Couch, 'moneta/adapters/couch' autoload :Daybreak, 'moneta/adapters/daybreak' autoload :DBM, 'moneta/adapters/dbm' autoload :DataMapper, 'moneta/adapters/datamapper' autoload :File, 'moneta/adapters/file' autoload :Fog, 'moneta/adapters/fog' autoload :GDBM, 'moneta/adapters/gdbm' autoload :HBase, 'moneta/adapters/hbase' autoload :LRUHash, 'moneta/adapters/lruhash' autoload :KyotoCabinet, 'moneta/adapters/kyotocabinet' autoload :LevelDB, 'moneta/adapters/leveldb' autoload :LMDB, 'moneta/adapters/lmdb' autoload :LocalMemCache, 'moneta/adapters/localmemcache' autoload :Memcached, 'moneta/adapters/memcached' autoload :MemcachedDalli, 'moneta/adapters/memcached/dalli' autoload :MemcachedNative, 'moneta/adapters/memcached/native' autoload :Memory, 'moneta/adapters/memory' autoload :Mongo, 'moneta/adapters/mongo' autoload :Null, 'moneta/adapters/null' autoload :PStore, 'moneta/adapters/pstore' autoload :Redis, 'moneta/adapters/redis' autoload :RestClient, 'moneta/adapters/restclient' autoload :Riak, 'moneta/adapters/riak' autoload :SDBM, 'moneta/adapters/sdbm' autoload :Sequel, 'moneta/adapters/sequel' autoload :Sqlite, 'moneta/adapters/sqlite' autoload :TDB, 'moneta/adapters/tdb' autoload :TokyoCabinet, 'moneta/adapters/tokyocabinet' autoload :TokyoTyrant, 'moneta/adapters/tokyotyrant' autoload :YAML, 'moneta/adapters/yaml' end # Create new Moneta store with default proxies # # This works in most cases if you don't want fine # control over the proxy stack. It uses Marshal on the # keys and values. Use Moneta#build if you want to have fine control! # # @param [Symbol] name Name of adapter (See Moneta::Adapters) # @param [Hash] options # @return [Moneta store] newly created Moneta store # @option options [Boolean/Integer] :expires Ensure that store supports expiration by inserting # {Expires} if the underlying adapter doesn't support it natively # and set default expiration time # @option options [Boolean] :threadsafe (false) Ensure that the store is thread safe by inserting Moneta::Lock # @option options [Boolean/Hash] :logger (false) Add logger to proxy stack (Hash is passed to logger as options) # @option options [Boolean/Symbol] :compress (false) If true, compress value with zlib, or specify custom compress, e.g. :quicklz # @option options [Symbol] :serializer (:marshal) Serializer used for key and value, disable with nil # @option options [Symbol] :key_serializer (options[:serializer]) Serializer used for key, disable with nil # @option options [Symbol] :value_serializer (options[:serializer]) Serializer used for value, disable with nil # @option options [String] :prefix Key prefix used for namespacing (default none) # @option options All other options passed to the adapter # # Supported adapters: # * :HashFile (Store which spreads the entries using a md5 hash, e.g. cache/42/391dd7535aebef91b823286ac67fcd) # * :File (normal file store) # * :Memcached (Memcached store) # * ... (All other adapters from Moneta::Adapters) # # @api public def self.new(name, options = {}) expires = options[:expires] options.delete(:expires) unless Integer === expires logger = options.delete(:logger) threadsafe = options.delete(:threadsafe) compress = options.delete(:compress) serializer = options.include?(:serializer) ? options.delete(:serializer) : :marshal key_serializer = options.include?(:key_serializer) ? options.delete(:key_serializer) : serializer value_serializer = options.include?(:value_serializer) ? options.delete(:value_serializer) : serializer transformer = { :key => [key_serializer, :prefix], :value => [value_serializer], :prefix => options.delete(:prefix) } transformer[:value] << (Symbol === compress ? compress : :zlib) if compress raise ArgumentError, 'Name must be Symbol' unless Symbol === name case name when :Sequel # Sequel accept only base64 keys transformer[:key] << :base64 when :ActiveRecord, :DataMapper, :Couch # DataMapper and AR accept only base64 keys and values transformer[:key] << :base64 transformer[:value] << :base64 when :PStore, :YAML, :Null # For PStore and YAML only the key has to be a string transformer.delete(:value) if transformer[:value] == [:marshal] when :HashFile # Use spreading hashes transformer[:key] << :md5 << :spread name = :File when :File, :Riak, :RestClient # Use escaping for file and HTTP interfaces transformer[:key] << :escape end a = Adapters.const_get(name).new(options) build do use :Logger, Hash === logger ? logger : {} if logger use :Expires, :expires => options[:expires] if !a.supports?(:expires) && expires use :Transformer, transformer use :Lock if threadsafe adapter a end end # Configure your own Moneta proxy stack # # @yieldparam Builder block # @return [Moneta store] newly created Moneta store # # @example Moneta builder # Moneta.build do # use :Expires # adapter :Memory # end # # @api public def self.build(&block) Builder.new(&block).build.last end end ruby-moneta-0.7.20/lib/moneta/000077500000000000000000000000001232153565500161025ustar00rootroot00000000000000ruby-moneta-0.7.20/lib/moneta/adapters/000077500000000000000000000000001232153565500177055ustar00rootroot00000000000000ruby-moneta-0.7.20/lib/moneta/adapters/activerecord.rb000066400000000000000000000107731232153565500227140ustar00rootroot00000000000000require 'active_record' require 'thread' module Moneta module Adapters # ActiveRecord as key/value stores # @api public class ActiveRecord include Defaults supports :create, :increment attr_reader :table @table_mutex = ::Mutex.new @table_refcount = {} class << self def release(table) @table_mutex.synchronize do if (@table_refcount[table] -= 1) <= 0 remove_const(table.name.sub(/^.*::/, '')) @table_refcount.delete(table) end end end def get(options) name = 'Table_' << options.inspect.gsub(/[^\w]+/) do $&.unpack('H2' * $&.bytesize).join.upcase end @table_mutex.synchronize do table = if const_defined?(name) const_get(name) else create(name, options) end @table_refcount[table] ||= 0 @table_refcount[table] += 1 table end end private def create(name, options) table = Class.new(::ActiveRecord::Base) const_set(name, table) table.table_name = options[:table] || 'moneta' table.primary_key = :k if options[:connection] begin table.establish_connection(options[:connection]) rescue tries ||= 0 (tries += 1) < 3 ? retry : raise end end table.connection_pool.with_connection do |conn| unless table.table_exists? conn.create_table(table.table_name, :id => false) do |t| # Do not use binary key (Issue #17) t.string :k, :null => false t.binary :v end conn.add_index(table.table_name, :k, :unique => true) end end table rescue remove_const(name) raise end end # @param [Hash] options # @option options [String] :table ('moneta') Table name # @option options [Hash] :connection ActiveRecord connection configuration def initialize(options = {}) @table = self.class.get(options) end # (see Proxy#key?) def key?(key, options = {}) @table.connection_pool.with_connection do !@table.where(:k => key).empty? end end # (see Proxy#load) def load(key, options = {}) @table.connection_pool.with_connection do record = @table.select(:v).where(:k => key).first record && record.v end end # (see Proxy#store) def store(key, value, options = {}) @table.connection_pool.with_connection do record = @table.select(:k).where(:k => key).first_or_initialize record.v = value record.save value end rescue tries ||= 0 (tries += 1) < 10 ? retry : raise end # (see Proxy#delete) def delete(key, options = {}) @table.connection_pool.with_connection do if record = @table.where(:k => key).first record.destroy record.v end end end # (see Proxy#increment) def increment(key, amount = 1, options = {}) @table.connection_pool.with_connection do @table.transaction do if record = @table.where(:k => key).lock.first value = Utils.to_int(record.v) + amount record.v = value.to_s record.save value elsif create(key, amount.to_s, options) amount else raise 'Concurrent modification' end end end rescue tries ||= 0 (tries += 1) < 10 ? retry : raise end # (see Proxy#create) def create(key, value, options = {}) @table.connection_pool.with_connection do record = @table.new record.k = key record.v = value record.save true end rescue # FIXME: This catches too many errors # it should only catch a not-unique-exception false end # (see Proxy#clear) def clear(options = {}) @table.connection_pool.with_connection do @table.delete_all end self end # (see Proxy#close) def close self.class.release(@table) @table = nil end end end end ruby-moneta-0.7.20/lib/moneta/adapters/cassandra.rb000066400000000000000000000066211232153565500221760ustar00rootroot00000000000000require 'cassandra' module Moneta module Adapters # Cassandra backend # @api public # @author Potapov Sergey (aka Blake) class Cassandra include Defaults include ExpiresSupport attr_reader :backend # @param [Hash] options # @option options [String] :keyspace ('moneta') Cassandra keyspace # @option options [String] :column_family ('moneta') Cassandra column family # @option options [String] :host ('127.0.0.1') Server host name # @option options [Integer] :port (9160) Server port # @option options [Integer] :expires Default expiration time # @option options [::Cassandra] :backend Use existing backend instance # @option options Other options passed to `Cassandra#new` def initialize(options = {}) self.default_expires = options.delete(:expires) @cf = (options.delete(:column_family) || 'moneta').to_sym if options[:backend] @backend = options[:backend] else keyspace = options.delete(:keyspace) || 'moneta' options[:retries] ||= 3 options[:connect_timeout] ||= 10 options[:timeout] ||= 10 @backend = ::Cassandra.new('system', "#{options[:host] || '127.0.0.1'}:#{options[:port] || 9160}", options) unless @backend.keyspaces.include?(keyspace) cf_def = ::Cassandra::ColumnFamily.new(:keyspace => keyspace, :name => @cf.to_s) ks_def = ::Cassandra::Keyspace.new(:name => keyspace, :strategy_class => 'SimpleStrategy', :strategy_options => { 'replication_factor' => '1' }, :replication_factor => 1, :cf_defs => [cf_def]) # Wait for keyspace to be created (issue #24) 10.times do begin @backend.add_keyspace(ks_def) rescue Exception => ex warn "Moneta::Adapters::Cassandra - #{ex.message}" end break if @backend.keyspaces.include?(keyspace) sleep 0.1 end end @backend.keyspace = keyspace end end # (see Proxy#key?) def key?(key, options = {}) if @backend.exists?(@cf, key) load(key, options) if options.include?(:expires) true else false end end # (see Proxy#load) def load(key, options = {}) if value = @backend.get(@cf, key) expires = expires_value(options, nil) @backend.insert(@cf, key, {'value' => value['value'] }, :ttl => expires || nil) if expires != nil value['value'] end end # (see Proxy#store) def store(key, value, options = {}) @backend.insert(@cf, key, {'value' => value}, :ttl => expires_value(options) || nil) value end # (see Proxy#delete) def delete(key, options = {}) if value = load(key, options) @backend.remove(@cf, key) value end end # (see Proxy#clear) def clear(options = {}) @backend.clear_column_family!(@cf) self end # (see Proxy#close) def close @backend.disconnect! nil end end end end ruby-moneta-0.7.20/lib/moneta/adapters/client.rb000066400000000000000000000040571232153565500215160ustar00rootroot00000000000000require 'socket' module Moneta module Adapters # Moneta client backend # @api public class Client include Defaults # @param [Hash] options # @option options [Integer] :port (9000) TCP port # @option options [String] :host ('127.0.0.1') Hostname # @option options [String] :socket Unix socket file name as alternative to `:port` and `:host` def initialize(options = {}) @socket = options[:socket] ? UNIXSocket.open(options[:socket]) : TCPSocket.open(options[:host] || '127.0.0.1', options[:port] || 9000) end # (see Proxy#key?) def key?(key, options = {}) write(:key?, key, options) read end # (see Proxy#load) def load(key, options = {}) write(:load, key, options) read end # (see Proxy#store) def store(key, value, options = {}) write(:store, key, value, options) read value end # (see Proxy#delete) def delete(key, options = {}) write(:delete, key, options) read end # (see Proxy#increment) def increment(key, amount = 1, options = {}) write(:increment, key, amount, options) read end # (see Proxy#create) def create(key, value, options = {}) write(:create, key, value, options) read end # (see Proxy#clear) def clear(options = {}) write(:clear, options) read self end # (see Proxy#close) def close @socket.close nil end # (see Default#features) def features @features ||= begin write(:features) read.freeze end end private def write(*args) s = Marshal.dump(args) @socket.write([s.bytesize].pack('N') << s) end def read size = @socket.read(4).unpack('N').first result = Marshal.load(@socket.read(size)) raise result if Exception === result result end end end end ruby-moneta-0.7.20/lib/moneta/adapters/cookie.rb000066400000000000000000000017071232153565500215100ustar00rootroot00000000000000module Moneta module Adapters # Cookie backend used by the middleware {Rack::MonetaCookies} # @api public class Cookie < Memory attr_reader :cookies def initialize(options = {}) super @options, @cookies = options, {} end # (see Proxy#store) def store(key, value, options = {}) cookie = @options.merge(options) cookie[:value] = value cookie[:expires] += Time.now.to_i if cookie[:expires] @cookies[key] = cookie super end # (see Proxy#delete) def delete(key, options = {}) @cookies[key] = nil super end # (see Proxy#clear) def clear(options = {}) @backend.each_key { |key| @cookies[key] = nil } super self end # Reset the cookie store # This method is used by the middleware. def reset(cookies) @cookies, @backend = {}, cookies end end end end ruby-moneta-0.7.20/lib/moneta/adapters/couch.rb000066400000000000000000000075521232153565500213440ustar00rootroot00000000000000require 'faraday' require 'multi_json' module Moneta module Adapters # CouchDB backend # # You can store hashes directly using this adapter. # # @example Store hashes # db = Moneta::Adapters::Mongo.new # db['key'] = {a: 1, b: 2} # # @api public class Couch include Defaults attr_reader :backend supports :create # @param [Hash] options # @option options [String] :host ('127.0.0.1') Couch host # @option options [String] :port (5984) Couch port # @option options [String] :db ('moneta') Couch database # @option options [String] :value_field ('value') Document field to store value # @option options [String] :type_field ('type') Document field to store value type # @option options [Faraday connection] :backend Use existing backend instance def initialize(options = {}) @value_field = options[:value_field] || 'value' @type_field = options[:type_field] || 'type' url = "http://#{options[:host] || '127.0.0.1'}:#{options[:port] || 5984}/#{options[:db] || 'moneta'}" @backend = options[:backend] || ::Faraday.new(:url => url) create_db end # (see Proxy#key?) def key?(key, options = {}) @backend.head(key).status == 200 end # (see Proxy#load) def load(key, options = {}) response = @backend.get(key) response.status == 200 ? body_to_value(response.body) : nil end # (see Proxy#store) def store(key, value, options = {}) response = @backend.head(key) body = value_to_body(value, response.status == 200 && response['etag'][1..-2]) response = @backend.put(key, body, 'Content-Type' => 'application/json') raise "HTTP error #{response.status}" unless response.status == 201 value rescue tries ||= 0 (tries += 1) < 10 ? retry : raise end # (see Proxy#delete) def delete(key, options = {}) response = @backend.get(key) if response.status == 200 value = body_to_value(response.body) response = @backend.delete("#{key}?rev=#{response['etag'][1..-2]}") raise "HTTP error #{response.status}" unless response.status == 200 value end rescue tries ||= 0 (tries += 1) < 10 ? retry : raise end # (see Proxy#clear) def clear(options = {}) @backend.delete '' create_db self end # (see Proxy#create) def create(key, value, options = {}) body = value_to_body(value, nil) response = @backend.put(key, body, 'Content-Type' => 'application/json') case response.status when 201 true when 409 false else raise "HTTP error #{response.status}" end rescue tries ||= 0 (tries += 1) < 10 ? retry : raise end private def body_to_value(body) doc = MultiJson.load(body) case doc[@type_field] when 'Hash' doc = doc.dup doc.delete('_id') doc.delete('_rev') doc.delete(@type_field) doc else doc[@value_field] end end def value_to_body(value, rev) case value when Hash doc = value.merge(@type_field => 'Hash') when String doc = { @value_field => value, @type_field => 'String' } when Float, Fixnum doc = { @value_field => value, @type_field => 'Number' } else raise ArgumentError, "Invalid value type: #{value.class}" end doc['_rev'] = rev if rev MultiJson.dump(doc) end def create_db response = @backend.put '', '' raise "HTTP error #{response.status}" unless response.status == 201 || response.status == 412 end end end end ruby-moneta-0.7.20/lib/moneta/adapters/datamapper.rb000066400000000000000000000045671232153565500223640ustar00rootroot00000000000000require 'dm-core' require 'dm-migrations' module Moneta module Adapters # Datamapper backend # @api public class DataMapper include Defaults supports :create class Store include ::DataMapper::Resource property :k, String, :key => true, :length => 255 property :v, Text, :lazy => false self.raise_on_save_failure = true end # @param [Hash] options # @option options [String] :setup Datamapper setup string # @option options [String/Symbol] :repository (:moneta) Repository name # @option options [String/Symbol] :table (:moneta) Table name def initialize(options = {}) raise ArgumentError, 'Option :setup is required' unless options[:setup] @repository = (options.delete(:repository) || :moneta).to_sym Store.storage_names[@repository] = (options.delete(:table) || :moneta).to_s ::DataMapper.setup(@repository, options[:setup]) context { Store.auto_upgrade! } end # (see Proxy#key?) def key?(key, options = {}) context { Store.get(key) != nil } end # (see Proxy#load) def load(key, options = {}) context do record = Store.get(key) record && record.v end end # (see Proxy#store) def store(key, value, options = {}) context do if record = Store.get(key) record.update(:k => key, :v => value) else Store.create(:k => key, :v => value) end value end rescue tries ||= 0 (tries += 1) < 10 ? retry : raise end # (see Proxy#create) def create(key, value, options = {}) context do Store.create(:k => key, :v => value) true end rescue # FIXME: This catches too many errors # it should only catch a not-unique-exception false end # (see Proxy#delete) def delete(key, options = {}) context do if record = Store.get(key) value = record.v record.destroy! value end end end # (see Proxy#clear) def clear(options = {}) context { Store.all.destroy! } self end private def context ::DataMapper.repository(@repository) { yield } end end end end ruby-moneta-0.7.20/lib/moneta/adapters/daybreak.rb000066400000000000000000000022541232153565500220170ustar00rootroot00000000000000require 'daybreak' module Moneta module Adapters # Daybreak backend # @api public class Daybreak < Memory # @param [Hash] options # @option options [String] :file Database file # @option options [::Daybreak] :backend Use existing backend instance def initialize(options = {}) @backend = options[:backend] || begin raise ArgumentError, 'Option :file is required' unless options[:file] ::Daybreak::DB.new(options[:file], :serializer => ::Daybreak::Serializer::None) end end # (see Proxy#load) def load(key, options = {}) @backend.load if options[:sync] @backend[key] end # (see Proxy#store) def store(key, value, options = {}) @backend[key] = value @backend.flush if options[:sync] value end # (see Proxy#increment) def increment(key, amount = 1, options = {}) @backend.lock { super } end # (see Proxy#create) def create(key, value, options = {}) @backend.lock { super } end # (see Proxy#close) def close @backend.close end end end end ruby-moneta-0.7.20/lib/moneta/adapters/dbm.rb000066400000000000000000000011471232153565500207770ustar00rootroot00000000000000require 'dbm' module Moneta module Adapters # DBM backend (Berkeley DB) # @api public class DBM < Memory # @param [Hash] options # @option options [String] :file Database file # @option options [::DBM] :backend Use existing backend instance def initialize(options = {}) @backend = options[:backend] || begin raise ArgumentError, 'Option :file is required' unless options[:file] ::DBM.new(options[:file]) end end # (see Proxy#close) def close @backend.close nil end end end end ruby-moneta-0.7.20/lib/moneta/adapters/file.rb000066400000000000000000000062311232153565500211530ustar00rootroot00000000000000require 'fileutils' module Moneta module Adapters # Filesystem backend # @api public class File include Defaults supports :create, :increment # @param [Hash] options # @option options [String] :dir Directory where files will be stored def initialize(options = {}) raise ArgumentError, 'Option :dir is required' unless @dir = options[:dir] FileUtils.mkpath(@dir) raise "#{@dir} is not a directory" unless ::File.directory?(@dir) end # (see Proxy#key?) def key?(key, options = {}) ::File.exist?(store_path(key)) end # (see Proxy#load) def load(key, options = {}) ::File.read(store_path(key)) rescue Errno::ENOENT end # (see Proxy#store) def store(key, value, options = {}) temp_file = ::File.join(@dir, "value-#{$$}-#{Thread.current.object_id}") path = store_path(key) FileUtils.mkpath(::File.dirname(path)) ::File.open(temp_file, 'wb') {|f| f.write(value) } ::File.rename(temp_file, path) value rescue Exception File.unlink(temp_file) rescue nil raise end # (see Proxy#delete) def delete(key, options = {}) value = load(key, options) ::File.unlink(store_path(key)) value rescue Errno::ENOENT end # (see Proxy#clear) def clear(options = {}) temp_dir = "#{@dir}-#{$$}-#{Thread.current.object_id}" ::File.rename(@dir, temp_dir) FileUtils.mkpath(@dir) self rescue Errno::ENOENT self ensure FileUtils.rm_rf(temp_dir) end # (see Proxy#increment) def increment(key, amount = 1, options = {}) path = store_path(key) FileUtils.mkpath(::File.dirname(path)) ::File.open(path, ::File::RDWR | ::File::CREAT) do |f| Thread.pass until f.flock(::File::LOCK_EX) content = f.read amount += Utils.to_int(content) unless content.empty? content = amount.to_s f.pos = 0 f.write(content) f.truncate(content.bytesize) amount end end # HACK: The implementation using File::EXCL is not atomic under JRuby 1.7.4 # See https://github.com/jruby/jruby/issues/827 if defined?(JRUBY_VERSION) # (see Proxy#create) def create(key, value, options = {}) path = store_path(key) FileUtils.mkpath(::File.dirname(path)) # Call native java.io.File#createNewFile return false unless ::Java::JavaIo::File.new(path).createNewFile ::File.open(path, 'wb+') {|f| f.write(value) } true end else # (see Proxy#create) def create(key, value, options = {}) path = store_path(key) FileUtils.mkpath(::File.dirname(path)) ::File.open(path, ::File::WRONLY | ::File::CREAT | ::File::EXCL) do |f| f.binmode f.write(value) end true rescue Errno::EEXIST false end end protected def store_path(key) ::File.join(@dir, key) end end end end ruby-moneta-0.7.20/lib/moneta/adapters/fog.rb000066400000000000000000000030551232153565500210100ustar00rootroot00000000000000require 'fog/storage' module Moneta module Adapters # Fog backend (Cloud storage services) # @api public class Fog include Defaults attr_reader :backend # @param [Hash] options # @option options [String] :dir Fog directory # @option options [::Fog::Storage] :backend Use existing backend instance # @option options Other options passed to `Fog::Storage#new` def initialize(options = {}) raise ArgumentError, 'Option :dir is required' unless dir = options.delete(:dir) @backend = options[:backend] || ::Fog::Storage.new(options) @directory = @backend.directories.get(dir) || @backend.directories.create(:key => dir) end # (see Proxy#key?) def key?(key, options = {}) @directory.files.head(key) != nil end # (see Proxy#load) def load(key, options = {}) value = @directory.files.get(key) value && value.body end # (see Proxy#delete) def delete(key, options = {}) if value = @directory.files.get(key) body = value.body value.destroy body end end # (see Proxy#store) def store(key, value, options = {}) value = value.dup if value.frozen? # HACK: Fog needs unfrozen string @directory.files.create(options.merge(:key => key, :body => value)) value end # (see Proxy#clear) def clear(options = {}) @directory.files.all.each do |file| file.destroy end self end end end end ruby-moneta-0.7.20/lib/moneta/adapters/gdbm.rb000066400000000000000000000011361232153565500211440ustar00rootroot00000000000000require 'gdbm' module Moneta module Adapters # GDBM backend # @api public class GDBM < Memory # @param [Hash] options # @option options [String] :file Database file # @option options [::GDBM] :backend Use existing backend instance def initialize(options = {}) @backend = options[:backend] || begin raise ArgumentError, 'Option :file is required' unless options[:file] ::GDBM.new(options[:file]) end end # (see Proxy#close) def close @backend.close nil end end end end ruby-moneta-0.7.20/lib/moneta/adapters/hbase.rb000066400000000000000000000060751232153565500213240ustar00rootroot00000000000000require 'hbaserb' module Moneta module Adapters # HBase thrift backend # @api public class HBase include Defaults attr_reader :backend # TODO: Add create support using checkAndPut if added to thrift api # https://issues.apache.org/jira/browse/HBASE-3307 # https://github.com/bmuller/hbaserb/issues/2 supports :increment # @param [Hash] options # @option options [String] :host ('127.0.0.1') Server host name # @option options [Integer] :port (9090) Server port # @option options [String] :table ('moneta') Table name # @option options [String] :column_family ('moneta') Column family # @option options [String] :column ('value') Column # @option options [::HBaseRb::Client] :backend Use existing backend instance def initialize(options = {}) options[:column] ||= 'value' options[:table] ||= 'moneta' cf = (options[:column_family] || 'moneta') @column = "#{cf}:#{options[:column]}" @backend = options[:backend] || HBaseRb::Client.new(options[:host] || '127.0.0.1', options[:port] || '9090') @backend.create_table(options[:table], cf) unless @backend.has_table?(options[:table]) @table = @backend.get_table(options[:table]) end # (see Proxy#key?) def key?(key, options = {}) @table.get(key, @column).first != nil end # (see Proxy#load) def load(key, options = {}) cell = @table.get(key, @column).first cell && unpack(cell.value) end # (see Proxy#store) def store(key, value, options = {}) @table.mutate_row(key, @column => pack(value)) value end # (see Proxy#increment) def increment(key, amount = 1, options = {}) result = @table.atomic_increment(key, @column, amount) # HACK: Throw error if applied to invalid value Utils.to_int(load(key)) if result == 0 result end # (see Proxy#delete) def delete(key, options = {}) if value = load(key, options) @table.delete_row(key) value end end # (see Proxy#clear) def clear(options = {}) @table.create_scanner do |row| @table.delete_row(row.row) end self end # (see Proxy#close) def close @backend.close nil end private def pack(value) intvalue = value.to_i if intvalue >= 0 && intvalue <= 0xFFFFFFFFFFFFFFFF && intvalue.to_s == value # Pack as 8 byte big endian [intvalue].pack('Q>') elsif value.bytesize >= 8 # Add nul character to make value distinguishable from integer value + "\0" else value end end def unpack(value) if value.bytesize == 8 # Unpack 8 byte big endian value.unpack('Q>').first.to_s elsif value.bytesize >= 9 && value[-1] == ?\0 # Remove nul character value[0..-2] else value end end end end end ruby-moneta-0.7.20/lib/moneta/adapters/kyotocabinet.rb000066400000000000000000000022301232153565500227220ustar00rootroot00000000000000require 'kyotocabinet' module Moneta module Adapters # KyotoCabinet backend # @api public class KyotoCabinet < Memory # @param [Hash] options # @option options [String] :file Database file # @option options [::KyotoCabinet::DB] :backend Use existing backend instance def initialize(options = {}) if options[:backend] @backend = options[:backend] else raise ArgumentError, 'Option :file is required' unless options[:file] @backend = ::KyotoCabinet::DB.new raise @backend.error.to_s unless @backend.open(options[:file], ::KyotoCabinet::DB::OWRITER | ::KyotoCabinet::DB::OCREATE) end end # (see Proxy#key?) def key?(key, options = {}) @backend.check(key) >= 0 end # (see Proxy#delete) def delete(key, options = {}) @backend.seize(key) end # (see Proxy#create) def create(key, value, options = {}) @backend.add(key, value) end # (see Proxy#close) def close @backend.close nil end end end end ruby-moneta-0.7.20/lib/moneta/adapters/leveldb.rb000066400000000000000000000016411232153565500216510ustar00rootroot00000000000000require 'leveldb' module Moneta module Adapters # LevelDB backend # @api public class LevelDB < Memory # @param [Hash] options # @option options [String] :dir - Database path # @option options All other options passed to `LevelDB::DB#new` # @option options [::LevelDB::DB] :backend Use existing backend instance def initialize(options = {}) @backend = options[:backend] || begin raise ArgumentError, 'Option :dir is required' unless options[:dir] ::LevelDB::DB.new(options[:dir]) end end # (see Proxy#key?) def key?(key, options = {}) @backend.includes?(key) end # (see Proxy#clear) def clear(options = {}) @backend.each {|k,v| delete(k, options) } self end # (see Proxy#close) def close @backend.close nil end end end end ruby-moneta-0.7.20/lib/moneta/adapters/lmdb.rb000066400000000000000000000042651232153565500211570ustar00rootroot00000000000000require 'lmdb' require 'fileutils' module Moneta module Adapters # LMDB backend # @api public class LMDB include Defaults supports :create, :increment attr_reader :backend, :db PUT_FLAGS = [:nooverwrite, :nodupdata, :current, :append, :appenddup] # @param [Hash] options # @option options [String] :dir Environment directory # @option options [::LMDB::Environment] :backend Use existing backend instance # @option options [String or nil] :db Database name def initialize(options) db = options.delete(:db) @backend = options.delete(:backend) || begin raise ArgumentError, 'Option :dir is required' unless dir = options.delete(:dir) FileUtils.mkpath(dir) ::LMDB.new(dir, options) end @db = @backend.database(db, :create => true) end # (see Proxy#key?) def key?(key, options = {}) !@db.get(key).nil? end # (see Proxy#load) def load(key, options = {}) @db.get(key) end # (see Proxy#store) def store(key, value, options = {}) @db.put(key, value, Utils.only(options, *PUT_FLAGS)) value end # (see Proxy#delete) def delete(key, options = {}) @backend.transaction do if value = @db.get(key) @db.delete(key) value end end end # (see Proxy#clear) def clear(options = {}) @db.clear self end # (see Proxy#increment) def increment(key, amount = 1, options = {}) @backend.transaction do value = @db.get(key) value = Utils.to_int(value) + amount @db.put(key, value.to_s, Utils.only(options, *PUT_FLAGS)) value end end # (see Defaults#create) def create(key, value, options = {}) @backend.transaction do if @db.get(key) false else @db.put(key, value, Utils.only(options, *PUT_FLAGS)) true end end end # (see Proxy#close) def close @backend.close nil end end end end ruby-moneta-0.7.20/lib/moneta/adapters/localmemcache.rb000066400000000000000000000014011232153565500230030ustar00rootroot00000000000000require 'localmemcache' module Moneta module Adapters # LocalMemCache backend # @api public class LocalMemCache include Defaults include HashAdapter # @param [Hash] options # @option options [String] :file Database file # @option options [::LocalMemCache] :backend Use existing backend instance def initialize(options = {}) @backend = options[:backend] || begin raise ArgumentError, 'Option :file is required' unless options[:file] ::LocalMemCache.new(:filename => options[:file]) end end # (see Proxy#delete) def delete(key, options = {}) value = load(key, options) @backend.delete(key) value end end end end ruby-moneta-0.7.20/lib/moneta/adapters/lruhash.rb000066400000000000000000000046671232153565500217150ustar00rootroot00000000000000module Moneta module Adapters # LRUHash backend # # Based on Hashery::LRUHash but simpler and measures both memory usage and hash size. # # @api public class LRUHash include Defaults include IncrementSupport include CreateSupport # @param [Hash] options # @option options [Integer] :max_size (1024000) Maximum byte size of all values # @option options [Integer] :max_value (options[:max_size]) Maximum byte size of one value # @option options [Integer] :max_count (10240) Maximum number of values def initialize(options = {}) @max_size = options[:max_size] || 1024000 @max_count = options[:max_count] || 10240 @max_value = options[:max_value] || @max_size clear end # (see Proxy#key?) def key?(key, options = {}) @entry.key?(key) end # (see Proxy#load) def load(key, options = {}) if entry = @entry[key] entry.insert_after(@list) entry.value end end # (see Proxy#store) def store(key, value, options = {}) if value.bytesize > @max_value delete(key) else if entry = @entry[key] @size -= entry.value.bytesize else @entry[key] = entry = Entry.new entry.key = key end entry.value = value @size += entry.value.bytesize entry.insert_after(@list) delete(@list.prev.key) while @list.next != @list.prev && (@size > @max_size || @entry.size > @max_count) end value end # (see Proxy#delete) def delete(key, options = {}) if entry = @entry.delete(key) @size -= entry.value.bytesize entry.unlink entry.value end end # (see Proxy#clear) def clear(options = {}) @entry, @size = {}, 0 @list = Entry.new @list.prev = @list.next = @list self end private class Entry attr_accessor :key, :value, :prev, :next def unlink @prev.next = @next if @prev @next.prev = @prev if @next @prev = @next = nil end def insert_after(entry) if entry.next != self unlink @next = entry.next @prev = entry entry.next.prev = self entry.next = self end end end end end end ruby-moneta-0.7.20/lib/moneta/adapters/memcached.rb000066400000000000000000000006011232153565500221350ustar00rootroot00000000000000module Moneta module Adapters # Prefer Dalli over native Memcached! # # I measure no performance gain over the Dalli backend # using the Moneta backends. begin require 'moneta/adapters/memcached/dalli' Memcached = MemcachedDalli rescue LoadError require 'moneta/adapters/memcached/native' Memcached = MemcachedNative end end end ruby-moneta-0.7.20/lib/moneta/adapters/memcached/000077500000000000000000000000001232153565500216135ustar00rootroot00000000000000ruby-moneta-0.7.20/lib/moneta/adapters/memcached/dalli.rb000066400000000000000000000047501232153565500232330ustar00rootroot00000000000000require 'dalli' module Moneta module Adapters # Memcached backend (using gem dalli) # @api public class MemcachedDalli include Defaults include ExpiresSupport supports :create, :increment attr_reader :backend # @param [Hash] options # @option options [String] :server ('127.0.0.1:11211') Memcached server # @option options [Integer] :expires Default expiration time # @option options [::Dalli::Client] :backend Use existing backend instance # @option options Other options passed to `Dalli::Client#new` def initialize(options = {}) self.default_expires = options.delete(:expires) @backend = options[:backend] || begin server = options.delete(:server) || '127.0.0.1:11211' ::Dalli::Client.new(server, options) end end # (see Proxy#load) def load(key, options = {}) value = @backend.get(key) if value expires = expires_value(options, nil) @backend.set(key, value, expires || nil, :raw => true) if expires != nil value end end # (see Proxy#store) def store(key, value, options = {}) @backend.set(key, value, expires_value(options) || nil, :raw => true) value end # (see Proxy#delete) def delete(key, options = {}) value = @backend.get(key) @backend.delete(key) value end # (see Proxy#increment) def increment(key, amount = 1, options = {}) # FIXME: There is a Dalli bug, load(key) returns a wrong value after increment # therefore we set default = nil and create the counter manually # See https://github.com/mperham/dalli/issues/309 result = if amount >= 0 @backend.incr(key, amount, expires_value(options) || nil, nil) else @backend.decr(key, -amount, expires_value(options) || nil, nil) end if result result elsif create(key, amount.to_s, options) amount else increment(key, amount, options) end end # (see Proxy#clear) def clear(options = {}) @backend.flush_all self end # (see Defaults#create) def create(key, value, options = {}) @backend.add(key, value, expires_value(options) || nil, :raw => true) end # (see Proxy#close) def close @backend.close nil end end end end ruby-moneta-0.7.20/lib/moneta/adapters/memcached/native.rb000066400000000000000000000054131232153565500234310ustar00rootroot00000000000000require 'memcached' module Moneta module Adapters # Memcached backend (using gem memcached) # @api public class MemcachedNative include Defaults include ExpiresSupport supports :create, :increment attr_reader :backend # @param [Hash] options # @option options [String] :server ('127.0.0.1:11211') Memcached server # @option options [String] :namespace Key namespace # @option options [Integer] :expires (604800) Default expiration time # @option options [::Memcached] :backend Use existing backend instance # @option options Other options passed to `Memcached#new` def initialize(options = {}) server = options.delete(:server) || '127.0.0.1:11211' self.default_expires = options.delete(:expires) @backend = options[:backend] || begin options.merge!(:prefix_key => options.delete(:namespace)) if options[:namespace] # We don't want a limitation on the key charset. Therefore we use the binary protocol. # It is also faster. options[:binary_protocol] = true unless options.include?(:binary_protocol) ::Memcached.new(server, options) end end # (see Proxy#load) def load(key, options = {}) value = @backend.get(key, false) if value expires = expires_value(options, nil) @backend.set(key, value, expires || 0, false) if expires != nil value end rescue ::Memcached::NotFound end # (see Proxy#store) def store(key, value, options = {}) # TTL must be Fixnum @backend.set(key, value, expires_value(options) || 0, false) value end # (see Proxy#delete) def delete(key, options = {}) value = @backend.get(key, false) @backend.delete(key) value rescue ::Memcached::NotFound end # (see Proxy#increment) def increment(key, amount = 1, options = {}) result = if amount >= 0 @backend.increment(key, amount) else @backend.decrement(key, -amount) end # HACK: Throw error if applied to invalid value # see https://github.com/evan/memcached/issues/110 Utils.to_int((@backend.get(key, false) rescue nil)) if result == 0 result rescue ::Memcached::NotFound => ex retry unless create(key, amount.to_s, options) amount end # (see Defaults#create) def create(key, value, options = {}) @backend.add(key, value, expires_value(options) || 0, false) true rescue ::Memcached::ConnectionDataExists false end # (see Proxy#clear) def clear(options = {}) @backend.flush self end end end end ruby-moneta-0.7.20/lib/moneta/adapters/memory.rb000066400000000000000000000007021232153565500215410ustar00rootroot00000000000000module Moneta module Adapters # Memory backend using a hash to store the entries # @api public class Memory include Defaults include HashAdapter include IncrementSupport include CreateSupport # @param [Hash] options Options hash # @option options [Hash] :backend Use existing backend instance def initialize(options = {}) @backend = options[:backend] || {} end end end end ruby-moneta-0.7.20/lib/moneta/adapters/mongo.rb000066400000000000000000000137461232153565500213640ustar00rootroot00000000000000require 'mongo' module Moneta module Adapters # MongoDB backend # # Supports expiration, documents will be automatically removed starting # with mongodb >= 2.2 (see {http://docs.mongodb.org/manual/tutorial/expire-data/}). # # You can store hashes directly using this adapter. # # @example Store hashes # db = Moneta::Adapters::Mongo.new # db['key'] = {a: 1, b: 2} # # @api public class Mongo include Defaults include ExpiresSupport supports :create, :increment attr_reader :backend # @param [Hash] options # @option options [String] :collection ('moneta') MongoDB collection name # @option options [String] :host ('127.0.0.1') MongoDB server host # @option options [String] :user Username used to authenticate # @option options [String] :password Password used to authenticate # @option options [Integer] :port (MongoDB default port) MongoDB server port # @option options [String] :db ('moneta') MongoDB database # @option options [Integer] :expires Default expiration time # @option options [String] :expires_field ('expiresAt') Document field to store expiration time # @option options [String] :value_field ('value') Document field to store value # @option options [String] :type_field ('type') Document field to store value type # @option options [::Mongo::MongoClient] :backend Use existing backend instance # @option options Other options passed to `Mongo::MongoClient#new` def initialize(options = {}) self.default_expires = options.delete(:expires) collection = options.delete(:collection) || 'moneta' db = options.delete(:db) || 'moneta' @expires_field = options.delete(:expires_field) || 'expiresAt' @value_field = options.delete(:value_field) || 'value' @type_field = options.delete(:type_field) || 'type' @backend = options[:backend] || begin host = options.delete(:host) || '127.0.0.1' port = options.delete(:port) || ::Mongo::MongoClient::DEFAULT_PORT user = options.delete(:user) password = options.delete(:password) ::Mongo::MongoClient.new(host, port, options) end db = @backend.db(db) db.authenticate(user, password, true) if user && password @collection = db.collection(collection) if @backend.server_version >= '2.2' @collection.ensure_index([[@expires_field, ::Mongo::ASCENDING]], :expireAfterSeconds => 0) else warn 'Moneta::Adapters::Mongo - You are using MongoDB version < 2.2, expired documents will not be deleted' end end # (see Proxy#load) def load(key, options = {}) key = to_binary(key) doc = @collection.find_one('_id' => key) if doc && (!doc[@expires_field] || doc[@expires_field] >= Time.now) expires = expires_at(options, nil) @collection.update({ '_id' => key }, # @expires_field must be a Time object (BSON date datatype) { '$set' => { @expires_field => expires || nil } }) if expires != nil doc_to_value(doc) end end # (see Proxy#store) def store(key, value, options = {}) key = to_binary(key) @collection.update({ '_id' => key }, value_to_doc(key, value, options), { :upsert => true }) value end # (see Proxy#delete) def delete(key, options = {}) value = load(key, options) @collection.remove('_id' => to_binary(key)) if value value end # (see Proxy#increment) def increment(key, amount = 1, options = {}) @collection.find_and_modify(:query => { '_id' => to_binary(key) }, :update => { '$inc' => { @value_field => amount } }, :new => true, :upsert => true)[@value_field] end # (see Proxy#create) def create(key, value, options = {}) key = to_binary(key) @collection.insert(value_to_doc(key, value, options)) true rescue ::Mongo::OperationFailure => ex raise if ex.error_code != 11000 # duplicate key error false end # (see Proxy#clear) def clear(options = {}) @collection.remove self end # (see Proxy#close) def close @backend.close nil end protected def doc_to_value(doc) case doc[@type_field] when 'Hash' doc = doc.dup doc.delete('_id') doc.delete(@type_field) doc.delete(@expires_field) doc when 'Number' doc[@value_field] else doc[@value_field].to_s end end def value_to_doc(key, value, options) case value when Hash value.merge('_id' => key, @type_field => 'Hash', # @expires_field must be a Time object (BSON date datatype) @expires_field => expires_at(options) || nil) when Float, Fixnum { '_id' => key, @type_field => 'Number', @value_field => value, # @expires_field must be a Time object (BSON date datatype) @expires_field => expires_at(options) || nil } when String intvalue = value.to_i { '_id' => key, @type_field => 'String', @value_field => intvalue.to_s == value ? intvalue : to_binary(value), # @expires_field must be a Time object (BSON date datatype) @expires_field => expires_at(options) || nil } else raise ArgumentError, "Invalid value type: #{value.class}" end end def to_binary(s) s = s.dup if s.frozen? # HACK: BSON::Binary needs unfrozen string ::BSON::Binary.new(s) end end end end ruby-moneta-0.7.20/lib/moneta/adapters/null.rb000066400000000000000000000012341232153565500212040ustar00rootroot00000000000000module Moneta module Adapters # Null backend which doesn't store anything # @api public class Null include Defaults # @param [Hash] options Options hash def initialize(options = {}) end # (see Proxy#key?) def key?(key, options = {}) false end # (see Proxy#load) def load(key, options = {}) nil end # (see Proxy#store) def store(key, value, options = {}) value end # (see Proxy#delete) def delete(key, options = {}) nil end # (see Proxy#clear) def clear(options = {}) self end end end end ruby-moneta-0.7.20/lib/moneta/adapters/pstore.rb000066400000000000000000000041011232153565500215420ustar00rootroot00000000000000require 'pstore' require 'fileutils' module Moneta module Adapters # PStore backend # @api public class PStore include Defaults supports :create, :increment attr_reader :backend # @param [Hash] options # @option options [String] :file PStore file # @option options [::PStore] :backend Use existing backend instance def initialize(options = {}) @backend = options[:backend] || begin raise ArgumentError, 'Option :file is required' unless options[:file] FileUtils.mkpath(::File.dirname(options[:file])) new_store(options) end end # (see Proxy#key?) def key?(key, options = {}) @backend.transaction(true) { @backend.root?(key) } end # (see Proxy#load) def load(key, options = {}) @backend.transaction(true) { @backend[key] } end # (see Proxy#store) def store(key, value, options = {}) @backend.transaction { @backend[key] = value } end # (see Proxy#delete) def delete(key, options = {}) @backend.transaction { @backend.delete(key) } end # (see Proxy#increment) def increment(key, amount = 1, options = {}) @backend.transaction do value = Utils.to_int(@backend[key]) + amount @backend[key] = value.to_s value end end # (see Proxy#create) def create(key, value, options = {}) @backend.transaction do if @backend.root?(key) false else @backend[key] = value true end end end # (see Proxy#clear) def clear(options = {}) @backend.transaction do @backend.roots.each do |key| @backend.delete(key) end end self end protected def new_store(options) if RUBY_VERSION > '1.9' ::PStore.new(options[:file], options[:threadsafe]) else ::PStore.new(options[:file]) end end end end end ruby-moneta-0.7.20/lib/moneta/adapters/redis.rb000066400000000000000000000045421232153565500213450ustar00rootroot00000000000000require 'redis' module Moneta module Adapters # Redis backend # @api public class Redis include Defaults include ExpiresSupport supports :create, :increment attr_reader :backend # @param [Hash] options # @option options [Integer] :expires Default expiration time # @option options [::Redis] :backend Use existing backend instance # @option options Other options passed to `Redis#new` def initialize(options = {}) self.default_expires = options.delete(:expires) @backend = options[:backend] || ::Redis.new(options) end # (see Proxy#key?) # # This method considers false and 0 as "no-expire" and every positive # number as a time to live in seconds. def key?(key, options = {}) if @backend.exists(key) update_expires(key, options, nil) true else false end end # (see Proxy#load) def load(key, options = {}) value = @backend.get(key) update_expires(key, options, nil) value end # (see Proxy#store) def store(key, value, options = {}) if expires = expires_value(options) @backend.setex(key, expires, value) else @backend.set(key, value) end value end # (see Proxy#delete) def delete(key, options = {}) if value = load(key, options) @backend.del(key) value end end # (see Proxy#increment) def increment(key, amount = 1, options = {}) value = @backend.incrby(key, amount) update_expires(key, options) value end # (see Proxy#clear) def clear(options = {}) @backend.flushdb self end # (see Defaults#create) def create(key, value, options = {}) if @backend.setnx(key, value) update_expires(key, options) true else false end end # (see Proxy#close) def close @backend.quit nil end protected def update_expires(key, options, default = @default_expires) case expires = expires_value(options, default) when false @backend.persist(key) when Numeric @backend.expire(key, expires) end end end end end ruby-moneta-0.7.20/lib/moneta/adapters/restclient.rb000066400000000000000000000025031232153565500224060ustar00rootroot00000000000000require 'faraday' module Moneta module Adapters # Moneta rest client backend which works together with {Rack::MonetaRest} # @api public class RestClient include Defaults attr_reader :backend # @param [Hash] options # @option options [String] :url URL # @option options [Faraday connection] :backend Use existing backend instance def initialize(options = {}) raise ArgumentError, 'Option :url is required' unless url = options[:url] @backend = options[:backend] || ::Faraday.new(:url => url) end # (see Proxy#key?) def key?(key, options = {}) @backend.head(key).status == 200 end # (see Proxy#load) def load(key, options = {}) response = @backend.get(key) response.status == 200 ? response.body : nil end # (see Proxy#store) def store(key, value, options = {}) response = @backend.post(key, value) raise "HTTP error #{response.status}" unless response.status == 200 value end # (see Proxy#delete) def delete(key, options = {}) response = @backend.delete(key) response.status == 200 ? response.body : nil end # (see Proxy#clear) def clear(options = {}) @backend.delete '' self end end end end ruby-moneta-0.7.20/lib/moneta/adapters/riak.rb000066400000000000000000000033031232153565500211570ustar00rootroot00000000000000require 'riak' module Moneta module Adapters # Riak backend # @api public # @author Potapov Sergey (aka Blake) class Riak include Defaults attr_reader :backend # @param [Hash] options # @option options [String] :bucket ('moneta') Bucket name # @option options [String] :content_type ('application/octet-stream') Default content type # @option options All other options passed to `Riak::Client#new` # @option options [::Riak::Client] :backend Use existing backend instance def initialize(options = {}) bucket = options.delete(:bucket) || 'moneta' @content_type = options.delete(:content_type) || 'application/octet-stream' @backend = options[:backend] || ::Riak::Client.new(options) @bucket = @backend.bucket(bucket) end # (see Proxy#key?) def key?(key, options = {}) @bucket.exists?(key, options.dup) end # (see Proxy#load) def load(key, options = {}) @bucket.get(key, options.dup).raw_data rescue ::Riak::FailedRequest => ex nil end # (see Proxy#delete) def delete(key, options = {}) value = load(key, options) @bucket.delete(key, options.dup) value end # (see Proxy#store) def store(key, value, options = {}) obj = ::Riak::RObject.new(@bucket, key) obj.content_type = options[:content_type] || @content_type obj.raw_data = value obj.store(options.dup) value end # (see Proxy#clear) def clear(options = {}) @bucket.keys do |keys| keys.each{ |key| @bucket.delete(key) } end self end end end end ruby-moneta-0.7.20/lib/moneta/adapters/sdbm.rb000066400000000000000000000011361232153565500211600ustar00rootroot00000000000000require 'sdbm' module Moneta module Adapters # SDBM backend # @api public class SDBM < Memory # @param [Hash] options # @option options [String] :file Database file # @option options [::SDBM] :backend Use existing backend instance def initialize(options = {}) @backend = options[:backend] || begin raise ArgumentError, 'Option :file is required' unless options[:file] ::SDBM.new(options[:file]) end end # (see Proxy#close) def close @backend.close nil end end end end ruby-moneta-0.7.20/lib/moneta/adapters/sequel.rb000066400000000000000000000062541232153565500215370ustar00rootroot00000000000000require 'sequel' module Moneta module Adapters # Sequel backend # @api public class Sequel include Defaults # Sequel::UniqueConstraintViolation is defined since sequel 3.44.0 # older versions raise a Sequel::DatabaseError. UniqueConstraintViolation = defined?(::Sequel::UniqueConstraintViolation) ? ::Sequel::UniqueConstraintViolation : ::Sequel::DatabaseError supports :create, :increment attr_reader :backend # @param [Hash] options # @option options [String] :db Sequel database # @option options [String/Symbol] :table (:moneta) Table name # @option options All other options passed to `Sequel#connect` # @option options [Sequel connection] :backend Use existing backend instance def initialize(options = {}) table = (options.delete(:table) || :moneta).to_sym @backend = options[:backend] || begin raise ArgumentError, 'Option :db is required' unless db = options.delete(:db) ::Sequel.connect(db, options) end @backend.create_table?(table) do String :k, :null => false, :primary_key => true Blob :v end @table = @backend[table] end # (see Proxy#key?) def key?(key, options = {}) @table[:k => key] != nil end # (see Proxy#load) def load(key, options = {}) record = @table[:k => key] record && record[:v] end # (see Proxy#store) def store(key, value, options = {}) begin @table.insert(:k => key, :v => blob(value)) rescue UniqueConstraintViolation @table.where(:k => key).update(:v => blob(value)) end value rescue ::Sequel::DatabaseError tries ||= 0 (tries += 1) < 10 ? retry : raise end # (see Proxy#store) def create(key, value, options = {}) @table.insert(:k => key, :v => blob(value)) true rescue UniqueConstraintViolation false end # (see Proxy#increment) def increment(key, amount = 1, options = {}) @backend.transaction do locked_table = @table.for_update if record = locked_table[:k => key] value = Utils.to_int(record[:v]) + amount locked_table.where(:k => key).update(:v => blob(value.to_s)) value else locked_table.insert(:k => key, :v => blob(amount.to_s)) amount end end rescue ::Sequel::DatabaseError # Concurrent modification might throw a bunch of different errors tries ||= 0 (tries += 1) < 10 ? retry : raise end # (see Proxy#delete) def delete(key, options = {}) if value = load(key, options) @table.filter(:k => key).delete value end end # (see Proxy#clear) def clear(options = {}) @table.delete self end # (see Proxy#close) def close @backend.disconnect nil end private # See https://github.com/jeremyevans/sequel/issues/715 def blob(s) s.empty? ? '' : ::Sequel.blob(s) end end end end ruby-moneta-0.7.20/lib/moneta/adapters/sqlite.rb000066400000000000000000000052711232153565500215400ustar00rootroot00000000000000require 'sqlite3' module Moneta module Adapters # Sqlite3 backend # @api public class Sqlite include Defaults include IncrementSupport supports :create attr_reader :backend # @param [Hash] options # @option options [String] :file Database file # @option options [String] :table ('moneta') Table name # @option options [Fixnum] :busy_timeout (1000) Sqlite timeout if database is busy # @option options [::Sqlite3::Database] :backend Use existing backend instance def initialize(options = {}) table = options[:table] || 'moneta' @backend = options[:backend] || begin raise ArgumentError, 'Option :file is required' unless options[:file] ::SQLite3::Database.new(options[:file]) end @backend.busy_timeout(options[:busy_timeout] || 1000) @backend.execute("create table if not exists #{table} (k blob not null primary key, v blob)") @stmts = [@exists = @backend.prepare("select exists(select 1 from #{table} where k = ?)"), @select = @backend.prepare("select v from #{table} where k = ?"), @replace = @backend.prepare("replace into #{table} values (?, ?)"), @delete = @backend.prepare("delete from #{table} where k = ?"), @clear = @backend.prepare("delete from #{table}"), @create = @backend.prepare("insert into #{table} values (?, ?)")] end # (see Proxy#key?) def key?(key, options = {}) @exists.execute!(key).first.first.to_i == 1 end # (see Proxy#load) def load(key, options = {}) rows = @select.execute!(key) rows.empty? ? nil : rows.first.first end # (see Proxy#store) def store(key, value, options = {}) @replace.execute!(key, value) value end # (see Proxy#delete) def delete(key, options = {}) value = load(key, options) @delete.execute!(key) value end # (see Proxy#increment) def increment(key, amount = 1, options = {}) @backend.transaction(:exclusive) { return super } end # (see Proxy#clear) def clear(options = {}) @clear.execute! self end # (see Default#create) def create(key, value, options = {}) @create.execute!(key,value) true rescue SQLite3::ConstraintException # If you know a better way to detect whether an insert-ignore # suceeded, please tell me. @create.reset! false end # (see Proxy#close) def close @stmts.each {|s| s.close } @backend.close nil end end end end ruby-moneta-0.7.20/lib/moneta/adapters/tdb.rb000066400000000000000000000011411232153565500210000ustar00rootroot00000000000000require 'tdb' module Moneta module Adapters # TDB backend # @api public class TDB < Memory # @param [Hash] options # @option options [String] :file Database file # @option options [::TDB] :backend Use existing backend instance def initialize(options) @backend = options[:backend] || begin raise ArgumentError, 'Option :file is required' unless file = options.delete(:file) ::TDB.new(file, options) end end # (see Proxy#close) def close @backend.close nil end end end end ruby-moneta-0.7.20/lib/moneta/adapters/tokyocabinet.rb000066400000000000000000000026111232153565500227250ustar00rootroot00000000000000require 'tokyocabinet' module Moneta module Adapters # TokyoCabinet backend # @api public class TokyoCabinet < Memory # @param [Hash] options # @option options [String] :file Database file # @option options [Symbol] :type (:hdb) Database type (:bdb and :hdb possible) # @option options [::TokyoCabinet::*DB] :backend Use existing backend instance def initialize(options = {}) if options[:backend] @backend = options[:backend] else raise ArgumentError, 'Option :file is required' unless options[:file] if options[:type] == :bdb @backend = ::TokyoCabinet::BDB.new @backend.open(options[:file], ::TokyoCabinet::BDB::OWRITER | ::TokyoCabinet::BDB::OCREAT) else @backend = ::TokyoCabinet::HDB.new @backend.open(options[:file], ::TokyoCabinet::HDB::OWRITER | ::TokyoCabinet::HDB::OCREAT) end or raise @backend.errmsg(@backend.ecode) end end # (see Proxy#delete) def delete(key, options = {}) value = load(key, options) if value @backend.delete(key) value end end # (see Proxy#create) def create(key, value, options = {}) @backend.putkeep(key, value) end # (see Proxy#close) def close @backend.close nil end end end end ruby-moneta-0.7.20/lib/moneta/adapters/tokyotyrant.rb000066400000000000000000000060321232153565500226420ustar00rootroot00000000000000begin # Native client require 'tokyo_tyrant' rescue LoadError # Ruby client require 'tokyotyrant' end module Moneta module Adapters # TokyoTyrant backend # @api public class TokyoTyrant include Defaults include HashAdapter supports :create, :increment attr_reader :backend # @param [Hash] options # @option options [String] :host ('127.0.0.1') Server host name # @option options [Integer] :port (1978) Server port # @option options [::TokyoTyrant::RDB] :backend Use existing backend instance def initialize(options = {}) options[:host] ||= '127.0.0.1' options[:port] ||= 1978 if options[:backend] @backend = options[:backend] elsif defined?(::TokyoTyrant::RDB) # Use ruby client @backend = ::TokyoTyrant::RDB.new @backend.open(options[:host], options[:port]) or raise @backend.errmsg(@backend.ecode) else # Use native client @backend = ::TokyoTyrant::DB.new(options[:host], options[:port]) end @native = @backend.class.name != 'TokyoTyrant::RDB' probe = '__tokyotyrant_endianness_probe' @backend.delete(probe) @backend.addint(probe, 1) @pack = @backend.delete(probe) == [1].pack('l>') ? 'l>' : 'l<' end # (see Proxy#load) def load(key, options = {}) value = @backend[key] value && unpack(value) end # (see Proxy#store) def store(key, value, options = {}) @backend[key] = pack(value) value end # (see Proxy#delete) def delete(key, options = {}) value = load(key, options) if value @backend.delete(key) value end end # (see Proxy#increment) def increment(key, amount = 1, options = {}) @backend.addint(key, amount) || raise('Tried to increment non integer value') end # (see Proxy#create) def create(key, value, options = {}) if @native begin # Native client throws an exception @backend.putkeep(key, pack(value)) rescue TokyoTyrantError false end else @backend.putkeep(key, pack(value)) end end # (see Proxy#close) def close @backend.close nil end private def pack(value) intvalue = value.to_i if intvalue >= 0 && intvalue <= 0xFFFFFFFF && intvalue.to_s == value # Pack as 4 byte integer [intvalue].pack(@pack) elsif value.bytesize >= 4 # Add nul character to make value distinguishable from integer value + "\0" else value end end def unpack(value) if value.bytesize == 4 # Unpack 4 byte integer value.unpack(@pack).first.to_s elsif value.bytesize >= 5 && value[-1] == ?\0 # Remove nul character value[0..-2] else value end end end end end ruby-moneta-0.7.20/lib/moneta/adapters/yaml.rb000066400000000000000000000003561232153565500212000ustar00rootroot00000000000000require 'yaml/store' module Moneta module Adapters # YAML::Store backend # @api public class YAML < PStore protected def new_store(options) ::YAML::Store.new(options[:file]) end end end end ruby-moneta-0.7.20/lib/moneta/builder.rb000066400000000000000000000047461232153565500200700ustar00rootroot00000000000000module Moneta # Builder implements the DSL to build a stack of Moneta store proxies # @api private class Builder # @yieldparam Builder dsl code block def initialize(&block) raise ArgumentError, 'No block given' unless block_given? @proxies = [] instance_eval(&block) end # Build proxy stack # # @return [Object] Generated Moneta proxy stack # @api public def build adapter = @proxies.first if Array === adapter klass, options, block = adapter adapter = new_proxy(klass, options, &block) check_arity(klass, adapter, 1) end @proxies[1..-1].inject([adapter]) do |result, proxy| klass, options, block = proxy proxy = new_proxy(klass, result.last, options, &block) check_arity(klass, proxy, 2) result << proxy end end # Add proxy to stack # # @param [Symbol/Class] proxy Name of proxy class or proxy class # @param [Hash] options Options hash # @api public def use(proxy, options = {}, &block) proxy = Moneta.const_get(proxy) if Symbol === proxy raise ArgumentError, 'You must give a Class or a Symbol' unless Class === proxy @proxies.unshift [proxy, options, block] nil end # Add adapter to stack # # @param [Symbol/Class/Moneta store] adapter Name of adapter class, adapter class or Moneta store # @param [Hash] options Options hash # @api public def adapter(adapter, options = {}, &block) case adapter when Symbol use(Adapters.const_get(adapter), options, &block) when Class use(adapter, options, &block) else raise ArgumentError, 'Adapter must be a Moneta store' unless adapter.respond_to?(:load) && adapter.respond_to?(:store) raise ArgumentError, 'No options allowed' unless options.empty? @proxies.unshift adapter nil end end protected def new_proxy(klass, *args, &block) klass.new(*args, &block) rescue ArgumentError => ex check_arity(klass, klass.allocate, args.size) raise end def check_arity(klass, proxy, expected) args = proxy.method(:initialize).arity.abs raise(ArgumentError, %{#{klass.name}#new accepts wrong number of arguments (#{args} accepted, #{expected} expected) Please check your Moneta builder block: * Proxies must be used before the adapter * Only one adapter is allowed * The adapter must be used last }) if args != expected end end end ruby-moneta-0.7.20/lib/moneta/cache.rb000066400000000000000000000054261232153565500175010ustar00rootroot00000000000000module Moneta # Combines two stores. One is used as cache, the other as backend adapter. # # @example Add `Moneta::Cache` to proxy stack # Moneta.build do # use(:Cache) do # adapter { adapter :File, :dir => 'data' } # cache { adapter :Memory } # end # end # # @api public class Cache include Defaults # @api private class DSL def initialize(store, &block) @store = store instance_eval(&block) end # @api public def adapter(store = nil, &block) raise 'Adapter already set' if @store.adapter raise ArgumentError, 'Only argument or block allowed' if store && block @store.adapter = store || Moneta.build(&block) end # @api public def cache(store = nil, &block) raise 'Cache already set' if @store.cache raise ArgumentError, 'Only argument or block allowed' if store && block @store.cache = store || Moneta.build(&block) end end attr_accessor :cache, :adapter # @param [Hash] options Options hash # @option options [Moneta store] :cache Moneta store used as cache # @option options [Moneta store] :adapter Moneta store used as adapter # @yieldparam Builder block def initialize(options = {}, &block) @cache, @adapter = options[:cache], options[:adapter] DSL.new(self, &block) if block_given? end # (see Proxy#key?) def key?(key, options = {}) @cache.key?(key, options) || @adapter.key?(key, options) end # (see Proxy#load) def load(key, options = {}) if options[:sync] || (value = @cache.load(key, options)) == nil value = @adapter.load(key, options) @cache.store(key, value, options) if value != nil end value end # (see Proxy#store) def store(key, value, options = {}) @cache.store(key, value, options) @adapter.store(key, value, options) end # (see Proxy#increment) def increment(key, amount = 1, options = {}) @cache.delete(key, options) @adapter.increment(key, amount, options) end # (see Proxy#create) def create(key, value, options = {}) if @adapter.create(key, value, options) @cache.store(key, value, options) true else false end end # (see Proxy#delete) def delete(key, options = {}) @cache.delete(key, options) @adapter.delete(key, options) end # (see Proxy#clear) def clear(options = {}) @cache.clear(options) @adapter.clear(options) self end # (see Proxy#close) def close @cache.close @adapter.close end # (see Proxy#features) def features @features ||= ((@cache.features + [:create, :increment]) & @adapter.features).freeze end end end ruby-moneta-0.7.20/lib/moneta/expires.rb000066400000000000000000000044511232153565500201120ustar00rootroot00000000000000module Moneta # Adds expiration support to the underlying store # # `#store`, `#load` and `#key?` support the `:expires` option to set/update # the expiration time. # # @api public class Expires < Proxy include ExpiresSupport # @param [Moneta store] adapter The underlying store # @param [Hash] options # @option options [String] :expires Default expiration time def initialize(adapter, options = {}) raise 'Store already supports feature :expires' if adapter.supports?(:expires) super self.default_expires = options[:expires] end # (see Proxy#key?) def key?(key, options = {}) # Transformer might raise exception load_entry(key, options) != nil rescue Exception super(key, Utils.without(options, :expires)) end # (see Proxy#load) def load(key, options = {}) return super if options.include?(:raw) value, expires = load_entry(key, options) value end # (see Proxy#store) def store(key, value, options = {}) return super if options.include?(:raw) expires = expires_at(options) super(key, new_entry(value, expires), Utils.without(options, :expires)) value end # (see Proxy#delete) def delete(key, options = {}) return super if options.include?(:raw) value, expires = super value if !expires || Time.now.to_i <= expires end # (see Proxy#store) def create(key, value, options = {}) return super if options.include?(:raw) expires = expires_at(options) @adapter.create(key, new_entry(value, expires), Utils.without(options, :expires)) end private def load_entry(key, options) new_expires = expires_at(options, nil) options = Utils.without(options, :expires) entry = @adapter.load(key, options) if entry != nil value, expires = entry if expires && Time.now.to_i > expires delete(key) nil elsif new_expires != nil @adapter.store(key, new_entry(value, new_expires), options) entry else entry end end end def new_entry(value, expires) if expires [value, expires.to_i] elsif Array === value || value == nil [value] else value end end end end ruby-moneta-0.7.20/lib/moneta/lock.rb000066400000000000000000000007231232153565500173610ustar00rootroot00000000000000require 'thread' module Moneta # Locks the underlying stores with a Mutex # @api public class Lock < Wrapper # @param [Moneta store] adapter The underlying store # @param [Hash] options # @option options [String] :mutex (::Mutex.new) Mutex object def initialize(adapter, options = {}) super @lock = options[:mutex] || ::Mutex.new end protected def wrap(*args, &block) @lock.synchronize(&block) end end end ruby-moneta-0.7.20/lib/moneta/logger.rb000066400000000000000000000035471232153565500177170ustar00rootroot00000000000000module Moneta # Logger proxy # @api public class Logger < Wrapper # Standard formatter used by the logger # @api public class Format def initialize(options) @prefix = options[:prefix] || 'Moneta ' if options[:file] @close = true @out = File.open(options[:file], 'a') else @close = options[:close] @out = options[:out] || STDOUT end end def log(entry) @out.write(format(entry)) end def close @out.close if @close end protected def format(entry) args = entry[:args] args.pop if Hash === args.last && args.last.empty? args = args.map {|a| dump(a) }.join(', ') if entry[:error] "#{@prefix}#{entry[:method]}(#{args}) raised error: #{entry[:error].message}\n" else "#{@prefix}#{entry[:method]}(#{args}) -> #{dump entry[:return]}\n" end end def dump(value) value = value.inspect value.size > 30 ? value[0..30] + '...' : value end end # @param [Moneta store] adapter The underlying store # @param [Hash] options # @option options [Object] :logger (Moneta::Logger::Format) Logger object # @option options [String] :prefix ('Moneta ') Prefix string # @option options [File] :file Log file # @option options [IO] :out (STDOUT) Output def initialize(adapter, options = {}) super @logger = options[:logger] || Format.new(options) end def close super @logger.close nil end protected def wrap(method, *args) ret = yield @logger.log(:method => method, :args => args, :return => (method == :clear ? 'self' : ret)) ret rescue Exception => error @logger.log(:method => method, :args => args, :error => error) raise end end end ruby-moneta-0.7.20/lib/moneta/mixins.rb000066400000000000000000000233631232153565500177450ustar00rootroot00000000000000module Moneta # @api private module OptionSupport # Return Moneta store with default options or additional proxies # # @param [Hash] options Options to merge # @return [Moneta store] # # @api public def with(options = nil, &block) adapter = self if block builder = Builder.new(&block) builder.adapter(adapter) adapter = builder.build.last end options ? OptionMerger.new(adapter, options) : adapter end # Return Moneta store with default option :raw => true # # @return [OptionMerger] # @api public def raw @raw_store ||= begin store = with(:raw => true, :only => [:load, :store, :create, :delete]) store.instance_variable_set(:@raw_store, store) store end end # Return Moneta store with default prefix option # # @param [String] prefix Key prefix # @return [OptionMerger] # @api public def prefix(prefix) with(:prefix => prefix, :except => :clear) end # Return Moneta store with default expiration time # # @param [Integer] expires Default expiration time # @return [OptionMerger] # @api public def expires(expires) with(:expires => expires, :only => [:store, :create, :increment]) end end # Simple interface to key/value stores with Hash-like interface. # @api public module Defaults include OptionSupport # @api private module ClassMethods # Returns features list # # @return [Array] list of features def features @features ||= superclass.respond_to?(:features) ? superclass.features : [].freeze end # Declares that this adapter supports the given feature. # # @example # class MyAdapter # include Moneta::Defaults # supports :create # def create(key, value, options = {}) # # implement create! # end # end def supports(*features) @features = (self.features + features).uniq.freeze end end def self.included(base) base.extend(ClassMethods) end # Exists the value with key # # @param [Object] key # @param [Hash] options # @option options [Integer] :expires Update expiration time (See {Expires}) # @option options [String] :prefix Prefix key (See {Transformer}) # @option options Other options as defined by the adapters or middleware # @return [Boolean] # @api public def key?(key, options = {}) load(key, options) != nil end # Atomically increment integer value with key # # This method also accepts negative amounts. # # @note Not every Moneta store implements this method, # a NotImplementedError is raised if it is not supported. # @param [Object] key # @param [Integer] amount # @param [Hash] options # @option options [String] :prefix Prefix key (See {Transformer}) # @option options Other options as defined by the adapters or middleware # @return [Object] value from store # @api public def increment(key, amount = 1, options = {}) raise NotImplementedError, 'increment is not supported' end # Atomically decrement integer value with key # # This is just syntactic sugar for calling #increment with a negative value. # # This method also accepts negative amounts. # # @param [Object] key # @param [Integer] amount # @param [Hash] options # @option options [String] :prefix Prefix key (See {Transformer}) # @option options Other options as defined by the adapters or middleware # @return [Object] value from store # @api public def decrement(key, amount = 1, options = {}) increment(key, -amount, options) end # Explicitly close the store # @return nil # @api public def close end # Fetch a value with a key # # @overload fetch(key, options = {}, &block) # retrieve a key. if the key is not available, execute the # block and return its return value. # @param [Object] key # @param [Hash] options # @option options [Integer] :expires Update expiration time (See {Expires}) # @option options [Boolean] :raw Raw access without value transformation (See {Transformer}) # @option options [String] :prefix Prefix key (See {Transformer}) # @return [Object] value from store # # @overload fetch(key, default, options = {}) # retrieve a key. if the key is not available, return the default value. # @param [Object] key # @param [Object] default Default value # @param [Hash] options # @option options [Integer] :expires Update expiration time (See {Expires}) # @option options [Boolean] :raw Raw access without value transformation (See {Transformer}) # @option options [String] :prefix Prefix key (See {Transformer}) # @return [Object] value from store # # @api public def fetch(key, default = nil, options = nil) if block_given? raise ArgumentError, 'Only one argument accepted if block is given' if options result = load(key, default || {}) result == nil ? yield(key) : result else result = load(key, options || {}) result == nil ? default : result end end # Fetch value with key. Return nil if the key doesn't exist # # @param [Object] key # @return [Object] value # @api public def [](key) load(key) end # Store value with key # # @param [Object] key # @param [Object] value # @return value # @api public def []=(key, value) store(key, value) end # Atomically sets a key to value if it's not set. # # @note Not every Moneta store implements this method, # a NotImplementedError is raised if it is not supported. # @param [Object] key # @param [Object] value # @param [Hash] options # @option options [Integer] :expires Update expiration time (See {Expires}) # @option options [Boolean] :raw Raw access without value transformation (See {Transformer}) # @option options [String] :prefix Prefix key (See {Transformer}) # @return [Boolean] key was set # @api public def create(key, value, options = {}) raise NotImplementedError, 'create is not supported' end # Returns features list # # @return [Array] list of features def features self.class.features end # Return true if adapter supports the given feature. # # @return [Boolean] def supports?(feature) features.include?(feature) end end # @api private module IncrementSupport # (see Defaults#increment) def increment(key, amount = 1, options = {}) value = Utils.to_int(load(key, options)) + amount store(key, value.to_s, options) value end def self.included(base) base.supports(:increment) if base.respond_to?(:supports) end end # Implements simple create using key? and store. # # This is sufficient for non-shared stores or if atomicity is not required. # @api private module CreateSupport # (see Defaults#create) def create(key, value, options = {}) if key? key false else store(key, value, options) true end end def self.included(base) base.supports(:create) if base.respond_to?(:supports) end end # @api private module HashAdapter attr_reader :backend # (see Proxy#key?) def key?(key, options = {}) @backend.has_key?(key) end # (see Proxy#load) def load(key, options = {}) @backend[key] end # (see Proxy#store) def store(key, value, options = {}) @backend[key] = value end # (see Proxy#delete) def delete(key, options = {}) @backend.delete(key) end # (see Proxy#clear) def clear(options = {}) @backend.clear self end end # This mixin handles the calculation of expiration times. # # module ExpiresSupport attr_accessor :default_expires protected # Calculates the time when something will expire. # # This method considers false and 0 as "no-expire" and every positive # number as a time to live in seconds. # # @param [Hash] options Options hash # @option options [0,false,nil,Numeric] :expires expires value given by user # @param [0,false,nil,Numeric] default default expiration time # # @return [false] if it should not expire # @return [Time] the time when something should expire # @return [nil] if it is not known def expires_at(options, default = @default_expires) value = expires_value(options, default) Numeric === value ? Time.now + value : value end # Calculates the number of seconds something should last. # # This method considers false and 0 as "no-expire" and every positive # number as a time to live in seconds. # # @param [Hash] options Options hash # @option options [0,false,nil,Numeric] :expires expires value given by user # @param [0,false,nil,Numeric] default default expiration time # # @return [false] if it should not expire # @return [Numeric] seconds until expiration # @return [nil] if it is not known def expires_value(options, default = @default_expires) case value = options[:expires] when 0, false false when nil default ? default.to_i : nil when Numeric value = value.to_i raise ArgumentError, ":expires must be a positive value, got #{value}" if value < 0 value else raise ArgumentError, ":expires must be Numeric or false, got #{value.inspect}" end end def self.included(base) base.supports(:expires) if base.respond_to?(:supports) end end end ruby-moneta-0.7.20/lib/moneta/optionmerger.rb000066400000000000000000000024601232153565500211430ustar00rootroot00000000000000module Moneta # @api private class OptionMerger < Wrapper METHODS = [:key?, :load, :store, :create, :delete, :increment, :clear].freeze attr_reader :default_options # @param [Moneta store] adapter underlying adapter # @param [Hash] options def initialize(adapter, options = {}) super(adapter, options) @default_options = adapter.respond_to?(:default_options) ? adapter.default_options.dup : {} if options.include?(:only) raise ArgumentError, 'Either :only or :except is allowed' if options.include?(:except) methods = [options.delete(:only)].compact.flatten elsif options.include?(:except) methods = METHODS - [options.delete(:except)].compact.flatten else methods = METHODS end methods.each do |method| if oldopts = @default_options[method] newopts = (@default_options[method] = oldopts.merge(options)) newopts[:prefix] = "#{oldopts[:prefix]}#{options[:prefix]}" if oldopts[:prefix] || options[:prefix] else @default_options[method] = options end end end protected def wrap(method, *args) options = args.last options.merge!(@default_options[method]) if Hash === options && @default_options.include?(method) yield end end end ruby-moneta-0.7.20/lib/moneta/pool.rb000066400000000000000000000025571232153565500174110ustar00rootroot00000000000000require 'thread' module Moneta # Creates a pool of stores. # Each thread gets its own store. # # @example Add `Moneta::Pool` to proxy stack # Moneta.build do # use(:Pool) do # # Every thread gets its own instance # adapter :MemcachedNative # end # end # # @api public class Pool < Wrapper # @param [Moneta store] adapter The underlying store # @param [Hash] options # @option options [String] :mutex (::Mutex.new) Mutex object def initialize(options = {}, &block) super(nil) @mutex = options[:mutex] || ::Mutex.new @id = "Moneta::Pool(#{object_id})" @builder = Builder.new(&block) @pool, @all = [], [] end def close @mutex.synchronize do raise '#close can only be called when no thread is using the pool' if @all.size != @pool.size @all.each(&:close) @all = @pool = nil end end protected def adapter Thread.current[@id] end def wrap(*args) store = Thread.current[@id] = pop yield ensure Thread.current[@id] = nil @mutex.synchronize { @pool << store } end def pop if @mutex.synchronize { @pool.empty? } store = @builder.build.last @mutex.synchronize { @all << store } store else @mutex.synchronize { @pool.pop } end end end end ruby-moneta-0.7.20/lib/moneta/proxy.rb000066400000000000000000000053331232153565500176140ustar00rootroot00000000000000module Moneta # Proxy base class # @api public class Proxy include Defaults attr_reader :adapter # @param [Moneta store] adapter underlying adapter # @param [Hash] options def initialize(adapter, options = {}) @adapter = adapter end # (see Defaults#key?) def key?(key, options = {}) adapter.key?(key, options) end # (see Defaults#increment) def increment(key, amount = 1, options = {}) adapter.increment(key, amount, options) end # (see Defaults#create) def create(key, value, options = {}) adapter.create(key, value, options) end # (see Defaults#close) def close adapter.close end # Fetch value with key. Return nil if the key doesn't exist # # @param [Object] key # @param [Hash] options # @option options [Integer] :expires Update expiration time (See {Expires}) # @option options [Boolean] :raw Raw access without value transformation (See {Transformer}) # @option options [String] :prefix Prefix key (See {Transformer}) # @option options [Boolean] :sync Synchronized load ({Cache} reloads from adapter, {Adapters::Daybreak} syncs with file) # @option options Other options as defined by the adapters or middleware # @return [Object] value # @api public def load(key, options = {}) adapter.load(key, options) end # Store value with key # # @param [Object] key # @param [Object] value # @param [Hash] options # @option options [Integer] :expires Set expiration time (See {Expires}) # @option options [Boolean] :raw Raw access without value transformation (See {Transformer}) # @option options [String] :prefix Prefix key (See {Transformer}) # @option options Other options as defined by the adapters or middleware # @return value # @api public def store(key, value, options = {}) adapter.store(key, value, options) end # Delete the key from the store and return the current value # # @param [Object] key # @return [Object] current value # @param [Hash] options # @option options [Boolean] :raw Raw access without value transformation (See {Transformer}) # @option options [String] :prefix Prefix key (See {Transformer}) # @option options Other options as defined by the adapters or middleware # @api public def delete(key, options = {}) adapter.delete(key, options) end # Clear all keys in this store # # @param [Hash] options # @return [void] # @api public def clear(options = {}) adapter.clear(options) self end # (see Default#features) def features @features ||= (self.class.features + adapter.features).uniq.freeze end end end ruby-moneta-0.7.20/lib/moneta/server.rb000066400000000000000000000064601232153565500177430ustar00rootroot00000000000000require 'socket' module Moneta # Moneta server to be used together with Moneta::Adapters::Client # @api public class Server # @param [Hash] options # @option options [Integer] :port (9000) TCP port # @option options [String] :socket Alternative Unix socket file name def initialize(store, options = {}) @store = store @server = start(options) @ios = [@server] @clients = {} @running = false end # Is the server running # # @return [Boolean] true if the server is running def running? @running end # Run the server # # @note This method blocks! def run raise 'Already running' if @running @stop = false @running = true begin until @stop mainloop end ensure File.unlink(@socket) if @socket end end # Stop the server def stop raise 'Not running' unless @running @stop = true @server.close @server = nil end private TIMEOUT = 1 MAXSIZE = 0x100000 def mainloop if ios = IO.select(@ios, nil, @ios, TIMEOUT) ios[2].each do |io| io.close delete_client(io) end ios[0].each do |io| if io == @server if client = @server.accept @ios << client @clients[client] = '' end elsif io.closed? || io.eof? delete_client(io) else handle(io, @clients[io] << io.readpartial(0xFFFF)) end end end rescue SignalException => ex warn "Moneta::Server - #{ex.message}" raise if ex.signo == 15 || ex.signo == 2 # SIGTERM or SIGINT rescue Exception => ex warn "Moneta::Server - #{ex.message}" end def delete_client(io) @ios.delete(io) @clients.delete(io) end def pack(o) s = Marshal.dump(o) [s.bytesize].pack('N') << s end def handle(io, buffer) buffer = @clients[io] return if buffer.bytesize < 8 # At least 4 bytes for the marshalled array size = buffer[0,4].unpack('N').first if size > MAXSIZE delete_client(io) return end return if buffer.bytesize < 4 + size buffer.slice!(0, 4) method, *args = Marshal.load(buffer.slice!(0, size)) case method when :key?, :load, :delete, :increment, :create, :features io.write(pack @store.send(method, *args)) when :store, :clear @store.send(method, *args) io.write(@nil ||= pack(nil)) else raise 'Invalid method call' end rescue IOError => ex warn "Moneta::Server - #{ex.message}" unless ex.message =~ /closed/ delete_client(io) rescue Exception => ex warn "Moneta::Server - #{ex.message}" io.write(pack Exception.new(ex.message)) end def start(options) if @socket = options[:socket] begin UNIXServer.open(@socket) rescue Errno::EADDRINUSE if client = (UNIXSocket.open(@socket) rescue nil) client.close raise end File.unlink(@socket) tries ||= 0 (tries += 1) < 3 ? retry : raise end else TCPServer.open(options[:host] || '127.0.0.1', options[:port] || 9000) end end end end ruby-moneta-0.7.20/lib/moneta/shared.rb000066400000000000000000000032301232153565500176730ustar00rootroot00000000000000module Moneta # Shares a store between processes # # @example Share a store # Moneta.build do # use :Transformer, :key => :marshal, :value => :marshal # use :Shared do # adapter :GDBM, :file => 'shared.db' # end # end # # @api public class Shared < Wrapper # @param [Hash] options # @option options [Integer] :port (9000) TCP port # @option options [String] :host Server hostname # @option options [String] :socket Unix socket file name def initialize(options = {}, &block) @options = options @builder = Builder.new(&block) end # (see Proxy#close) def close if @server @server.stop @thread.join @server = @thread = nil end if @adapter @adapter.close @adapter = nil end end protected def wrap(*args) connect yield end def connect @adapter ||= Adapters::Client.new(@options) rescue Errno::ECONNREFUSED, Errno::ENOENT => ex start_server tries ||= 0 warn "Moneta::Shared - Failed to connect: #{ex.message}" if tries > 0 (tries += 1) < 3 ? retry : raise end # TODO: Implement this using forking (MRI) and threading (JRuby) # to get maximal performance def start_server @adapter = Lock.new(@builder.build.last) @server = Server.new(@adapter, @options) @thread = Thread.new { @server.run } sleep 0.1 until @server.running? rescue Exception => ex @adapter.close if @adapter @adapter = nil @server = nil @thread = nil warn "Moneta::Shared - Failed to start server: #{ex.message}" end end end ruby-moneta-0.7.20/lib/moneta/stack.rb000066400000000000000000000045721232153565500175440ustar00rootroot00000000000000module Moneta # Combines multiple stores. Reads return the result from the first store, # writes go to all stores. # # @example Add `Moneta::Stack` to proxy stack # Moneta.build do # use(:Stack) do # add { adapter :Redis } # add { adapter :File, :dir => 'data' } # add { adapter :File, :dir => 'replicate' } # end # end # # @api public class Stack include Defaults # @api private class DSL def initialize(stack, &block) @stack = stack instance_eval(&block) end # @api public def add(store = nil, &block) raise ArgumentError, 'Only argument or block allowed' if store && block @stack << (store || Moneta.build(&block)) nil end end attr_reader :stack # @param [Hash] options Options hash # @option options [Array] :stack Array of Moneta stores # @yieldparam Builder block def initialize(options = {}, &block) @stack = options[:stack].to_a DSL.new(@stack, &block) if block_given? end # (see Proxy#key?) def key?(key, options = {}) @stack.any? {|s| s.key?(key, options) } end # (see Proxy#load) def load(key, options = {}) @stack.each do |s| value = s.load(key, options) return value if value != nil end nil end # (see Proxy#store) def store(key, value, options = {}) @stack.each {|s| s.store(key, value, options) } value end # (see Proxy#increment) def increment(key, amount = 1, options = {}) last = nil @stack.each {|s| last = s.increment(key, amount, options) } last end # (see Proxy#create) def create(key, value, options = {}) last = false @stack.each {|s| last = s.create(key, value, options) } last end # (see Proxy#delete) def delete(key, options = {}) @stack.inject(nil) do |value, s| v = s.delete(key, options) value || v end end # (see Proxy#clear) def clear(options = {}) @stack.each {|s| s.clear(options) } self end # (see Proxy#close) def close @stack.each {|s| s.close } nil end # (see Proxy#features) def features @features ||= begin features = @stack.map(&:features) features.inject(features.first, &:&).freeze end end end end ruby-moneta-0.7.20/lib/moneta/synchronize.rb000066400000000000000000000061131232153565500210030ustar00rootroot00000000000000module Moneta # Base class for {Mutex} and {Semaphore} # @api private class SynchronizePrimitive # Synchronize block # # @api public # @yieldparam Synchronized block # @return [Object] result of block def synchronize enter yield ensure leave end # Try to enter critical section (nonblocking) # # @api public # @return [Boolean] true if the lock was acquired def try_enter raise 'Already locked' if @locked enter_primitive ? @locked = true : false end alias_method :try_lock, :try_enter # Enter critical section (blocking) # # @api public # @param [Number] timeout Maximum time to wait # @param [Number] wait Sleep time between tries to acquire lock # @return [Boolean] true if the lock was aquired def enter(timeout = nil, wait = 0.01) time_at_timeout = Time.now + timeout if timeout while !timeout || Time.now < time_at_timeout return true if try_enter sleep(wait) end false end alias_method :lock, :enter # Leave critical section # # @api public def leave raise 'Not locked' unless @locked leave_primitive @locked = false nil end alias_method :unlock, :leave # Is the lock acquired? # # @api public def locked? @locked end end # Distributed/shared store-wide mutex # # @example Use `Moneta::Mutex` # mutex = Moneta::Mutex.new(store, 'mutex') # mutex.synchronize do # # Synchronized access # store['counter'] += 1 # end # # @api public class Mutex < SynchronizePrimitive # @param [Moneta store] store The store we want to lock # @param [Object] lock Key of the lock entry def initialize(store, lock) raise 'Store must support feature :create' unless store.supports?(:create) @store, @lock = store, lock end protected def enter_primitive @store.create(@lock, '', :expires => false) end def leave_primitive @store.delete(@lock) end end # Distributed/shared store-wide semaphore # # @example Use `Moneta::Semaphore` # semaphore = Moneta::Semaphore.new(store, 'semaphore', 2) # semaphore.synchronize do # # Synchronized access # # ... # end # # @api public class Semaphore < SynchronizePrimitive # @param [Moneta store] store The store we want to lock # @param [Object] counter Key of the counter entry # @param [Fixnum] max Maximum number of threads which are allowed to enter the critical section def initialize(store, counter, max = 1) raise 'Store must support feature :increment' unless store.supports?(:increment) @store, @counter, @max = store, counter, max @store.increment(@counter, 0, :expires => false) # Ensure that counter exists end protected def enter_primitive if @store.increment(@counter, 1) <= @max true else @store.decrement(@counter) false end end def leave_primitive @store.decrement(@counter) end end end ruby-moneta-0.7.20/lib/moneta/transformer.rb000066400000000000000000000171411232153565500207750ustar00rootroot00000000000000module Moneta # Transforms keys and values (Marshal, YAML, JSON, Base64, MD5, ...). # You can bypass the transformer (e.g. serialization) by using the `:raw` option. # # @example Add `Moneta::Transformer` to proxy stack # Moneta.build do # transformer :key => [:marshal, :escape], :value => [:marshal] # adapter :File, :dir => 'data' # end # # @example Bypass serialization # store.store('key', 'value', :raw => true) # store['key'] # raises an Exception # store.load('key', :raw => true) # returns 'value' # # store['key'] = 'value' # store.load('key', :raw => true) # returns "\x04\bI\"\nvalue\x06:\x06ET" # # @api public class Transformer < Proxy class << self alias_method :original_new, :new # @param [Moneta store] adapter The underlying store # @param [Hash] options # @return [Transformer] new Moneta transformer # @option options [Array] :key List of key transformers in the order in which they should be applied # @option options [Array] :value List of value transformers in the order in which they should be applied # @option options [String] :prefix Prefix string for key namespacing (Used by the :prefix key transformer) # @option options [String] :secret HMAC secret to verify values (Used by the :hmac value transformer) # @option options [Integer] :maxlen Maximum key length (Used by the :truncate key transformer) def new(adapter, options = {}) keys = [options[:key]].flatten.compact values = [options[:value]].flatten.compact raise ArgumentError, 'Option :key or :value is required' if keys.empty? && values.empty? options[:prefix] ||= '' if keys.include?(:prefix) name = class_name(keys, values) const_set(name, compile(keys, values)) unless const_defined?(name) const_get(name).original_new(adapter, options) end private def compile(keys, values) @key_validator ||= compile_validator(KEY_TRANSFORMER) @value_validator ||= compile_validator(VALUE_TRANSFORMER) raise ArgumentError, 'Invalid key transformer chain' if @key_validator !~ keys.map(&:inspect).join raise ArgumentError, 'Invalid value transformer chain' if @value_validator !~ values.map(&:inspect).join klass = Class.new(self) klass.class_eval <<-end_eval, __FILE__, __LINE__ def initialize(adapter, options = {}) super #{compile_initializer('key', keys)} #{compile_initializer('value', values)} end end_eval key, key_opts = compile_transformer(keys, 'key') dump, dump_opts = compile_transformer(values, 'value') load, load_opts = compile_transformer(values.reverse, 'value', 1) if values.empty? compile_key_transformer(klass, key, key_opts) elsif keys.empty? compile_value_transformer(klass, load, load_opts, dump, dump_opts) else compile_key_value_transformer(klass, key, key_opts, load, load_opts, dump, dump_opts) end klass end def without(*options) options = options.flatten.uniq options.empty? ? 'options' : "Utils.without(options, #{options.map(&:to_sym).map(&:inspect).join(', ')})" end def compile_key_transformer(klass, key, key_opts) klass.class_eval <<-end_eval, __FILE__, __LINE__ def key?(key, options = {}) @adapter.key?(#{key}, #{without key_opts}) end def increment(key, amount = 1, options = {}) @adapter.increment(#{key}, amount, #{without key_opts}) end def load(key, options = {}) @adapter.load(#{key}, #{without :raw, key_opts}) end def store(key, value, options = {}) @adapter.store(#{key}, value, #{without :raw, key_opts}) end def delete(key, options = {}) @adapter.delete(#{key}, #{without :raw, key_opts}) end def create(key, value, options = {}) @adapter.create(#{key}, value, #{without :raw, key_opts}) end end_eval end def compile_value_transformer(klass, load, load_opts, dump, dump_opts) klass.class_eval <<-end_eval, __FILE__, __LINE__ def load(key, options = {}) value = @adapter.load(key, #{without :raw, load_opts}) value && !options[:raw] ? #{load} : value end def store(key, value, options = {}) @adapter.store(key, options[:raw] ? value : #{dump}, #{without :raw, dump_opts}) value end def delete(key, options = {}) value = @adapter.delete(key, #{without :raw, load_opts}) value && !options[:raw] ? #{load} : value end def create(key, value, options = {}) @adapter.create(key, options[:raw] ? value : #{dump}, #{without :raw, dump_opts}) end end_eval end def compile_key_value_transformer(klass, key, key_opts, load, load_opts, dump, dump_opts) klass.class_eval <<-end_eval, __FILE__, __LINE__ def key?(key, options = {}) @adapter.key?(#{key}, #{without key_opts}) end def increment(key, amount = 1, options = {}) @adapter.increment(#{key}, amount, #{without key_opts}) end def load(key, options = {}) value = @adapter.load(#{key}, #{without :raw, key_opts, load_opts}) value && !options[:raw] ? #{load} : value end def store(key, value, options = {}) @adapter.store(#{key}, options[:raw] ? value : #{dump}, #{without :raw, key_opts, dump_opts}) value end def delete(key, options = {}) value = @adapter.delete(#{key}, #{without :raw, key_opts, load_opts}) value && !options[:raw] ? #{load} : value end def create(key, value, options = {}) @adapter.create(#{key}, options[:raw] ? value : #{dump}, #{without :raw, key_opts, dump_opts}) end end_eval end # Compile option initializer def compile_initializer(type, transformers) transformers.map do |name| t = TRANSFORMER[name] (t[1].to_s + t[2].to_s).scan(/@\w+/).uniq.map do |opt| "raise ArgumentError, \"Option #{opt[1..-1]} is required for #{name} #{type} transformer\" unless #{opt} = options[:#{opt[1..-1]}]\n" end end.join("\n") end def compile_validator(s) Regexp.new('\A' + s.gsub(/\w+/) do '(' + TRANSFORMER.select {|k,v| v.first.to_s == $& }.map {|v| ":#{v.first}" }.join('|') + ')' end.gsub(/\s+/, '') + '\Z') end # Returned compiled transformer code string def compile_transformer(transformer, var, i = 2) value, options = var, [] transformer.each do |name| raise ArgumentError, "Unknown transformer #{name}" unless t = TRANSFORMER[name] require t[3] if t[3] code = t[i] options += code.scan(/options\[:(\w+)\]/).flatten value = if t[0] == :serialize && var == 'key' "(tmp = #{value}; String === tmp ? tmp : #{code % 'tmp'})" else code % value end end return value, options end def class_name(keys, values) (keys.empty? ? '' : keys.map(&:to_s).map(&:capitalize).join + 'Key') + (values.empty? ? '' : values.map(&:to_s).map(&:capitalize).join + 'Value') end end end end require 'moneta/transformer/helper' require 'moneta/transformer/config' ruby-moneta-0.7.20/lib/moneta/transformer/000077500000000000000000000000001232153565500204445ustar00rootroot00000000000000ruby-moneta-0.7.20/lib/moneta/transformer/config.rb000066400000000000000000000120671232153565500222440ustar00rootroot00000000000000module Moneta class Transformer # Available key/value transformers TRANSFORMER = { # Name => [ Type, Load, Dump, Library ], :bencode => [ :serialize, '::BEncode.load(%s)', '::BEncode.dump(%s)', 'bencode' ], :bert => [ :serialize, '::BERT.decode(%s)', '::BERT.encode(%s)', 'bert' ], :bson => [ :serialize, "::BSON.deserialize(%s)['v']", "::BSON.serialize('v'=>%s).to_s", 'bson' ], :json => [ :serialize, '::MultiJson.load(%s)', '::MultiJson.dump(%s)', 'multi_json' ], :marshal => [ :serialize, '::Marshal.load(%s)', '::Marshal.dump(%s)' ], :msgpack => [ :serialize, '::MessagePack.unpack(%s)', '::MessagePack.pack(%s)', 'msgpack' ], :ox => [ :serialize, '::Ox.parse_obj(%s)', '::Ox.dump(%s)', 'ox' ], :php => [ :serialize, '::PHP.unserialize(%s)', '::PHP.serialize(%s)', 'php_serialize' ], :tnet => [ :serialize, '::TNetstring.parse(%s).first', '::TNetstring.dump(%s)', 'tnetstring' ], :yaml => [ :serialize, '::YAML.load(%s)', '::YAML.dump(%s)', 'yaml' ], :bzip2 => [ :compress, '::Bzip2.uncompress(%s)', '::Bzip2.compress(%s)', 'bzip2' ], :lz4 => [ :compress, '::LZ4.uncompress(%s)', '::LZ4.compress(%s)', 'lz4-ruby' ], :lzma => [ :compress, '::LZMA.decompress(%s)', '::LZMA.compress(%s)', 'lzma' ], :lzo => [ :compress, '::LZO.decompress(%s)', '::LZO.compress(%s)', 'lzoruby' ], :snappy => [ :compress, '::Snappy.inflate(%s)', '::Snappy.deflate(%s)', 'snappy' ], :quicklz => [ :compress, '::QuickLZ.decompress(%s)', '::QuickLZ.compress(%s)', 'qlzruby' ], :zlib => [ :compress, '::Zlib::Inflate.inflate(%s)', '::Zlib::Deflate.deflate(%s)', 'zlib' ], :base64 => RUBY_VERSION > '1.9' ? [ :encode, "%s.unpack('m0').first", "[%s].pack('m0')" ] : [ :encode, "%s.unpack('m').first", "[%s].pack('m').gsub(\"\n\", '')" ], :escape => [ :encode, 'Helper.unescape(%s)', 'Helper.escape(%s)' ], :hex => [ :encode, "[%s].pack('H*')", "%s.unpack('H*').first" ], :qp => [ :encode, "%s.unpack('M').first", "[%s].pack('M')" ], :uuencode => [ :encode, "%s.unpack('u').first", "[%s].pack('u')" ], :hmac => [ :hmac, 'Helper.hmacverify(%s, options[:secret] || @secret)', 'Helper.hmacsign(%s, options[:secret] || @secret)', 'openssl' ], :truncate => [ :truncate, nil, 'Helper.truncate(%s, @maxlen)', 'digest/md5' ], :md5 => [ :digest, nil, '::Digest::MD5.hexdigest(%s)', 'digest/md5' ], :rmd160 => [ :digest, nil, '::Digest::RMD160.hexdigest(%s)', 'digest/rmd160' ], :sha1 => [ :digest, nil, '::Digest::SHA1.hexdigest(%s)', 'digest/sha1' ], :sha256 => [ :digest, nil, '::Digest::SHA256.hexdigest(%s)', 'digest/sha2' ], :sha384 => [ :digest, nil, '::Digest::SHA384.hexdigest(%s)', 'digest/sha2' ], :sha512 => [ :digest, nil, '::Digest::SHA512.hexdigest(%s)', 'digest/sha2' ], :city32 => [ :digest, nil, '::CityHash.hash32(%s).to_s(16)', 'cityhash' ], :city64 => [ :digest, nil, '::CityHash.hash64(%s).to_s(16)', 'cityhash' ], :city128 => [ :digest, nil, '::CityHash.hash128(%s).to_s(16)', 'cityhash' ], :prefix => [ :prefix, nil, '(options[:prefix] || @prefix)+%s' ], :spread => [ :spread, nil, 'Helper.spread(%s)' ], :to_s => [ :string, nil, '%s.to_s' ], :inspect => [ :string, nil, '%s.inspect' ], } # Allowed value transformers (Read it like a regular expression!) VALUE_TRANSFORMER = 'serialize? compress? hmac? encode?' # Allowed key transformers (Read it like a regular expression!) KEY_TRANSFORMER = '(serialize | string)? prefix? ((encode? truncate?) | (digest spread?))?' end end ruby-moneta-0.7.20/lib/moneta/transformer/helper.rb000066400000000000000000000017151232153565500222540ustar00rootroot00000000000000module Moneta class Transformer # @api private module Helper extend self def escape(value) value.gsub(/[^a-zA-Z0-9_-]+/){ '%' + $&.unpack('H2' * $&.bytesize).join('%').upcase } end def unescape(value) value.gsub(/((?:%[0-9a-fA-F]{2})+)/){ [$1.delete('%')].pack('H*') } end def hmacverify(value, secret) hash, value = value[0..31], value[32..-1] value if hash == OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'), secret, value) end def hmacsign(value, secret) OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'), secret, value) << value end def truncate(value, maxlen) if value.size >= maxlen digest = Digest::MD5.hexdigest(value) value = value[0, maxlen-digest.size] << digest end value end def spread(value) ::File.join(value[0..1], value[2..-1]) end end end end ruby-moneta-0.7.20/lib/moneta/utils.rb000066400000000000000000000011101232153565500175600ustar00rootroot00000000000000module Moneta # @api private module Utils extend self def without(hash, *keys) return hash if hash.empty? if keys.any? {|k| hash.include?(k) } hash = hash.dup keys.each {|k| hash.delete(k) } end hash end def only(hash, *keys) return hash if hash.empty? ret = {} keys.each {|k| ret[k] = hash[k] } ret end def to_int(value) intvalue = value.to_i raise "#{value.inspect} is not an integer value" unless value == nil || intvalue.to_s == value.to_s intvalue end end end ruby-moneta-0.7.20/lib/moneta/version.rb000066400000000000000000000001211232153565500201060ustar00rootroot00000000000000module Moneta # Moneta version number # @api public VERSION = '0.7.20' end ruby-moneta-0.7.20/lib/moneta/weak.rb000066400000000000000000000016651232153565500173660ustar00rootroot00000000000000module Moneta # Adds weak create support to the underlying store # # @note The create method will not be thread or multi-process safe (this is meant by weak) # @api public class WeakCreate < Proxy include CreateSupport # @param [Moneta store] adapter The underlying store # @param [Hash] options def initialize(adapter, options = {}) raise 'Store already supports feature :create' if adapter.supports?(:create) super end end # Adds weak increment support to the underlying store # # @note The increment method will not be thread or multi-process safe (this is meant by weak) # @api public class WeakIncrement < Proxy include IncrementSupport # @param [Moneta store] adapter The underlying store # @param [Hash] options def initialize(adapter, options = {}) raise 'Store already supports feature :increment' if adapter.supports?(:increment) super end end end ruby-moneta-0.7.20/lib/moneta/wrapper.rb000066400000000000000000000020601232153565500201050ustar00rootroot00000000000000module Moneta # Wraps the calls to the adapter # @api public class Wrapper < Proxy # (see Proxy#key?) def key?(key, options = {}) wrap(:key?, key, options) { super } end # (see Proxy#load) def load(key, options = {}) wrap(:load, key, options) { super } end # (see Proxy#store) def store(key, value, options = {}) wrap(:store, key, value, options) { super } end # (see Proxy#delete) def delete(key, options = {}) wrap(:delete, key, options) { super } end # (see Proxy#increment) def increment(key, amount = 1, options = {}) wrap(:increment, key, amount, options) { super } end # (see Proxy#create) def create(key, value, options = {}) wrap(:create, key, value, options) { super } end # (see Proxy#clear) def clear(options = {}) wrap(:clear, options) { super } end # (see Proxy#close) def close wrap(:close) { super } end # (see Proxy#features) def features wrap(:features) { super } end end end ruby-moneta-0.7.20/lib/rack/000077500000000000000000000000001232153565500155375ustar00rootroot00000000000000ruby-moneta-0.7.20/lib/rack/cache/000077500000000000000000000000001232153565500166025ustar00rootroot00000000000000ruby-moneta-0.7.20/lib/rack/cache/moneta.rb000066400000000000000000000036471232153565500204240ustar00rootroot00000000000000require 'moneta' require 'rack/cache/key' require 'rack/cache/metastore' require 'rack/cache/entitystore' module Rack module Cache # @api public Moneta = {} # @api private module MonetaResolver include Rack::Utils def resolve(uri) cache = Rack::Cache::Moneta[uri.to_s.sub(%r{^moneta://}, '')] ||= begin options = parse_query(uri.query) options.keys.each do |key| options[key.to_sym] = case value = options.delete(key) when 'true'; true when 'false'; false else value end end ::Moneta.new(uri.host.to_sym, options) end new(cache) end end class MetaStore # @api public class Moneta < MetaStore extend MonetaResolver def initialize(cache) @cache = cache end def read(key) @cache[key] || [] end def write(key, entries) @cache[key] = entries end def purge(key) @cache.delete(key) nil end end # @api public MONETA = Moneta end class EntityStore # @api public class Moneta < EntityStore extend MonetaResolver def initialize(cache) @cache = cache end def open(key) data = read(key) data && [data] end def exist?(key) @cache.key?(key) end def read(key) @cache[key] end def write(body, ttl = 0) buf = StringIO.new key, size = slurp(body) { |part| buf.write(part) } @cache.store(key, buf.string, ttl == 0 ? {} : {:expires => ttl}) [key, size] end def purge(key) @cache.delete(key) nil end end # @api public MONETA = Moneta end end end ruby-moneta-0.7.20/lib/rack/moneta_cookies.rb000066400000000000000000000037751232153565500210770ustar00rootroot00000000000000require 'moneta' require 'rack/utils' module Rack # A Rack middleware that was made to reuse all moneta transformers # on the cookie hash. # # @example config.ru # # Add Rack::MonetaCookies somewhere in your rack stack # use Rack::MonetaCookies # # run lambda { |env| [200, {}, []] } # # But this doesn't do much # # @example config.ru # # Give it some options # use Rack::MonetaCookies, :domain => 'example.com', :path => '/path' # # @example config.ru # # Pass it a block like the one passed to Moneta.build # use Rack::MonetaCookies do # use :Transformer, :key => :prefix, :prefix => 'moneta.' # adapter :Cookie # end # # run lambda { |env| # req = Rack::Request.new(env) # req.cookies #=> is now a Moneta store! # env['rack.request.cookie_hash'] #=> is now a Moneta store! # req.cookies['key'] #=> retrieves 'moneta.key' # req.cookies['key'] = 'value' #=> sets 'moneta.key' # req.cookies.delete('key') #=> removes 'moneta.key' # [200, {}, []] # } # # @api public class MonetaCookies def initialize(app, options = {}, &block) @app, @pool = app, [] if block raise ArgumentError, 'Use either block or options' unless options.empty? @builder = Moneta::Builder.new(&block) else @builder = Moneta::Builder.new { adapter :Cookie, options } end end def call(env) stores = @pool.pop || @builder.build env['rack.moneta_cookies'] = env['rack.request.cookie_hash'] = stores.last env['rack.request.cookie_string'] = env['HTTP_COOKIE'] stores.first.reset(Rack::Utils.parse_query(env['HTTP_COOKIE'])) status, headers, body = @app.call(env) stores.first.cookies.each do |key, cookie| if cookie == nil Rack::Utils.delete_cookie_header!(headers, key) else Rack::Utils.set_cookie_header!(headers, key, cookie) end end @pool << stores [status, headers, body] end end end ruby-moneta-0.7.20/lib/rack/moneta_rest.rb000066400000000000000000000037401232153565500204100ustar00rootroot00000000000000require 'moneta' module Rack # A Rack application which provides a REST interface to a Moneta store. # # @example config.ru # map '/moneta' do # run Rack::MonetaRest.new(:Memory) # end # # @example config.ru # # Pass it a block like the one passed to Moneta.build # run Rack::MonetaRest.new do # use :Transformer, :value => :zlib # adapter :Memory # end # # @api public class MonetaRest def initialize(store = nil, options = {}, &block) if block raise ArgumentError, 'Use either block or options' unless options.empty? @store = ::Moneta.build(&block) else raise ArgumentError, 'Block or argument store is required' unless @store = store @store = ::Moneta.new(@store, options) if Symbol === @store end end def call(env) key = env['PATH_INFO'][1..-1].to_s case env['REQUEST_METHOD'] when 'HEAD' if key.empty? respond(400, 'Empty key') elsif @store.key?(key) empty(200) else empty(404) end when 'GET' if key.empty? respond(400, 'Empty key') elsif value = @store[key] respond(200, value) else empty(404) end when 'POST', 'PUT' if key.empty? respond(400, 'Empty key') else respond(200, @store[key] = env['rack.input'].read) end when 'DELETE' if key.empty? @store.clear empty(200) else respond(200, @store.delete(key)) end else respond(400, 'Bad method') end rescue => ex respond(500, "Exception: #{ex.message}") end private def empty(status) [status, {'Content-Type'=>'application/octet-stream', 'Content-Length' => '0'}, []] end def respond(status, value) [status, {'Content-Type'=>'application/octet-stream', 'Content-Length' => value.bytesize.to_s}, [value]] end end end ruby-moneta-0.7.20/lib/rack/moneta_store.rb000066400000000000000000000025621232153565500205700ustar00rootroot00000000000000require 'moneta' module Rack # A Rack middleware that inserts a Moneta store in the environment # and supports per-request caching via the the option `:cache => true`. # # @example config.ru # # Add Rack::MonetaStore somewhere in your rack stack # use Rack::MonetaStore, :Memory, :cache => true # # run lambda { |env| # env['rack.moneta_store'] # is a Moneta store with per-request caching # } # # @example config.ru # # Pass it a block like the one passed to Moneta.build # use Rack::MonetaStore do # use :Transformer, :value => :zlib # adapter :Cookie # end # # run lambda { |env| # env['rack.moneta_store'] # is a Moneta store without caching # } # # @api public class MonetaStore def initialize(app, store = nil, options = {}, &block) @app = app @cache = options.delete(:cache) if block raise ArgumentError, 'Use either block or options' unless options.empty? @store = ::Moneta.build(&block) else raise ArgumentError, 'Block or argument store is required' unless @store = store @store = ::Moneta.new(@store, options) if Symbol === @store end end def call(env) env['rack.moneta_store'] = @cache ? ::Moneta::Cache.new(:cache => ::Moneta::Adapters::Memory.new, :adapter => @store) : @store @app.call(env) end end end ruby-moneta-0.7.20/lib/rack/session/000077500000000000000000000000001232153565500172225ustar00rootroot00000000000000ruby-moneta-0.7.20/lib/rack/session/moneta.rb000066400000000000000000000033201232153565500210300ustar00rootroot00000000000000require 'moneta' require 'rack/session/abstract/id' require 'thread' module Rack module Session # @api public class Moneta < Abstract::ID attr_reader :mutex, :pool def initialize(app, options = {}, &block) super if block raise ArgumentError, 'Use either block or option :store' if options[:store] @pool = ::Moneta.build(&block) else raise ArgumentError, 'Block or option :store is required' unless @pool = options[:store] @pool = ::Moneta.new(@pool, :expires => true) if Symbol === @pool end @pool = ::Moneta::WeakCreate.new(@pool) unless @pool.supports?(:create) @mutex = ::Mutex.new end def generate_sid loop do sid = super break sid unless @pool.key?(sid) end end def get_session(env, sid) with_lock(env) do unless sid && session = @pool[sid] session = {} begin sid = generate_sid end until @pool.create(sid, session) end [sid, session] end end def set_session(env, session_id, new_session, options) with_lock(env) do @pool.store(session_id, new_session, options[:expire_after] ? { :expires => options[:expire_after] } : {}) session_id end end def destroy_session(env, session_id, options) with_lock(env) do @pool.delete(session_id) generate_sid unless options[:drop] end end def with_lock(env) @mutex.lock if env['rack.multithread'] yield ensure @mutex.unlock if @mutex.locked? end end end end ruby-moneta-0.7.20/metadata.yml000066400000000000000000000447421232153565500163670ustar00rootroot00000000000000--- !ruby/object:Gem::Specification name: moneta version: !ruby/object:Gem::Version version: 0.7.20 platform: ruby authors: - Daniel Mendler - Yehuda Katz - Hannes Georg autorequire: bindir: bin cert_chain: [] date: 2013-09-30 00:00:00.000000000 Z dependencies: [] description: A unified interface to key/value stores email: - mail@daniel-mendler.de - wycats@gmail.com - hannes.georg@googlemail.com executables: [] extensions: [] extra_rdoc_files: - README.md - SPEC.md - LICENSE files: - .gitignore - .travis.yml - .yardopts - CHANGES - CONTRIBUTORS - Gemfile - LICENSE - README.md - SPEC.md - lib/action_dispatch/middleware/session/moneta_store.rb - lib/active_support/cache/moneta_store.rb - lib/moneta.rb - lib/moneta/adapters/activerecord.rb - lib/moneta/adapters/cassandra.rb - lib/moneta/adapters/client.rb - lib/moneta/adapters/cookie.rb - lib/moneta/adapters/couch.rb - lib/moneta/adapters/datamapper.rb - lib/moneta/adapters/daybreak.rb - lib/moneta/adapters/dbm.rb - lib/moneta/adapters/file.rb - lib/moneta/adapters/fog.rb - lib/moneta/adapters/gdbm.rb - lib/moneta/adapters/hbase.rb - lib/moneta/adapters/kyotocabinet.rb - lib/moneta/adapters/leveldb.rb - lib/moneta/adapters/lmdb.rb - lib/moneta/adapters/localmemcache.rb - lib/moneta/adapters/lruhash.rb - lib/moneta/adapters/memcached.rb - lib/moneta/adapters/memcached/dalli.rb - lib/moneta/adapters/memcached/native.rb - lib/moneta/adapters/memory.rb - lib/moneta/adapters/mongo.rb - lib/moneta/adapters/null.rb - lib/moneta/adapters/pstore.rb - lib/moneta/adapters/redis.rb - lib/moneta/adapters/restclient.rb - lib/moneta/adapters/riak.rb - lib/moneta/adapters/sdbm.rb - lib/moneta/adapters/sequel.rb - lib/moneta/adapters/sqlite.rb - lib/moneta/adapters/tdb.rb - lib/moneta/adapters/tokyocabinet.rb - lib/moneta/adapters/tokyotyrant.rb - lib/moneta/adapters/yaml.rb - lib/moneta/builder.rb - lib/moneta/cache.rb - lib/moneta/expires.rb - lib/moneta/lock.rb - lib/moneta/logger.rb - lib/moneta/mixins.rb - lib/moneta/optionmerger.rb - lib/moneta/pool.rb - lib/moneta/proxy.rb - lib/moneta/server.rb - lib/moneta/shared.rb - lib/moneta/stack.rb - lib/moneta/synchronize.rb - lib/moneta/transformer.rb - lib/moneta/transformer/config.rb - lib/moneta/transformer/helper.rb - lib/moneta/utils.rb - lib/moneta/version.rb - lib/moneta/weak.rb - lib/moneta/wrapper.rb - lib/rack/cache/moneta.rb - lib/rack/moneta_cookies.rb - lib/rack/moneta_rest.rb - lib/rack/moneta_store.rb - lib/rack/session/moneta.rb - moneta.gemspec - script/benchmarks - script/contributors - script/generate-specs - script/install-bundle - script/install-kyotocabinet - script/memusage - script/parallel-tests - script/start-services - script/travis-logs - script/upload-bundle - script/wait-services - spec/action_dispatch/fixtures/session_autoload_test/foo.rb - spec/action_dispatch/session_moneta_store_spec.rb - spec/active_support/cache_moneta_store_spec.rb - spec/helper.rb - spec/moneta/adapter_activerecord_exisiting_connection_spec.rb - spec/moneta/adapter_activerecord_spec.rb - spec/moneta/adapter_cassandra_spec.rb - spec/moneta/adapter_cassandra_with_default_expires_spec.rb - spec/moneta/adapter_client_spec.rb - spec/moneta/adapter_cookie_spec.rb - spec/moneta/adapter_couch_spec.rb - spec/moneta/adapter_datamapper_spec.rb - spec/moneta/adapter_daybreak_spec.rb - spec/moneta/adapter_dbm_spec.rb - spec/moneta/adapter_file_spec.rb - spec/moneta/adapter_fog_spec.rb - spec/moneta/adapter_gdbm_spec.rb - spec/moneta/adapter_hbase_spec.rb - spec/moneta/adapter_kyotocabinet_spec.rb - spec/moneta/adapter_leveldb_spec.rb - spec/moneta/adapter_lmdb_spec.rb - spec/moneta/adapter_lmdb_with_db_spec.rb - spec/moneta/adapter_localmemcache_spec.rb - spec/moneta/adapter_lruhash_spec.rb - spec/moneta/adapter_memcached_dalli_spec.rb - spec/moneta/adapter_memcached_dalli_with_default_expires_spec.rb - spec/moneta/adapter_memcached_native_spec.rb - spec/moneta/adapter_memcached_native_with_default_expires_spec.rb - spec/moneta/adapter_memcached_spec.rb - spec/moneta/adapter_memcached_with_default_expires_spec.rb - spec/moneta/adapter_memory_spec.rb - spec/moneta/adapter_mongo_spec.rb - spec/moneta/adapter_mongo_with_default_expires_spec.rb - spec/moneta/adapter_pstore_spec.rb - spec/moneta/adapter_redis_spec.rb - spec/moneta/adapter_redis_with_default_expires_spec.rb - spec/moneta/adapter_restclient_spec.rb - spec/moneta/adapter_riak_spec.rb - spec/moneta/adapter_sdbm_spec.rb - spec/moneta/adapter_sequel_spec.rb - spec/moneta/adapter_sqlite_spec.rb - spec/moneta/adapter_tdb_spec.rb - spec/moneta/adapter_tokyocabinet_bdb_spec.rb - spec/moneta/adapter_tokyocabinet_hdb_spec.rb - spec/moneta/adapter_tokyotyrant_spec.rb - spec/moneta/adapter_yaml_spec.rb - spec/moneta/builder_spec.rb - spec/moneta/cache_file_memory_spec.rb - spec/moneta/cache_memory_null_spec.rb - spec/moneta/expires_file_spec.rb - spec/moneta/expires_memory_spec.rb - spec/moneta/expires_memory_with_default_expires_spec.rb - spec/moneta/lock_spec.rb - spec/moneta/mutex_spec.rb - spec/moneta/null_adapter_spec.rb - spec/moneta/optionmerger_spec.rb - spec/moneta/pool_spec.rb - spec/moneta/proxy_expires_memory_spec.rb - spec/moneta/proxy_redis_spec.rb - spec/moneta/semaphore_spec.rb - spec/moneta/shared_tcp_spec.rb - spec/moneta/shared_unix_spec.rb - spec/moneta/stack_file_memory_spec.rb - spec/moneta/stack_memory_file_spec.rb - spec/moneta/standard_activerecord_spec.rb - spec/moneta/standard_activerecord_with_expires_spec.rb - spec/moneta/standard_cassandra_spec.rb - spec/moneta/standard_client_tcp_spec.rb - spec/moneta/standard_client_unix_spec.rb - spec/moneta/standard_couch_spec.rb - spec/moneta/standard_couch_with_expires_spec.rb - spec/moneta/standard_datamapper_spec.rb - spec/moneta/standard_datamapper_with_expires_spec.rb - spec/moneta/standard_datamapper_with_repository_spec.rb - spec/moneta/standard_daybreak_spec.rb - spec/moneta/standard_daybreak_with_expires_spec.rb - spec/moneta/standard_dbm_spec.rb - spec/moneta/standard_dbm_with_expires_spec.rb - spec/moneta/standard_file_spec.rb - spec/moneta/standard_file_with_expires_spec.rb - spec/moneta/standard_fog_spec.rb - spec/moneta/standard_fog_with_expires_spec.rb - spec/moneta/standard_gdbm_spec.rb - spec/moneta/standard_gdbm_with_expires_spec.rb - spec/moneta/standard_hashfile_spec.rb - spec/moneta/standard_hashfile_with_expires_spec.rb - spec/moneta/standard_hbase_spec.rb - spec/moneta/standard_hbase_with_expires_spec.rb - spec/moneta/standard_kyotocabinet_spec.rb - spec/moneta/standard_kyotocabinet_with_expires_spec.rb - spec/moneta/standard_leveldb_spec.rb - spec/moneta/standard_leveldb_with_expires_spec.rb - spec/moneta/standard_lmdb_spec.rb - spec/moneta/standard_lmdb_with_expires_spec.rb - spec/moneta/standard_localmemcache_spec.rb - spec/moneta/standard_localmemcache_with_expires_spec.rb - spec/moneta/standard_lruhash_spec.rb - spec/moneta/standard_lruhash_with_expires_spec.rb - spec/moneta/standard_memcached_dalli_spec.rb - spec/moneta/standard_memcached_native_spec.rb - spec/moneta/standard_memcached_spec.rb - spec/moneta/standard_memory_spec.rb - spec/moneta/standard_memory_with_compress_spec.rb - spec/moneta/standard_memory_with_expires_spec.rb - spec/moneta/standard_memory_with_json_key_serializer_spec.rb - spec/moneta/standard_memory_with_json_serializer_spec.rb - spec/moneta/standard_memory_with_json_value_serializer_spec.rb - spec/moneta/standard_memory_with_prefix_spec.rb - spec/moneta/standard_memory_with_snappy_compress_spec.rb - spec/moneta/standard_mongo_spec.rb - spec/moneta/standard_null_spec.rb - spec/moneta/standard_pstore_spec.rb - spec/moneta/standard_pstore_with_expires_spec.rb - spec/moneta/standard_redis_spec.rb - spec/moneta/standard_restclient_spec.rb - spec/moneta/standard_riak_spec.rb - spec/moneta/standard_riak_with_expires_spec.rb - spec/moneta/standard_sdbm_spec.rb - spec/moneta/standard_sdbm_with_expires_spec.rb - spec/moneta/standard_sequel_spec.rb - spec/moneta/standard_sequel_with_expires_spec.rb - spec/moneta/standard_sqlite_spec.rb - spec/moneta/standard_sqlite_with_expires_spec.rb - spec/moneta/standard_tdb_spec.rb - spec/moneta/standard_tdb_with_expires_spec.rb - spec/moneta/standard_tokyocabinet_spec.rb - spec/moneta/standard_tokyocabinet_with_expires_spec.rb - spec/moneta/standard_tokyotyrant_spec.rb - spec/moneta/standard_tokyotyrant_with_expires_spec.rb - spec/moneta/standard_yaml_spec.rb - spec/moneta/standard_yaml_with_expires_spec.rb - spec/moneta/transformer_bencode_spec.rb - spec/moneta/transformer_bert_spec.rb - spec/moneta/transformer_bson_spec.rb - spec/moneta/transformer_bzip2_spec.rb - spec/moneta/transformer_json_spec.rb - spec/moneta/transformer_key_inspect_spec.rb - spec/moneta/transformer_key_marshal_spec.rb - spec/moneta/transformer_key_to_s_spec.rb - spec/moneta/transformer_key_yaml_spec.rb - spec/moneta/transformer_lz4_spec.rb - spec/moneta/transformer_lzma_spec.rb - spec/moneta/transformer_lzo_spec.rb - spec/moneta/transformer_marshal_base64_spec.rb - spec/moneta/transformer_marshal_city128_spec.rb - spec/moneta/transformer_marshal_city32_spec.rb - spec/moneta/transformer_marshal_city64_spec.rb - spec/moneta/transformer_marshal_escape_spec.rb - spec/moneta/transformer_marshal_hex_spec.rb - spec/moneta/transformer_marshal_hmac_spec.rb - spec/moneta/transformer_marshal_md5_spec.rb - spec/moneta/transformer_marshal_md5_spread_spec.rb - spec/moneta/transformer_marshal_prefix_spec.rb - spec/moneta/transformer_marshal_qp_spec.rb - spec/moneta/transformer_marshal_rmd160_spec.rb - spec/moneta/transformer_marshal_sha1_spec.rb - spec/moneta/transformer_marshal_sha256_spec.rb - spec/moneta/transformer_marshal_sha384_spec.rb - spec/moneta/transformer_marshal_sha512_spec.rb - spec/moneta/transformer_marshal_spec.rb - spec/moneta/transformer_marshal_truncate_spec.rb - spec/moneta/transformer_marshal_uuencode_spec.rb - spec/moneta/transformer_msgpack_spec.rb - spec/moneta/transformer_ox_spec.rb - spec/moneta/transformer_php_spec.rb - spec/moneta/transformer_quicklz_spec.rb - spec/moneta/transformer_snappy_spec.rb - spec/moneta/transformer_tnet_spec.rb - spec/moneta/transformer_value_marshal_spec.rb - spec/moneta/transformer_value_yaml_spec.rb - spec/moneta/transformer_yaml_spec.rb - spec/moneta/transformer_zlib_spec.rb - spec/moneta/weak_create_spec.rb - spec/moneta/weak_increment_spec.rb - spec/monetaspecs.rb - spec/quality_spec.rb - spec/rack/cache_moneta_spec.rb - spec/rack/moneta_cookies_spec.rb - spec/rack/moneta_store_spec.rb - spec/rack/session_moneta_spec.rb homepage: http://github.com/minad/moneta licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - '>=' - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.0.0 signing_key: specification_version: 4 summary: A unified interface to key/value stores, including Redis, Memcached, TokyoCabinet, ActiveRecord and many more test_files: - spec/action_dispatch/fixtures/session_autoload_test/foo.rb - spec/action_dispatch/session_moneta_store_spec.rb - spec/active_support/cache_moneta_store_spec.rb - spec/helper.rb - spec/moneta/adapter_activerecord_exisiting_connection_spec.rb - spec/moneta/adapter_activerecord_spec.rb - spec/moneta/adapter_cassandra_spec.rb - spec/moneta/adapter_cassandra_with_default_expires_spec.rb - spec/moneta/adapter_client_spec.rb - spec/moneta/adapter_cookie_spec.rb - spec/moneta/adapter_couch_spec.rb - spec/moneta/adapter_datamapper_spec.rb - spec/moneta/adapter_daybreak_spec.rb - spec/moneta/adapter_dbm_spec.rb - spec/moneta/adapter_file_spec.rb - spec/moneta/adapter_fog_spec.rb - spec/moneta/adapter_gdbm_spec.rb - spec/moneta/adapter_hbase_spec.rb - spec/moneta/adapter_kyotocabinet_spec.rb - spec/moneta/adapter_leveldb_spec.rb - spec/moneta/adapter_lmdb_spec.rb - spec/moneta/adapter_lmdb_with_db_spec.rb - spec/moneta/adapter_localmemcache_spec.rb - spec/moneta/adapter_lruhash_spec.rb - spec/moneta/adapter_memcached_dalli_spec.rb - spec/moneta/adapter_memcached_dalli_with_default_expires_spec.rb - spec/moneta/adapter_memcached_native_spec.rb - spec/moneta/adapter_memcached_native_with_default_expires_spec.rb - spec/moneta/adapter_memcached_spec.rb - spec/moneta/adapter_memcached_with_default_expires_spec.rb - spec/moneta/adapter_memory_spec.rb - spec/moneta/adapter_mongo_spec.rb - spec/moneta/adapter_mongo_with_default_expires_spec.rb - spec/moneta/adapter_pstore_spec.rb - spec/moneta/adapter_redis_spec.rb - spec/moneta/adapter_redis_with_default_expires_spec.rb - spec/moneta/adapter_restclient_spec.rb - spec/moneta/adapter_riak_spec.rb - spec/moneta/adapter_sdbm_spec.rb - spec/moneta/adapter_sequel_spec.rb - spec/moneta/adapter_sqlite_spec.rb - spec/moneta/adapter_tdb_spec.rb - spec/moneta/adapter_tokyocabinet_bdb_spec.rb - spec/moneta/adapter_tokyocabinet_hdb_spec.rb - spec/moneta/adapter_tokyotyrant_spec.rb - spec/moneta/adapter_yaml_spec.rb - spec/moneta/builder_spec.rb - spec/moneta/cache_file_memory_spec.rb - spec/moneta/cache_memory_null_spec.rb - spec/moneta/expires_file_spec.rb - spec/moneta/expires_memory_spec.rb - spec/moneta/expires_memory_with_default_expires_spec.rb - spec/moneta/lock_spec.rb - spec/moneta/mutex_spec.rb - spec/moneta/null_adapter_spec.rb - spec/moneta/optionmerger_spec.rb - spec/moneta/pool_spec.rb - spec/moneta/proxy_expires_memory_spec.rb - spec/moneta/proxy_redis_spec.rb - spec/moneta/semaphore_spec.rb - spec/moneta/shared_tcp_spec.rb - spec/moneta/shared_unix_spec.rb - spec/moneta/stack_file_memory_spec.rb - spec/moneta/stack_memory_file_spec.rb - spec/moneta/standard_activerecord_spec.rb - spec/moneta/standard_activerecord_with_expires_spec.rb - spec/moneta/standard_cassandra_spec.rb - spec/moneta/standard_client_tcp_spec.rb - spec/moneta/standard_client_unix_spec.rb - spec/moneta/standard_couch_spec.rb - spec/moneta/standard_couch_with_expires_spec.rb - spec/moneta/standard_datamapper_spec.rb - spec/moneta/standard_datamapper_with_expires_spec.rb - spec/moneta/standard_datamapper_with_repository_spec.rb - spec/moneta/standard_daybreak_spec.rb - spec/moneta/standard_daybreak_with_expires_spec.rb - spec/moneta/standard_dbm_spec.rb - spec/moneta/standard_dbm_with_expires_spec.rb - spec/moneta/standard_file_spec.rb - spec/moneta/standard_file_with_expires_spec.rb - spec/moneta/standard_fog_spec.rb - spec/moneta/standard_fog_with_expires_spec.rb - spec/moneta/standard_gdbm_spec.rb - spec/moneta/standard_gdbm_with_expires_spec.rb - spec/moneta/standard_hashfile_spec.rb - spec/moneta/standard_hashfile_with_expires_spec.rb - spec/moneta/standard_hbase_spec.rb - spec/moneta/standard_hbase_with_expires_spec.rb - spec/moneta/standard_kyotocabinet_spec.rb - spec/moneta/standard_kyotocabinet_with_expires_spec.rb - spec/moneta/standard_leveldb_spec.rb - spec/moneta/standard_leveldb_with_expires_spec.rb - spec/moneta/standard_lmdb_spec.rb - spec/moneta/standard_lmdb_with_expires_spec.rb - spec/moneta/standard_localmemcache_spec.rb - spec/moneta/standard_localmemcache_with_expires_spec.rb - spec/moneta/standard_lruhash_spec.rb - spec/moneta/standard_lruhash_with_expires_spec.rb - spec/moneta/standard_memcached_dalli_spec.rb - spec/moneta/standard_memcached_native_spec.rb - spec/moneta/standard_memcached_spec.rb - spec/moneta/standard_memory_spec.rb - spec/moneta/standard_memory_with_compress_spec.rb - spec/moneta/standard_memory_with_expires_spec.rb - spec/moneta/standard_memory_with_json_key_serializer_spec.rb - spec/moneta/standard_memory_with_json_serializer_spec.rb - spec/moneta/standard_memory_with_json_value_serializer_spec.rb - spec/moneta/standard_memory_with_prefix_spec.rb - spec/moneta/standard_memory_with_snappy_compress_spec.rb - spec/moneta/standard_mongo_spec.rb - spec/moneta/standard_null_spec.rb - spec/moneta/standard_pstore_spec.rb - spec/moneta/standard_pstore_with_expires_spec.rb - spec/moneta/standard_redis_spec.rb - spec/moneta/standard_restclient_spec.rb - spec/moneta/standard_riak_spec.rb - spec/moneta/standard_riak_with_expires_spec.rb - spec/moneta/standard_sdbm_spec.rb - spec/moneta/standard_sdbm_with_expires_spec.rb - spec/moneta/standard_sequel_spec.rb - spec/moneta/standard_sequel_with_expires_spec.rb - spec/moneta/standard_sqlite_spec.rb - spec/moneta/standard_sqlite_with_expires_spec.rb - spec/moneta/standard_tdb_spec.rb - spec/moneta/standard_tdb_with_expires_spec.rb - spec/moneta/standard_tokyocabinet_spec.rb - spec/moneta/standard_tokyocabinet_with_expires_spec.rb - spec/moneta/standard_tokyotyrant_spec.rb - spec/moneta/standard_tokyotyrant_with_expires_spec.rb - spec/moneta/standard_yaml_spec.rb - spec/moneta/standard_yaml_with_expires_spec.rb - spec/moneta/transformer_bencode_spec.rb - spec/moneta/transformer_bert_spec.rb - spec/moneta/transformer_bson_spec.rb - spec/moneta/transformer_bzip2_spec.rb - spec/moneta/transformer_json_spec.rb - spec/moneta/transformer_key_inspect_spec.rb - spec/moneta/transformer_key_marshal_spec.rb - spec/moneta/transformer_key_to_s_spec.rb - spec/moneta/transformer_key_yaml_spec.rb - spec/moneta/transformer_lz4_spec.rb - spec/moneta/transformer_lzma_spec.rb - spec/moneta/transformer_lzo_spec.rb - spec/moneta/transformer_marshal_base64_spec.rb - spec/moneta/transformer_marshal_city128_spec.rb - spec/moneta/transformer_marshal_city32_spec.rb - spec/moneta/transformer_marshal_city64_spec.rb - spec/moneta/transformer_marshal_escape_spec.rb - spec/moneta/transformer_marshal_hex_spec.rb - spec/moneta/transformer_marshal_hmac_spec.rb - spec/moneta/transformer_marshal_md5_spec.rb - spec/moneta/transformer_marshal_md5_spread_spec.rb - spec/moneta/transformer_marshal_prefix_spec.rb - spec/moneta/transformer_marshal_qp_spec.rb - spec/moneta/transformer_marshal_rmd160_spec.rb - spec/moneta/transformer_marshal_sha1_spec.rb - spec/moneta/transformer_marshal_sha256_spec.rb - spec/moneta/transformer_marshal_sha384_spec.rb - spec/moneta/transformer_marshal_sha512_spec.rb - spec/moneta/transformer_marshal_spec.rb - spec/moneta/transformer_marshal_truncate_spec.rb - spec/moneta/transformer_marshal_uuencode_spec.rb - spec/moneta/transformer_msgpack_spec.rb - spec/moneta/transformer_ox_spec.rb - spec/moneta/transformer_php_spec.rb - spec/moneta/transformer_quicklz_spec.rb - spec/moneta/transformer_snappy_spec.rb - spec/moneta/transformer_tnet_spec.rb - spec/moneta/transformer_value_marshal_spec.rb - spec/moneta/transformer_value_yaml_spec.rb - spec/moneta/transformer_yaml_spec.rb - spec/moneta/transformer_zlib_spec.rb - spec/moneta/weak_create_spec.rb - spec/moneta/weak_increment_spec.rb - spec/monetaspecs.rb - spec/quality_spec.rb - spec/rack/cache_moneta_spec.rb - spec/rack/moneta_cookies_spec.rb - spec/rack/moneta_store_spec.rb - spec/rack/session_moneta_spec.rb ruby-moneta-0.7.20/moneta.gemspec000066400000000000000000000017421232153565500167050ustar00rootroot00000000000000# -*- encoding: utf-8 -*- require File.dirname(__FILE__) + '/lib/moneta/version' require 'date' Gem::Specification.new do |s| s.name = 'moneta' s.version = Moneta::VERSION s.date = Date.today.to_s s.authors = ['Daniel Mendler', 'Yehuda Katz', 'Hannes Georg'] s.email = %w{mail@daniel-mendler.de wycats@gmail.com hannes.georg@googlemail.com} s.description = 'A unified interface to key/value stores' s.extra_rdoc_files = %w{README.md SPEC.md LICENSE} s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.homepage = 'http://github.com/minad/moneta' s.licenses = %w(MIT) s.require_paths = %w(lib) s.summary = %{A unified interface to key/value stores, including Redis, Memcached, TokyoCabinet, ActiveRecord and many more} end ruby-moneta-0.7.20/script/000077500000000000000000000000001232153565500153555ustar00rootroot00000000000000ruby-moneta-0.7.20/script/benchmarks000077500000000000000000000252321232153565500174240ustar00rootroot00000000000000#!/usr/bin/env ruby $: << File.join(File.dirname(__FILE__), '..', 'lib') require 'benchmark' require 'moneta' require 'fileutils' class String def random(n) (1..n).map { self[rand(size),1] }.join end end class Array def sum inject(0, &:+) end def mean sum / size end def stddev m = mean Math.sqrt(map {|s| (s - m) ** 2 }.mean) end end class MonetaBenchmarks DIR = __FILE__ + '.tmp' STORES = { # SDBM accepts only very short key/value pairs (1k for both) # :SDBM => { :file => "#{DIR}/sdbm" }, # YAML is too slow # :YAML => { :file => "#{DIR}/yaml" }, :ActiveRecord => { :table => 'activerecord', :connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :username => 'root', :database => 'moneta' } }, :Cassandra => {}, :Client => {}, :Couch => {}, :DBM => { :file => "#{DIR}/dbm" }, :DataMapper => { :setup => 'mysql://root:@localhost/moneta', :table => 'datamapper' }, :Daybreak => { :file => "#{DIR}/daybreak" }, :File => { :dir => "#{DIR}/file" }, :GDBM => { :file => "#{DIR}/gdbm" }, :HBase => {}, :HashFile => { :dir => "#{DIR}/hashfile" }, :KyotoCabinet => { :file => "#{DIR}/kyotocabinet.kch" }, :LRUHash => {}, :LevelDB => { :dir => "#{DIR}/leveldb" }, :LocalMemCache => { :file => "#{DIR}/lmc" }, :LMDB => { :dir => "#{DIR}/lmdb" }, :MemcachedDalli => {}, :MemcachedNative => {}, :Memory => {}, :Mongo => {}, :PStore => { :file => "#{DIR}/pstore" }, :Redis => {}, :RestClient => { :url => 'http://localhost:8808/' }, :Riak => {}, :Sequel => { :table => 'sequel', :db => (defined?(JRUBY_VERSION) ? 'jdbc:mysql://localhost/moneta?user=root' : 'mysql2://root:@localhost/moneta') }, :Sqlite => { :file => ':memory:' }, :TDB => { :file => "#{DIR}/tdb" }, :TokyoCabinet => { :file => "#{DIR}/tokyocabinet" }, :TokyoTyrant => {}, } CONFIGS = { :uniform_small => { :runs => 3, :keys => 1000, :min_key_len => 1, :max_key_len => 32, :key_dist => :uniform, :min_val_len => 0, :max_val_len => 256, :val_dist => :uniform }, :uniform_medium => { :runs => 3, :keys => 1000, :min_key_len => 3, :max_key_len => 128, :key_dist => :uniform, :min_val_len => 0, :max_val_len => 1024, :val_dist => :uniform }, :uniform_large => { :runs => 3, :keys => 100, :min_key_len => 3, :max_key_len => 128, :key_dist => :uniform, :min_val_len => 0, :max_val_len => 10240, :val_dist => :uniform }, :normal_small => { :runs => 3, :keys => 1000, :min_key_len => 1, :max_key_len => 32, :key_dist => :normal, :min_val_len => 0, :max_val_len => 256, :val_dist => :normal }, :normal_medium => { :runs => 3, :keys => 1000, :min_key_len => 3, :max_key_len => 128, :key_dist => :normal, :min_val_len => 0, :max_val_len => 1024, :val_dist => :normal }, :normal_large => { :runs => 3, :keys => 100, :min_key_len => 3, :max_key_len => 128, :key_dist => :normal, :min_val_len => 0, :max_val_len => 10240, :val_dist => :normal }, } DICT = 'ABCDEFGHIJKLNOPQRSTUVWXYZabcdefghijklnopqrstuvwxyz123456789'.freeze HEADER = "\n Minimum Maximum Total Mean Stddev Ops/s" SEPARATOR = '=' * 77 module Rand extend self def normal_rand(mean, stddev) # Box-Muller transform theta = 2 * Math::PI * (rand(1e10) / 1e10) scale = stddev * Math.sqrt(-2 * Math.log(1 - (rand(1e10) / 1e10))) [mean + scale * Math.cos(theta), mean + scale * Math.sin(theta)] end def uniform(min, max) rand(max - min) + min end def normal(min, max) mean = (min + max) / 2 stddev = (max - min) / 4 loop do val = normal_rand(mean, stddev) return val.first if val.first >= min && val.first <= max return val.last if val.last >= min && val.last <= max end end end def parallel(&block) if defined?(JRUBY_VERSION) Thread.new(&block) else Process.fork(&block) end end def write_histogram(file, sizes) min = sizes.min delta = sizes.max - min histogram = [] sizes.each do |s| s = 10 * (s - min) / delta histogram[s] ||= 0 histogram[s] += 1 end File.open(file, 'w') do |f| histogram.each_with_index { |n,i| f.puts "#{i*delta/10+min} #{n}" } end end def start_servers parallel do begin Moneta::Server.new(Moneta.new(:Memory)).run rescue Exception => ex puts "\e[31mFailed to start Moneta server - #{ex.message}\e[0m" end end parallel do begin require 'rack' require 'webrick' require 'rack/moneta_rest' # Keep webrick quiet ::WEBrick::HTTPServer.class_eval do def access_log(config, req, res); end end ::WEBrick::BasicLog.class_eval do def log(level, data); end end Rack::Server.start(:app => Rack::Builder.app do use Rack::Lint run Rack::MonetaRest.new(:store => :Memory) end, :environment => :none, :server => :webrick, :Port => 8808) rescue Exception => ex puts "\e[31mFailed to start Rack server - #{ex.message}\e[0m" end end sleep 1 # Wait for servers end def test_stores STORES.each do |name, options| begin if name == :DataMapper begin require 'dm-core' DataMapper.setup(:default, :adapter => :in_memory) rescue LoadError => ex puts "\e[31mFailed to load DataMapper - #{ex.message}\e[0m" end elsif name == :Riak require 'riak' Riak.disable_list_keys_warnings = true end cache = Moneta.new(name, options.dup) cache['test'] = 'test' rescue Exception => ex puts "\e[31m#{name} not benchmarked - #{ex.message}\e[0m" STORES.delete(name) ensure (cache.close rescue nil) if cache end end end def generate_data until @data.size == @config[:keys] key = DICT.random(Rand.send(@config[:key_dist], @config[:min_key_len], @config[:max_key_len])) @data[key] = DICT.random(Rand.send(@config[:val_dist], @config[:min_val_len], @config[:max_val_len])) end key_lens, val_lens = @data.keys.map(&:size), @data.values.map(&:size) @data = @data.to_a write_histogram("#{DIR}/key.histogram", key_lens) write_histogram("#{DIR}/value.histogram", val_lens) puts "\n\e[1m\e[34m#{SEPARATOR}\n\e[34mComputing keys and values...\n\e[34m#{SEPARATOR}\e[0m" puts %{ Minimum Maximum Total Mean Stddev} puts 'Key Length % 8d % 8d % 8d % 8d % 8d' % [key_lens.min, key_lens.max, key_lens.sum, key_lens.mean, key_lens.stddev] puts 'Value Length % 8d % 8d % 8d % 8d % 8d' % [val_lens.min, val_lens.max, val_lens.sum, val_lens.mean, val_lens.stddev] end def print_config puts "\e[1m\e[36m#{SEPARATOR}\n\e[36mConfig #{@config_name}\n\e[36m#{SEPARATOR}\e[0m" @config.each do |k,v| puts '%-16s = %-10s' % [k,v] end end def print_store_stats(name) puts HEADER [:write, :read, :sum].each do |i| ops = (1000 * @config[:runs] * @data.size) / @stats[name][i].sum line = '%-17.17s %-5s % 8d % 8d % 8d % 8d % 8d % 8d' % [name, i, @stats[name][i].min, @stats[name][i].max, @stats[name][i].sum, @stats[name][i].mean, @stats[name][i].stddev, ops] @summary << [-ops, line << "\n"] if i == :sum puts line end errors = @stats[name][:error].sum if errors > 0 puts "\e[31m%-23.23s % 8d % 8d % 8d % 8d\e[0m" % ['Read errors', @stats[name][:error].min, @stats[name][:error].max, errors, errors / @config[:runs]] else puts "\e[32mNo read errors" end end def benchmark_store(name, options) puts "\n\e[1m\e[34m#{SEPARATOR}\n\e[34m#{name}\n\e[34m#{SEPARATOR}\e[0m" store = Moneta.new(name, options.dup) @stats[name] = { :write => [], :read => [], :sum => [], :error => [] } %w(Rehearse Measure).each do |type| state = '' print "%s [%#{2 * @config[:runs]}s] " % [type, state] @config[:runs].times do |run| store.clear @data.shuffle! m1 = Benchmark.measure do @data.each {|k,v| store[k] = v } end print "%s[%-#{2 * @config[:runs]}s] " % ["\b" * (2 * @config[:runs] + 3), state << 'W'] @data.shuffle! error = 0 m2 = Benchmark.measure do @data.each do |k, v| error += 1 if v != store[k] end end print "%s[%-#{2 * @config[:runs]}s] " % ["\b" * (2 * @config[:runs] + 3), state << 'R'] if type == 'Measure' @stats[name][:write] << m1.real * 1000 @stats[name][:error] << error @stats[name][:read] << m2.real * 1000 @stats[name][:sum] << (m1.real + m2.real) * 1000 end end end print_store_stats(name) rescue StandardError => ex puts "\n\e[31mFailed to benchmark #{name} - #{ex.message}\e[0m\n" ensure store.close if store end def run_benchmarks STORES.each do |name, options| benchmark_store(name, options) sleep 1 end end def print_summary puts "\n\e[1m\e[36m#{SEPARATOR}\n\e[36mSummary #{@config_name}: #{@config[:runs]} runs, #{@data.size} keys\n\e[36m#{SEPARATOR}\e[0m#{HEADER}\n" @summary.sort_by(&:first).each do |entry| puts entry.last end end def initialize(args) @config_name = args.size == 1 ? args.first.to_sym : :uniform_medium unless @config = CONFIGS[@config_name] puts "Configuration #{@config_name} not found" exit end # Disable jruby stdout pollution by memcached if defined?(JRUBY_VERSION) require 'java' properties = java.lang.System.getProperties(); properties.put('net.spy.log.LoggerImpl', 'net.spy.memcached.compat.log.SunLogger'); java.lang.System.setProperties(properties); java.util.logging.Logger.getLogger('').setLevel(java.util.logging.Level::OFF) end @stats, @data, @summary = {}, {}, [] end def run FileUtils.rm_rf(DIR) FileUtils.mkpath(DIR) start_servers test_stores print_config generate_data run_benchmarks print_summary FileUtils.rm_rf(DIR) end end MonetaBenchmarks.new(ARGV).run ruby-moneta-0.7.20/script/contributors000077500000000000000000000003361232153565500200420ustar00rootroot00000000000000#!/bin/sh git log --format='%aN <%aE>' |\ sed -e 's/hiddenbek/Scott Wadden/g' |\ sed -e 's/Asmod4n/Hendrik Beskow/' |\ grep -v 'hannes.georg@xing.com\|spotapov\|yehuda-katzs-mac\|wycats ' |\ sort -u | sort > CONTRIBUTORS ruby-moneta-0.7.20/script/generate-specs000077500000000000000000002413201232153565500202120ustar00rootroot00000000000000#!/usr/bin/env ruby # -*- coding: utf-8 -*- PATH = File.expand_path(File.join(__FILE__, '..', '..', 'spec')) class Specs attr_reader :key, :value, :specs, :features def initialize(options = {}) @specs = options.delete(:specs).to_a @key = options.delete(:key) || %w(object string binary hash boolean nil integer number) @value = options.delete(:value) || %w(object string binary hash boolean nil integer number) @features = [] [:expires, :expires_native, :increment, :create].each do |feature| @features << feature if @specs.include?(feature) end @features.sort_by!(&:to_s) @features.uniq! end def new(options) Specs.new({:specs => specs, :key => key, :value => value}.merge(options)) end def without_path new(:key => key - %w(path)) end def stringvalues_only new(:value => %w(string)) end def simplekeys_only new(:key => %w(string hash integer)) end def simplevalues_only new(:value => %w(string hash integer)) end def without_increment new(:specs => specs - [:increment, :concurrent_increment] + [:not_increment]) end def without_large new(:specs => specs - [:store_large]) end def without_concurrent new(:specs => specs - [:concurrent_increment, :concurrent_create]) end def without_persist new(:specs => specs - [:persist, :multiprocess, :concurrent_increment, :concurrent_create] + [:not_persist]) end def without_multiprocess new(:specs => specs - [:multiprocess, :concurrent_increment, :concurrent_create]) end def with_expires a = specs.dup if a.include?(:transform_value) a.delete(:transform_value) a << :transform_value_expires end a << :create_expires if a.include?(:create) a << :expires new(:specs => a) end def with_native_expires a = specs.dup a << :create_expires if a.include?(:create) new(:specs => a + [:expires]) end def without_marshallable new(:specs => specs - [:marshallable_value, :marshallable_key]) end def without_transform new(:specs => specs - [:marshallable_value, :marshallable_key, :transform_value]) end def returnsame new(:specs => specs - [:returndifferent] + [:returnsame]) end def without_marshallable_key new(:specs => specs - [:marshallable_key]) end def without_marshallable_value new(:specs => specs - [:marshallable_value]) end def without_store new(:specs => specs - [:store, :store_large, :transform_value, :marshallable_value]) end def with_default_expires new(:specs => specs + [:default_expires]) end def without_create new(:specs => specs - [:create, :concurrent_create, :create_expires] + [:not_create]) end end ADAPTER_SPECS = Specs.new(:specs => [:null, :store, :returndifferent, :increment, :concurrent_increment, :concurrent_create, :persist, :multiprocess, :create, :features, :store_large], :key => %w(string path), :value => %w(string path)) STANDARD_SPECS = Specs.new(:specs => [:null, :store, :returndifferent, :marshallable_key, :marshallable_value, :transform_value, :increment, :concurrent_increment, :concurrent_create, :persist, :multiprocess, :create, :features, :store_large]) TRANSFORMER_SPECS = Specs.new(:specs => [:null, :store, :returndifferent, :transform_value, :increment, :create, :features, :store_large]) header = "# coding: binary\n# Generated by #{File.basename(__FILE__)}\n" TESTS = { 'standard_client_tcp' => { :preamble => "start_server(Moneta::Adapters::Memory.new)\n", :store => :Client, :specs => STANDARD_SPECS, :tests => %{ it 'supports multiple clients' do client = Moneta.new(:Client) client['shared_key'] = 'shared_val' (1..100).each do |i| Thread.new do client = Moneta.new(:Client) (1.100).each do |j| client['shared_key'].should == 'shared_val' client["key-\#{j}-\#{i}"] = "val-\#{j}-\#{i}" client["key-\#{j}-\#{i}"].should == "val-\#{j}-\#{i}" end end end end } }, 'standard_client_unix' => { :preamble => "start_server(Moneta::Adapters::Memory.new, :socket => File.join(make_tempdir, 'standard_client_unix'))\n", :store => :Client, :options => ":socket => File.join(make_tempdir, 'standard_client_unix')", :specs => STANDARD_SPECS }, 'standard_restclient' => { :preamble => "start_restserver\n", :store => :RestClient, :options => ":url => 'http://localhost:8808/moneta/'", :specs => STANDARD_SPECS.without_increment.without_create }, 'standard_memory' => { :store => :Memory, :specs => STANDARD_SPECS.without_persist }, 'standard_memory_with_expires' => { :store => :Memory, :options => ':expires => true', :specs => STANDARD_SPECS.with_expires.without_persist }, 'standard_memory_with_compress' => { :store => :Memory, :options => ':compress => true', :load_value => 'Marshal.load(::Zlib::Inflate.inflate(value))', :specs => STANDARD_SPECS.without_persist }, 'standard_memory_with_prefix' => { :store => :Memory, :options => ':prefix => "moneta"', :specs => STANDARD_SPECS.without_persist }, 'standard_memory_with_json_serializer' => { :store => :Memory, :options => ':serializer => :json', :load_value => '::MultiJson.load(value)', :specs => STANDARD_SPECS.without_marshallable.simplekeys_only.simplevalues_only.without_persist }, 'standard_memory_with_json_key_serializer' => { :store => :Memory, :options => ':key_serializer => :json', :specs => STANDARD_SPECS.without_marshallable_key.simplekeys_only.without_persist, }, 'standard_memory_with_json_value_serializer' => { :store => :Memory, :options => ':value_serializer => :json', :specs => STANDARD_SPECS.without_marshallable_value.simplevalues_only.without_persist, :load_value => '::MultiJson.load(value)' }, 'standard_memory_with_snappy_compress' => { :store => :Memory, :options => ':compress => :snappy', :load_value => 'Marshal.load(::Snappy.inflate(value))', :specs => STANDARD_SPECS.without_persist }, 'standard_lruhash' => { :store => :LRUHash, :specs => STANDARD_SPECS.without_persist }, 'standard_lruhash_with_expires' => { :store => :LRUHash, :options => ':expires => true', :specs => STANDARD_SPECS.with_expires.without_persist, }, 'standard_file' => { :store => :File, :options => ':dir => File.join(make_tempdir, "simple_file")', :specs => STANDARD_SPECS }, 'standard_file_with_expires' => { :store => :File, :options => ':dir => File.join(make_tempdir, "simple_file_with_expires"), :expires => true', :specs => STANDARD_SPECS.with_expires }, 'standard_hashfile' => { :store => :HashFile, :options => ':dir => File.join(make_tempdir, "simple_hashfile")', :specs => STANDARD_SPECS }, 'standard_hashfile_with_expires' => { :store => :HashFile, :options => ':dir => File.join(make_tempdir, "simple_hashfile_with_expires"), :expires => true', :specs => STANDARD_SPECS.with_expires }, 'standard_cassandra' => { :store => :Cassandra, :options => ':keyspace => "simple_cassandra"', :specs => STANDARD_SPECS.without_increment.without_create.with_native_expires, }, 'standard_hbase' => { :store => :HBase, :options => ':table => "simple_hbase"', :specs => STANDARD_SPECS.without_create }, 'standard_hbase_with_expires' => { :store => :HBase, :options => ':table => "simple_hbase", :expires => true', :specs => STANDARD_SPECS.with_expires, }, 'standard_dbm' => { :store => :DBM, :options => ':file => File.join(make_tempdir, "simple_dbm")', :specs => STANDARD_SPECS.without_multiprocess }, 'standard_dbm_with_expires' => { :store => :DBM, :options => ':file => File.join(make_tempdir, "simple_dbm_with_expires"), :expires => true', :specs => STANDARD_SPECS.without_multiprocess.with_expires }, 'standard_tdb' => { :store => :TDB, :options => ':file => File.join(make_tempdir, "simple_tdb")', :specs => STANDARD_SPECS.without_multiprocess }, 'standard_tdb_with_expires' => { :store => :TDB, :options => ':file => File.join(make_tempdir, "simple_tdb_with_expires"), :expires => true', :specs => STANDARD_SPECS.without_multiprocess.with_expires }, 'standard_daybreak' => { :store => :Daybreak, :options => ':file => File.join(make_tempdir, "simple_daybreak")', :specs => STANDARD_SPECS.without_multiprocess }, 'standard_daybreak_with_expires' => { :store => :Daybreak, :options => ':file => File.join(make_tempdir, "simple_daybreak_with_expires"), :expires => true', :specs => STANDARD_SPECS.without_multiprocess.with_expires }, 'standard_gdbm' => { :store => :GDBM, :options => ':file => File.join(make_tempdir, "simple_gdbm")', :specs => STANDARD_SPECS.without_multiprocess }, 'standard_gdbm_with_expires' => { :store => :GDBM, :options => ':file => File.join(make_tempdir, "simple_gdbm_with_expires"), :expires => true', :specs => STANDARD_SPECS.without_multiprocess.with_expires }, 'standard_sdbm' => { :store => :SDBM, :options => ':file => File.join(make_tempdir, "simple_sdbm")', :specs => STANDARD_SPECS.without_multiprocess.without_large }, 'standard_sdbm_with_expires' => { :store => :SDBM, :options => ':file => File.join(make_tempdir, "simple_sdbm_with_expires"), :expires => true', :specs => STANDARD_SPECS.without_multiprocess.with_expires.without_large }, 'standard_leveldb' => { :store => :LevelDB, :options => ':dir => File.join(make_tempdir, "simple_leveldb")', :specs => STANDARD_SPECS.without_multiprocess }, 'standard_leveldb_with_expires' => { :store => :LevelDB, :options => ':dir => File.join(make_tempdir, "simple_leveldb_with_expires"), :expires => true', :specs => STANDARD_SPECS.without_multiprocess.with_expires }, 'standard_lmdb' => { :store => :LMDB, :options => ':dir => File.join(make_tempdir, "simple_lmdb")', :specs => STANDARD_SPECS.without_concurrent }, 'standard_lmdb_with_expires' => { :store => :LMDB, :options => ':dir => File.join(make_tempdir, "simple_lmdb_with_expires"), :expires => true', :specs => STANDARD_SPECS.without_concurrent.with_expires }, 'standard_pstore' => { :store => :PStore, :options => ':file => File.join(make_tempdir, "simple_pstore")', :load_value => 'value', :specs => STANDARD_SPECS }, 'standard_pstore_with_expires' => { :store => :PStore, :options => ':file => File.join(make_tempdir, "simple_pstore_with_expires"), :expires => true', :load_value => 'value', :specs => STANDARD_SPECS.with_expires }, 'standard_yaml' => { :store => :YAML, :options => ':file => File.join(make_tempdir, "simple_yaml")', :specs => STANDARD_SPECS.without_marshallable_value.without_concurrent, :load_value => 'value' }, 'standard_yaml_with_expires' => { :store => :YAML, :options => ':file => File.join(make_tempdir, "simple_yaml_with_expires"), :expires => true', :specs => STANDARD_SPECS.without_marshallable_value.with_expires.without_concurrent, :load_value => 'value' }, 'standard_localmemcache' => { :store => :LocalMemCache, :options => ':file => File.join(make_tempdir, "simple_localmemcache")', :specs => STANDARD_SPECS.without_increment.without_create }, 'standard_localmemcache_with_expires' => { :store => :LocalMemCache, :options => ':file => File.join(make_tempdir, "simple_localmemcache_with_expires"), :expires => true', :specs => STANDARD_SPECS.without_increment.without_create.with_expires }, 'standard_tokyocabinet' => { :store => :TokyoCabinet, :options => ':file => File.join(make_tempdir, "simple_tokyocabinet")', :specs => STANDARD_SPECS.without_multiprocess }, 'standard_tokyocabinet_with_expires' => { :store => :TokyoCabinet, :options => ':file => File.join(make_tempdir, "simple_tokyocabinet_with_expires"), :expires => true', :specs => STANDARD_SPECS.without_multiprocess.with_expires }, 'standard_tokyotyrant' => { :store => :TokyoTyrant, :specs => STANDARD_SPECS }, 'standard_tokyotyrant_with_expires' => { :store => :TokyoTyrant, :options => ':expires => true', :specs => STANDARD_SPECS.with_expires }, 'standard_kyotocabinet' => { :store => :KyotoCabinet, :options => ':file => File.join(make_tempdir, "simple_kyotocabinet.kch")', :specs => STANDARD_SPECS.without_multiprocess }, 'standard_kyotocabinet_with_expires' => { :store => :KyotoCabinet, :options => ':file => File.join(make_tempdir, "simple_kyotocabinet_with_expires.kch"), :expires => true', :specs => STANDARD_SPECS.without_multiprocess.with_expires }, 'standard_sqlite' => { :store => :Sqlite, :options => ':file => File.join(make_tempdir, "simple_sqlite")', :specs => STANDARD_SPECS.without_concurrent }, 'standard_sqlite_with_expires' => { :store => :Sqlite, :options => ':file => File.join(make_tempdir, "simple_sqlite_with_expires"), :expires => true', :specs => STANDARD_SPECS.with_expires.without_concurrent }, 'standard_redis' => { :store => :Redis, :specs => STANDARD_SPECS.with_native_expires, }, 'standard_memcached' => { :store => :Memcached, :specs => STANDARD_SPECS.with_native_expires, :options => ':namespace => "simple_memcached"' }, 'standard_memcached_dalli' => { :store => :MemcachedDalli, :specs => STANDARD_SPECS.with_native_expires, :options => ':namespace => "simple_memcached_dalli"' }, 'standard_memcached_native' => { :store => :MemcachedNative, :specs => STANDARD_SPECS.with_native_expires, :options => ':namespace => "simple_memcached_native"' }, 'standard_riak' => { :store => :Riak, :options => ":bucket => 'standard_riak'", # We don't want Riak warnings in tests :preamble => "require 'riak'\n\nRiak.disable_list_keys_warnings = true\n\n", :specs => STANDARD_SPECS.without_increment.without_create }, 'standard_riak_with_expires' => { :store => :Riak, :options => ":bucket => 'standard_riak_with_expires', :expires => true", # We don't want Riak warnings in tests :preamble => "require 'riak'\n\nRiak.disable_list_keys_warnings = true\n\n", :specs => STANDARD_SPECS.without_increment.with_expires.without_create }, 'standard_couch' => { :store => :Couch, :options => ":db => 'standard_couch'", :load_value => '::Marshal.load(value.unpack(\'m\').first)', :specs => STANDARD_SPECS.without_increment }, 'standard_couch_with_expires' => { :store => :Couch, :options => ":db => 'standard_couch_with_expires', :expires => true", :specs => STANDARD_SPECS.without_increment.with_expires, :load_value => '::Marshal.load(value.unpack(\'m\').first)' }, 'standard_mongo' => { :store => :Mongo, :options => ":db => 'standard_mongo'", :specs => STANDARD_SPECS.with_native_expires }, 'standard_null' => { :store => :Null, :specs => STANDARD_SPECS.without_increment.without_create.without_store.without_persist }, 'null_adapter' => { :build => 'Moneta::Adapters::Null.new', :specs => Specs.new(:specs => [:null, :not_increment, :not_create, :not_persist]) }, 'standard_sequel' => { :store => :Sequel, :options => ':db => (defined?(JRUBY_VERSION) ? "jdbc:mysql://localhost/moneta?user=root" : "mysql2://root:@localhost/moneta"), :table => "simple_sequel"', :load_value => '::Marshal.load(value)', :specs => STANDARD_SPECS }, 'standard_sequel_with_expires' => { :store => :Sequel, :options => ':db => (defined?(JRUBY_VERSION) ? "jdbc:mysql://localhost/moneta?user=root" : "mysql2://root:@localhost/moneta"), :table => "simple_sequel_with_expires", :expires => true', :specs => STANDARD_SPECS.with_expires, :load_value => '::Marshal.load(value)' }, 'standard_datamapper' => { :store => :DataMapper, :specs => STANDARD_SPECS.without_increment, :options => ':setup => "mysql://root:@localhost/moneta", :table => "simple_datamapper"', # DataMapper needs default repository to be setup :preamble => "require 'dm-core'\nDataMapper.setup(:default, :adapter => :in_memory)\n", :load_value => '::Marshal.load(value.unpack(\'m\').first)' }, 'standard_datamapper_with_expires' => { :store => :DataMapper, :options => ':setup => "mysql://root:@localhost/moneta", :table => "simple_datamapper_with_expires", :expires => true', # DataMapper needs default repository to be setup :preamble => "require 'dm-core'\nDataMapper.setup(:default, :adapter => :in_memory)\n", :specs => STANDARD_SPECS.without_increment.with_expires, :load_value => '::Marshal.load(value.unpack(\'m\').first)' }, 'standard_datamapper_with_repository' => { :store => :DataMapper, :specs => STANDARD_SPECS.without_increment, :options => ':repository => :repo, :setup => "mysql://root:@localhost/moneta", :table => "simple_datamapper_with_repository"', # DataMapper needs default repository to be setup :preamble => "require 'dm-core'\nDataMapper.setup(:default, :adapter => :in_memory)\n", :load_value => '::Marshal.load(value.unpack(\'m\').first)' }, 'standard_activerecord' => { :store => :ActiveRecord, :specs => STANDARD_SPECS, :options => ":table => 'standard_activerecord', :connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :database => 'moneta', :username => 'root' }", :load_value => '::Marshal.load(value.unpack(\'m\').first)' }, 'standard_activerecord_with_expires' => { :store => :ActiveRecord, :options => ":table => 'standard_activerecord_with_expires', :connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :database => 'moneta', :username => 'root' }, :expires => true", :specs => STANDARD_SPECS.with_expires, :load_value => '::Marshal.load(value.unpack(\'m\').first)' }, 'standard_fog' => { :store => :Fog, :specs => STANDARD_SPECS.without_increment.without_create, :options => ":aws_access_key_id => 'fake_access_key_id', :aws_secret_access_key => 'fake_secret_access_key', :provider => 'AWS', :dir => 'standard_fog'", # Put Fog into testing mode :preamble => "require 'fog'\nFog.mock!\n" }, 'standard_fog_with_expires' => { :store => :Fog, :options => ":aws_access_key_id => 'fake_access_key_id', :aws_secret_access_key => 'fake_secret_access_key', :provider => 'AWS', :dir => 'standard_fog_with_expires', :expires => true", # Put Fog into testing mode :preamble => "require 'fog'\nFog.mock!\n", :specs => STANDARD_SPECS.without_increment.without_create.with_expires }, 'weak_create' => { # Put Fog into testing mode :preamble => "require 'fog'\nFog.mock!\n", :build => %{Moneta.build do use :WeakCreate adapter :Fog, :aws_access_key_id => 'fake_access_key_id', :aws_secret_access_key => 'fake_secret_access_key', :provider => 'AWS', :dir => 'weak_create' end}, :specs => ADAPTER_SPECS.without_increment.without_concurrent.returnsame }, 'weak_increment' => { # Put Fog into testing mode :preamble => "require 'fog'\nFog.mock!\n", :build => %{Moneta.build do use :WeakIncrement adapter :Fog, :aws_access_key_id => 'fake_access_key_id', :aws_secret_access_key => 'fake_secret_access_key', :provider => 'AWS', :dir => 'weak_increment' end}, :specs => ADAPTER_SPECS.without_create.without_concurrent.returnsame }, 'expires_memory' => { :build => %{Moneta.build do use :Expires adapter :Memory end}, :specs => STANDARD_SPECS.without_transform.with_expires.without_persist.returnsame }, 'expires_memory_with_default_expires' => { :build => %{Moneta.build do use :Expires, :expires => 1 adapter :Memory end}, :specs => STANDARD_SPECS.without_transform.with_expires.with_default_expires.without_persist.returnsame }, 'expires_file' => { :build => %{Moneta.build do use :Expires use :Transformer, :key => [:marshal, :escape], :value => :marshal adapter :File, :dir => File.join(make_tempdir, "expires-file") end}, :specs => STANDARD_SPECS.with_expires.stringvalues_only, :tests => %{ it 'deletes expired value in underlying file storage' do store.store('foo', 'bar', :expires => 2) store['foo'].should == 'bar' sleep 1 store['foo'].should == 'bar' sleep 2 store['foo'].should be_nil store.adapter['foo'].should be_nil store.adapter.adapter['foo'].should be_nil end } }, 'proxy_redis' => { :build => %{Moneta.build do use :Proxy use :Proxy adapter :Redis end}, :specs => ADAPTER_SPECS.with_expires }, 'proxy_expires_memory' => { :build => %{Moneta.build do use :Proxy use :Expires use :Proxy adapter :Memory end}, :specs => STANDARD_SPECS.without_transform.with_expires.returnsame.without_persist }, 'cache_file_memory' => { :build => %{Moneta.build do use(:Cache) do adapter { adapter :File, :dir => File.join(make_tempdir, "cache_file_memory") } cache { adapter :Memory } end end}, :specs => ADAPTER_SPECS.returnsame, :tests => %{ it 'stores loaded values in cache' do store.adapter['foo'] = 'bar' store.cache['foo'].should be_nil store['foo'].should == 'bar' store.cache['foo'].should == 'bar' store.adapter.delete('foo') store['foo'].should == 'bar' store.delete('foo') store['foo'].should be_nil end } }, 'cache_memory_null' => { :build => %{Moneta.build do use(:Cache) do adapter(Moneta::Adapters::Memory.new) cache(Moneta::Adapters::Null.new) end end}, :specs => ADAPTER_SPECS.without_persist.returnsame }, 'shared_tcp' => { :build => %{Moneta.build do use(:Shared, :port => 9001) do adapter :PStore, :file => File.join(make_tempdir, 'shared_tcp') end end}, :specs => ADAPTER_SPECS, :tests => %{ it 'shares values' do store['shared_key'] = 'shared_value' second = new_store second.key?('shared_key').should be_true second['shared_key'].should == 'shared_value' second.close end } }, 'shared_unix' => { :build => %{Moneta.build do use(:Shared, :socket => File.join(make_tempdir, 'shared_unix.socket')) do adapter :PStore, :file => File.join(make_tempdir, 'shared_unix') end end}, :specs => ADAPTER_SPECS, :tests => %{ it 'shares values' do store['shared_key'] = 'shared_value' second = new_store second.key?('shared_key').should be_true second['shared_key'].should == 'shared_value' second.close end } }, 'stack_file_memory' => { :build => %{Moneta.build do use(:Stack) do add(Moneta.new(:Null)) add(Moneta::Adapters::Null.new) add { adapter :File, :dir => File.join(make_tempdir, "stack_file_memory") } add { adapter :Memory } end end}, :specs => ADAPTER_SPECS.without_increment.without_create }, 'stack_memory_file' => { :build => %{Moneta.build do use(:Stack) do add { adapter :Memory } add { adapter :File, :dir => File.join(make_tempdir, "stack_memory_file") } end end}, :specs => ADAPTER_SPECS.returnsame }, 'lock' => { :build => %{Moneta.build do use :Lock adapter :Memory end}, :specs => STANDARD_SPECS.without_transform.returnsame.without_persist }, 'pool' => { :build => %{Moneta.build do use :Pool do adapter :File, :dir => File.join(make_tempdir, "pool") end end}, :specs => ADAPTER_SPECS }, 'transformer_zlib' => { :build => %{Moneta.build do use :Transformer, :value => :zlib adapter :Memory end}, :specs => TRANSFORMER_SPECS.stringvalues_only, :load_value => '::Zlib::Inflate.inflate(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::ZlibValue.should_not be_nil end} }, 'transformer_bzip2' => { :build => %{Moneta.build do use :Transformer, :value => :bzip2 adapter :Memory end}, :specs => TRANSFORMER_SPECS.stringvalues_only, :load_value => '::Bzip2.uncompress(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::Bzip2Value.should_not be_nil end} }, 'transformer_lzo' => { :build => %{Moneta.build do use :Transformer, :value => :lzo adapter :Memory end}, :specs => TRANSFORMER_SPECS.stringvalues_only, :load_value => '::LZO.decompress(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::LzoValue.should_not be_nil end} }, 'transformer_lz4' => { :build => %{Moneta.build do use :Transformer, :value => :lz4 adapter :Memory end}, :specs => TRANSFORMER_SPECS.stringvalues_only, :load_value => '::LZ4.uncompress(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::Lz4Value.should_not be_nil end} }, 'transformer_lzma' => { :build => %{Moneta.build do use :Transformer, :value => :lzma adapter :Memory end}, :specs => TRANSFORMER_SPECS.stringvalues_only, :load_value => '::LZMA.decompress(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::LzmaValue.should_not be_nil end} }, 'transformer_snappy' => { :build => %{Moneta.build do use :Transformer, :value => :snappy adapter :Memory end}, :specs => TRANSFORMER_SPECS.stringvalues_only, :load_value => '::Snappy.inflate(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::SnappyValue.should_not be_nil end} }, 'transformer_quicklz' => { :build => %{Moneta.build do use :Transformer, :value => :quicklz adapter :Memory end}, :specs => TRANSFORMER_SPECS.stringvalues_only, :load_value => '::QuickLZ.decompress(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::QuicklzValue.should_not be_nil end} }, 'transformer_json' => { :build => %{Moneta.build do use :Transformer, :key => :json, :value => :json adapter :Memory end}, :specs => TRANSFORMER_SPECS.simplekeys_only.simplevalues_only, :load_value => '::MultiJson.load(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::JsonKeyJsonValue.should_not be_nil end} }, 'transformer_bert' => { :build => %{Moneta.build do use :Transformer, :key => :bert, :value => :bert adapter :Memory end}, :specs => TRANSFORMER_SPECS.simplekeys_only.simplevalues_only, :load_value => '::BERT.decode(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::BertKeyBertValue.should_not be_nil end} }, 'transformer_bencode' => { :build => %{Moneta.build do use :Transformer, :key => :bencode, :value => :bencode adapter :Memory end}, :specs => TRANSFORMER_SPECS.simplekeys_only.simplevalues_only, :load_value => '::BEncode.load(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::BencodeKeyBencodeValue.should_not be_nil end} }, 'transformer_bson' => { :build => %{Moneta.build do use :Transformer, :key => :bson, :value => :bson adapter :Memory end}, :specs => TRANSFORMER_SPECS.simplekeys_only.simplevalues_only, :load_value => "::BSON.deserialize(value)['v']", :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::BsonKeyBsonValue.should_not be_nil end} }, 'transformer_ox' => { :build => %{Moneta.build do use :Transformer, :key => :ox, :value => :ox adapter :Memory end}, :specs => TRANSFORMER_SPECS, :load_value => '::Ox.parse_obj(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::OxKeyOxValue.should_not be_nil end} }, 'transformer_php' => { :build => %{Moneta.build do use :Transformer, :key => :php, :value => :php adapter :Memory end}, :specs => TRANSFORMER_SPECS.simplekeys_only.simplevalues_only, :load_value => '::PHP.unserialize(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::PhpKeyPhpValue.should_not be_nil end} }, 'transformer_tnet' => { :build => %{Moneta.build do use :Transformer, :key => :tnet, :value => :tnet adapter :Memory end}, :specs => TRANSFORMER_SPECS.simplekeys_only.simplevalues_only, :load_value => '::TNetstring.parse(value).first', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::TnetKeyTnetValue.should_not be_nil end} }, 'transformer_msgpack' => { :build => %{Moneta.build do use :Transformer, :key => :msgpack, :value => :msgpack adapter :Memory end}, :specs => TRANSFORMER_SPECS.simplekeys_only.simplevalues_only, :load_value => '::MessagePack.unpack(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MsgpackKeyMsgpackValue.should_not be_nil end} }, 'transformer_marshal' => { :build => %{Moneta.build do use :Transformer, :key => :marshal, :value => :marshal adapter :Memory end}, :specs => TRANSFORMER_SPECS, :load_value => '::Marshal.load(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalKeyMarshalValue.should_not be_nil end} }, 'transformer_key_marshal' => { :build => %{Moneta.build do use :Transformer, :key => :marshal adapter :Memory end}, :specs => TRANSFORMER_SPECS.returnsame, :load_value => 'value', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalKey.should_not be_nil end} }, 'transformer_key_to_s' => { :build => %{Moneta.build do use :Transformer, :key => :to_s adapter :Memory end}, :specs => TRANSFORMER_SPECS.returnsame.simplekeys_only, :load_value => 'value', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::To_sKey.should_not be_nil end} }, 'transformer_key_inspect' => { :build => %{Moneta.build do use :Transformer, :key => :inspect adapter :Memory end}, :specs => TRANSFORMER_SPECS.returnsame.simplekeys_only, :load_value => 'value', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::InspectKey.should_not be_nil end} }, 'transformer_value_marshal' => { :build => %{Moneta.build do use :Transformer, :value => :marshal adapter :Memory end}, :specs => TRANSFORMER_SPECS, :load_value => '::Marshal.load(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalValue.should_not be_nil end} }, 'transformer_yaml' => { :build => %{Moneta.build do use :Transformer, :key => :yaml, :value => :yaml adapter :Memory end}, :specs => TRANSFORMER_SPECS, :load_value => '::YAML.load(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::YamlKeyYamlValue.should_not be_nil end} }, 'transformer_key_yaml' => { :build => %{Moneta.build do use :Transformer, :key => :yaml adapter :Memory end}, :specs => TRANSFORMER_SPECS.returnsame, :load_value => 'value', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::YamlKey.should_not be_nil end} }, 'transformer_value_yaml' => { :build => %{Moneta.build do use :Transformer, :value => :yaml adapter :Memory end}, :specs => TRANSFORMER_SPECS, :load_value => '::YAML.load(value)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::YamlValue.should_not be_nil end} }, 'transformer_marshal_hmac' => { :build => %{Moneta.build do use :Transformer, :key => :marshal, :value => [:marshal, :hmac], :secret => 'secret' adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :load_value => '::Marshal.load(::Moneta::Transformer::Helper.hmacverify(value, \'secret\'))', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalKeyMarshalHmacValue.should_not be_nil end} }, 'transformer_marshal_base64' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :base64], :value => [:marshal, :base64] adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :load_value => '::Marshal.load(value.unpack(\'m\').first)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalBase64KeyMarshalBase64Value.should_not be_nil end} }, 'transformer_marshal_hex' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :hex], :value => [:marshal, :hex] adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :load_value => '::Marshal.load([value].pack(\'H*\'))', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalHexKeyMarshalHexValue.should_not be_nil end} }, 'transformer_marshal_prefix' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :prefix], :value => :marshal, :prefix => 'moneta' adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalPrefixKeyMarshalValue.should_not be_nil end} }, 'transformer_marshal_uuencode' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :uuencode], :value => [:marshal, :uuencode] adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :load_value => '::Marshal.load(value.unpack(\'u\').first)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalUuencodeKeyMarshalUuencodeValue.should_not be_nil end} }, 'transformer_marshal_qp' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :qp], :value => [:marshal, :qp] adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :load_value => '::Marshal.load(value.unpack(\'M\').first)', :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalQpKeyMarshalQpValue.should_not be_nil end} }, 'transformer_marshal_escape' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :escape], :value => :marshal adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalEscapeKeyMarshalValue.should_not be_nil end} }, 'transformer_marshal_md5' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :md5], :value => :marshal adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalMd5KeyMarshalValue.should_not be_nil end} }, 'transformer_marshal_sha1' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :sha1], :value => :marshal adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalSha1KeyMarshalValue.should_not be_nil end} }, 'transformer_marshal_sha256' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :sha256], :value => :marshal adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalSha256KeyMarshalValue.should_not be_nil end} }, 'transformer_marshal_sha384' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :sha384], :value => :marshal adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalSha384KeyMarshalValue.should_not be_nil end} }, 'transformer_marshal_sha512' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :sha512], :value => :marshal adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalSha512KeyMarshalValue.should_not be_nil end} }, 'transformer_marshal_rmd160' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :rmd160], :value => :marshal adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalRmd160KeyMarshalValue.should_not be_nil end} }, 'transformer_marshal_md5_spread' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :md5, :spread], :value => :marshal adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalMd5SpreadKeyMarshalValue.should_not be_nil end} }, 'transformer_marshal_city32' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :city32], :value => :marshal adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalCity32KeyMarshalValue.should_not be_nil end} }, 'transformer_marshal_city64' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :city64], :value => :marshal adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalCity64KeyMarshalValue.should_not be_nil end} }, 'transformer_marshal_city128' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :city128], :value => :marshal adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalCity128KeyMarshalValue.should_not be_nil end} }, 'transformer_marshal_truncate' => { :build => %{Moneta.build do use :Transformer, :key => [:marshal, :truncate], :value => :marshal, :maxlen => 64 adapter :Memory end}, :specs => STANDARD_SPECS.without_persist, :tests => %{ it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalTruncateKeyMarshalValue.should_not be_nil end} }, 'adapter_activerecord' => { :build => "Moneta::Adapters::ActiveRecord.new(:table => 'adapter_activerecord', :connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :database => 'moneta', :username => 'root' })", :specs => ADAPTER_SPECS, :tests => %{ it 'updates an existing key/value' do store['foo/bar'] = '1' store['foo/bar'] = '2' store.table.where(:k => 'foo/bar').count.should == 1 end it 'supports different tables same database' do store1 = Moneta::Adapters::ActiveRecord.new(:table => 'adapter_activerecord1', :connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :database => 'moneta', :username => 'root' }) store2 = Moneta::Adapters::ActiveRecord.new(:table => 'adapter_activerecord2', :connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :database => 'moneta', :username => 'root' }) store1['key'] = 'value1' store2['key'] = 'value2' store1['key'].should == 'value1' store2['key'].should == 'value2' store1.close store2.close end it 'supports different databases same table' do store1 = Moneta::Adapters::ActiveRecord.new(:table => 'adapter_activerecord', :connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :database => 'moneta_activerecord1', :username => 'root' }) store2 = Moneta::Adapters::ActiveRecord.new(:table => 'adapter_activerecord', :connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :database => 'moneta_activerecord2', :username => 'root' }) store1['key'] = 'value1' store2['key'] = 'value2' store1['key'].should == 'value1' store2['key'].should == 'value2' store1.close store2.close end} }, 'adapter_activerecord_exisiting_connection' => { :preamble => "require 'active_record'\nActiveRecord::Base.establish_connection :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :database => 'moneta', :username => 'root'\n", :build => "Moneta::Adapters::ActiveRecord.new(:table => 'adapter_activerecord_existing_connection')", :specs => ADAPTER_SPECS }, 'adapter_client' => { :preamble => "start_server(Moneta::Adapters::Memory.new)\n", :build => "Moneta::Adapters::Client.new", :specs => ADAPTER_SPECS }, 'adapter_restclient' => { :preamble => "start_restserver\n", :build => "Moneta::Adapters::RestClient.new(:url => 'http://localhost:8808/moneta/')", :specs => ADAPTER_SPECS.without_increment.without_create }, 'adapter_cassandra' => { :build => "Moneta::Adapters::Cassandra.new(:keyspace => 'adapter_cassandra')", :specs => ADAPTER_SPECS.without_increment.without_create.with_native_expires }, 'adapter_cassandra_with_default_expires' => { :build => %{Moneta::Adapters::Cassandra.new(:keyspace => 'adapter_cassandra_with_default_expires', :expires => 1)}, :specs => ADAPTER_SPECS.without_increment.without_create.with_native_expires.with_default_expires }, 'adapter_hbase' => { :build => "Moneta::Adapters::HBase.new(:table => 'adapter_hbase')", :specs => ADAPTER_SPECS.without_create }, 'adapter_cookie' => { :build => 'Moneta::Adapters::Cookie.new', :specs => ADAPTER_SPECS.without_persist.returnsame }, 'adapter_couch' => { :build => "Moneta::Adapters::Couch.new(:db => 'adapter_couch')", :specs => ADAPTER_SPECS.without_increment.simplevalues_only.without_path }, 'adapter_datamapper' => { :build => 'Moneta::Adapters::DataMapper.new(:setup => "mysql://root:@localhost/moneta", :table => "adapter_datamapper")', # DataMapper needs default repository to be setup :preamble => "require 'dm-core'\nDataMapper.setup(:default, :adapter => :in_memory)\n", :specs => ADAPTER_SPECS.without_increment, :tests => %q{ it 'does not cross contaminate when storing' do first = Moneta::Adapters::DataMapper.new(:setup => "mysql://root:@localhost/moneta", :table => "datamapper_first") first.clear second = Moneta::Adapters::DataMapper.new(:repository => :sample, :setup => "mysql://root:@localhost/moneta", :table => "datamapper_second") second.clear first['key'] = 'value' second['key'] = 'value2' first['key'].should == 'value' second['key'].should == 'value2' end it 'does not cross contaminate when deleting' do first = Moneta::Adapters::DataMapper.new(:setup => "mysql://root:@localhost/moneta", :table => "datamapper_first") first.clear second = Moneta::Adapters::DataMapper.new(:repository => :sample, :setup => "mysql://root:@localhost/moneta", :table => "datamapper_second") second.clear first['key'] = 'value' second['key'] = 'value2' first.delete('key').should == 'value' first.key?('key').should be_false second['key'].should == 'value2' end } }, 'adapter_dbm' => { :build => 'Moneta::Adapters::DBM.new(:file => File.join(make_tempdir, "adapter_dbm"))', :specs => ADAPTER_SPECS.without_multiprocess }, 'adapter_tdb' => { :build => 'Moneta::Adapters::TDB.new(:file => File.join(make_tempdir, "adapter_tdb"))', :specs => ADAPTER_SPECS.without_multiprocess }, 'adapter_daybreak' => { :build => 'Moneta::Adapters::Daybreak.new(:file => File.join(make_tempdir, "adapter_daybreak"))', :specs => ADAPTER_SPECS.without_multiprocess.returnsame }, 'adapter_file' => { :build => 'Moneta::Adapters::File.new(:dir => File.join(make_tempdir, "adapter_file"))', :specs => ADAPTER_SPECS }, 'adapter_fog' => { :build => "Moneta::Adapters::Fog.new(:aws_access_key_id => 'fake_access_key_id', :aws_secret_access_key => 'fake_secret_access_key', :provider => 'AWS', :dir => 'adapter_fog')", # Put Fog into testing mode :preamble => "require 'fog'\nFog.mock!\n", # Fog returns same object in mocking mode (in-memory store) :specs => ADAPTER_SPECS.without_increment.without_create.returnsame }, 'adapter_gdbm' => { :build => 'Moneta::Adapters::GDBM.new(:file => File.join(make_tempdir, "adapter_gdbm"))', :specs => ADAPTER_SPECS.without_multiprocess }, 'adapter_localmemcache' => { :build => 'Moneta::Adapters::LocalMemCache.new(:file => File.join(make_tempdir, "adapter_localmemcache"))', :specs => ADAPTER_SPECS.without_increment.without_create }, 'adapter_memcached_dalli' => { :build => 'Moneta::Adapters::MemcachedDalli.new(:namespace => "adapter_memcached_dalli")', :specs => ADAPTER_SPECS.with_native_expires }, 'adapter_memcached_dalli_with_default_expires' => { :build => %{Moneta::Adapters::MemcachedDalli.new(:expires => 1)}, :specs => ADAPTER_SPECS.with_native_expires.with_default_expires }, 'adapter_memcached_native' => { :build => 'Moneta::Adapters::MemcachedNative.new(:namespace => "adapter_memcached_native")', :specs => ADAPTER_SPECS.with_native_expires }, 'adapter_memcached_native_with_default_expires' => { :build => %{Moneta::Adapters::MemcachedNative.new(:expires => 1)}, :specs => ADAPTER_SPECS.with_native_expires.with_default_expires }, 'adapter_memcached' => { :build => 'Moneta::Adapters::Memcached.new(:namespace => "adapter_memcached")', :specs => ADAPTER_SPECS.with_native_expires }, 'adapter_memcached_with_default_expires' => { :build => %{Moneta::Adapters::Memcached.new(:expires => 1)}, :specs => ADAPTER_SPECS.with_native_expires.with_default_expires }, 'adapter_memory' => { :build => 'Moneta::Adapters::Memory.new', :specs => STANDARD_SPECS.without_transform.returnsame.without_persist }, 'adapter_lruhash' => { :build => 'Moneta::Adapters::LRUHash.new', :specs => ADAPTER_SPECS.without_persist.returnsame, :tests => %{ it 'deletes oldest' do store = Moneta::Adapters::LRUHash.new(:max_size => 10) store[0] = 'y' (1..1000).each do |i| store[i] = 'x' store[0].should == 'y' store.instance_variable_get(:@entry).size.should == [10, i+1].min (0...[9, i-1].min).each do |j| store.instance_variable_get(:@entry)[i-j].should_not be_nil end store.key?(i-9).should be_false if i > 9 end end} }, 'adapter_mongo' => { :build => 'Moneta::Adapters::Mongo.new(:db => "adapter_mongo")', :specs => ADAPTER_SPECS.with_native_expires.simplevalues_only, :tests => %{ it 'automatically deletes expired document' do store.store('key', 'val', :expires => 5) store.instance_variable_get(:@collection).find_one('_id' => ::BSON::Binary.new('key')).should_not be_nil sleep 70 # Mongo needs up to 60 seconds store.instance_variable_get(:@collection).find_one('_id' => ::BSON::Binary.new('key')).should be_nil end} }, 'adapter_mongo_with_default_expires' => { :build => %{Moneta::Adapters::Mongo.new(:expires => 1)}, :specs => ADAPTER_SPECS.with_expires.with_default_expires.simplevalues_only }, 'adapter_pstore' => { :build => 'Moneta::Adapters::PStore.new(:file => File.join(make_tempdir, "adapter_pstore"))', :specs => STANDARD_SPECS.without_transform }, 'adapter_redis' => { :build => 'Moneta::Adapters::Redis.new', :specs => ADAPTER_SPECS.with_native_expires }, 'adapter_redis_with_default_expires' => { :build => %{Moneta::Adapters::Redis.new(:expires => 1)}, :specs => ADAPTER_SPECS.with_native_expires.with_default_expires }, 'adapter_riak' => { :build => 'Moneta::Adapters::Riak.new', :options => ":bucket => 'adapter_riak'", :specs => ADAPTER_SPECS.without_increment.without_create, # We don't want Riak warnings in tests :preamble => "require 'riak'\n\nRiak.disable_list_keys_warnings = true\n\n" }, 'adapter_sdbm' => { :build => 'Moneta::Adapters::SDBM.new(:file => File.join(make_tempdir, "adapter_sdbm"))', :specs => ADAPTER_SPECS.without_multiprocess.without_large }, 'adapter_lmdb' => { :build => 'Moneta::Adapters::LMDB.new(:dir => File.join(make_tempdir, "adapter_lmdb"))', :specs => ADAPTER_SPECS.without_concurrent }, 'adapter_lmdb_with_db' => { :build => 'Moneta::Adapters::LMDB.new(:dir => File.join(make_tempdir, "adapter_lmdb"), :db => "adapter_lmdb_with_db")', :specs => ADAPTER_SPECS.without_concurrent }, 'adapter_leveldb' => { :build => 'Moneta::Adapters::LevelDB.new(:dir => File.join(make_tempdir, "adapter_leveldb"))', :specs => ADAPTER_SPECS.without_multiprocess }, 'adapter_sequel' => { :build => 'Moneta::Adapters::Sequel.new(:db => (defined?(JRUBY_VERSION) ? "jdbc:mysql://localhost/moneta?user=root" : "mysql2://root:@localhost/moneta"), :table => "adapter_sequel")', :specs => ADAPTER_SPECS }, 'adapter_sqlite' => { :build => 'Moneta::Adapters::Sqlite.new(:file => File.join(make_tempdir, "adapter_sqlite"))', :specs => ADAPTER_SPECS.without_concurrent }, 'adapter_kyotocabinet' => { :build => 'Moneta::Adapters::KyotoCabinet.new(:file => File.join(make_tempdir, "adapter_kyotocabinet.kch"))', :specs => ADAPTER_SPECS.without_multiprocess }, 'adapter_tokyocabinet_bdb' => { :build => 'Moneta::Adapters::TokyoCabinet.new(:file => File.join(make_tempdir, "adapter_tokyocabinet_bdb"), :type => :bdb)', :specs => ADAPTER_SPECS.without_multiprocess }, 'adapter_tokyocabinet_hdb' => { :build => 'Moneta::Adapters::TokyoCabinet.new(:file => File.join(make_tempdir, "adapter_tokyocabinet_hdb"), :type => :hdb)', :specs => ADAPTER_SPECS.without_multiprocess }, 'adapter_tokyotyrant' => { :build => 'Moneta::Adapters::TokyoTyrant.new', :specs => ADAPTER_SPECS }, 'adapter_yaml' => { :build => 'Moneta::Adapters::YAML.new(:file => File.join(make_tempdir, "adapter_yaml"))', :specs => STANDARD_SPECS.simplevalues_only.simplekeys_only.without_transform.without_concurrent }, 'mutex' => { :store => :Memory, :specs => Specs.new, :tests => %{ it 'should have #lock' do mutex = Moneta::Mutex.new(store, 'mutex') mutex.lock.should be_true mutex.locked?.should be_true expect do mutex.lock end.to raise_error(RuntimeError) expect do mutex.try_lock end.to raise_error(RuntimeError) mutex.unlock.should be_nil mutex.locked?.should be_false end it 'should have #enter' do mutex = Moneta::Mutex.new(store, 'mutex') mutex.enter.should be_true mutex.locked?.should be_true expect do mutex.enter end.to raise_error(RuntimeError) expect do mutex.try_enter end.to raise_error(RuntimeError) mutex.leave.should be_nil mutex.locked?.should be_false end it 'should lock with #lock' do a = Moneta::Mutex.new(store, 'mutex') b = Moneta::Mutex.new(store, 'mutex') a.lock.should be_true b.try_lock.should be_false a.unlock.should be_nil end it 'should have lock timeout' do a = Moneta::Mutex.new(store, 'mutex') b = Moneta::Mutex.new(store, 'mutex') a.lock.should be_true b.lock(1).should be_false a.unlock.should be_nil end it 'should have #synchronize' do mutex = Moneta::Mutex.new(store, 'mutex') mutex.synchronize do mutex.locked?.should be_true end mutex.locked?.should be_false end } }, 'semaphore' => { :store => :Memory, :specs => Specs.new, :tests => %{ it 'should have #lock' do mutex = Moneta::Semaphore.new(store, 'semaphore') mutex.lock.should be_true mutex.locked?.should be_true expect do mutex.lock end.to raise_error(RuntimeError) expect do mutex.try_lock end.to raise_error(RuntimeError) mutex.unlock.should be_nil mutex.locked?.should be_false end it 'should have #enter' do mutex = Moneta::Semaphore.new(store, 'semaphore') mutex.enter.should be_true mutex.locked?.should be_true expect do mutex.enter end.to raise_error(RuntimeError) expect do mutex.try_enter end.to raise_error(RuntimeError) mutex.leave.should be_nil mutex.locked?.should be_false end it 'should lock with #lock' do a = Moneta::Semaphore.new(store, 'semaphore') b = Moneta::Semaphore.new(store, 'semaphore') a.lock.should be_true b.try_lock.should be_false a.unlock.should be_nil end it 'should have lock timeout' do a = Moneta::Semaphore.new(store, 'semaphore') b = Moneta::Semaphore.new(store, 'semaphore') a.lock.should be_true b.lock(1).should be_false a.unlock.should be_nil end it 'should count concurrent accesses' do a = Moneta::Semaphore.new(store, 'semaphore', 2) b = Moneta::Semaphore.new(store, 'semaphore', 2) c = Moneta::Semaphore.new(store, 'semaphore', 2) a.synchronize do a.locked?.should be_true b.synchronize do b.locked?.should be_true c.try_lock.should be_false end end end it 'should have #synchronize' do semaphore = Moneta::Semaphore.new(store, 'semaphore') semaphore.synchronize do semaphore.locked?.should be_true end semaphore.locked?.should be_false end } }, 'optionmerger' => { :store => :Memory, :specs => Specs.new, :tests => %{ it '#with should return OptionMerger' do options = {:optionname => :optionvalue} merger = store.with(options) merger.should be_instance_of(Moneta::OptionMerger) end it 'saves default options' do options = {:optionname => :optionvalue} merger = store.with(options) Moneta::OptionMerger::METHODS.each do |method| merger.default_options[method].should equal(options) end end PREFIX = [['alpha', nil], ['beta', nil], ['alpha', 'beta']] it 'merges options' do merger = store.with(:opt1 => :val1, :opt2 => :val2).with(:opt2 => :overwrite, :opt3 => :val3) Moneta::OptionMerger::METHODS.each do |method| merger.default_options[method].should == {:opt1 => :val1, :opt2 => :overwrite, :opt3 => :val3} end end it 'merges options only for some methods' do PREFIX.each do |(alpha,beta)| options = {:opt1 => :val1, :opt2 => :val2, :prefix => alpha} merger = store.with(options).with(:opt2 => :overwrite, :opt3 => :val3, :prefix => beta, :only => :clear) (Moneta::OptionMerger::METHODS - [:clear]).each do |method| merger.default_options[method].should equal(options) end merger.default_options[:clear].should == {:opt1 => :val1, :opt2 => :overwrite, :opt3 => :val3, :prefix => "\#{alpha}\#{beta}"} merger = store.with(options).with(:opt2 => :overwrite, :opt3 => :val3, :prefix => beta, :only => [:load, :store]) (Moneta::OptionMerger::METHODS - [:load, :store]).each do |method| merger.default_options[method].should equal(options) end merger.default_options[:load].should == {:opt1 => :val1, :opt2 => :overwrite, :opt3 => :val3, :prefix => "\#{alpha}\#{beta}"} merger.default_options[:store].should == {:opt1 => :val1, :opt2 => :overwrite, :opt3 => :val3, :prefix => "\#{alpha}\#{beta}"} end end it 'merges options except for some methods' do PREFIX.each do |(alpha,beta)| options = {:opt1 => :val1, :opt2 => :val2, :prefix => alpha} merger = store.with(options).with(:opt2 => :overwrite, :opt3 => :val3, :except => :clear, :prefix => beta) (Moneta::OptionMerger::METHODS - [:clear]).each do |method| merger.default_options[method].should == {:opt1 => :val1, :opt2 => :overwrite, :opt3 => :val3, :prefix => "\#{alpha}\#{beta}"} end merger.default_options[:clear].should equal(options) merger = store.with(options).with(:opt2 => :overwrite, :opt3 => :val3, :prefix => beta, :except => [:load, :store]) (Moneta::OptionMerger::METHODS - [:load, :store]).each do |method| merger.default_options[method].should == {:opt1 => :val1, :opt2 => :overwrite, :opt3 => :val3, :prefix => "\#{alpha}\#{beta}"} end merger.default_options[:load].should equal(options) merger.default_options[:store].should equal(options) end end it 'has method #raw' do store.raw.default_options.should == {:store=>{:raw=>true},:create=>{:raw=>true},:load=>{:raw=>true},:delete=>{:raw=>true}} store.raw.should equal(store.raw.raw) end it 'has method #expires' do store.expires(10).default_options.should == {:store=>{:expires=>10},:create=>{:expires=>10},:increment=>{:expires=>10}} end it 'has method #prefix' do store.prefix('a').default_options.should == {:store=>{:prefix=>'a'},:load=>{:prefix=>'a'},:create=>{:prefix=>'a'}, :delete=>{:prefix=>'a'},:key? => {:prefix=>'a'},:increment=>{:prefix=>'a'}} store.prefix('a').prefix('b').default_options.should == {:store=>{:prefix=>'ab'},:load=>{:prefix=>'ab'},:create=>{:prefix=>'ab'}, :delete=>{:prefix=>'ab'},:key? => {:prefix=>'ab'},:increment=>{:prefix=>'ab'}} store.raw.prefix('b').default_options.should == {:store=>{:raw=>true,:prefix=>'b'},:load=>{:raw=>true,:prefix=>'b'},:create=>{:raw=>true,:prefix=>'b'},:delete=>{:raw=>true,:prefix=>'b'},:key? => {:prefix=>'b'},:increment=>{:prefix=>'b'}} store.prefix('a').raw.default_options.should == {:store=>{:raw=>true,:prefix=>'a'},:load=>{:raw=>true,:prefix=>'a'},:create=>{:raw=>true,:prefix=>'a'},:delete=>{:raw=>true,:prefix=>'a'},:key? => {:prefix=>'a'},:increment=>{:prefix=>'a'}} end it 'supports adding proxis using #with' do compressed_store = store.with(:prefix => 'compressed') do use :Transformer, :value => :zlib end store['key'] = 'uncompressed value' compressed_store['key'] = 'compressed value' store['key'].should == 'uncompressed value' compressed_store['key'].should == 'compressed value' store.key?('compressedkey').should be_true # Check if value is compressed compressed_store['key'].should_not == store['compressedkey'] end} }, } SPECS = {} KEYS = { 'nil' => ['nil', 0], 'integer' => [-10, 42], 'number' => [0.5, -0.3, 1<<127, 99], 'boolean' => [true, false], 'string' => %w(strkey1 strkey2).map(&:inspect), 'path' => %w(bar/foo/baz foo/bar).map(&:inspect), 'binary' => ["\xC3\xBCber", "\xAA\xBB\xCC"].map(&:inspect), 'object' => ['Value.new(:objkey1)', 'Value.new(:objkey2)'], 'hash' => [{'hashkey1' => 'hashkey2'}, {'hashkey3' => 'hashkey4'}].map(&:inspect) } VALUES = { 'nil' => ["''", 'nil', 0, false], 'integer' => [41, -12], 'number' => [123.456, -98.7, 1<<128, 33], 'boolean' => [true, false], 'string' => %w(strval1 strval2).map(&:inspect), 'binary' => ["\xC3\xBCber", "\xAA\xBB\xCC"].map(&:inspect), 'hash' => [{'hashval1' => ['array1', 1]}, {'hashval3' => ['array2', {'hashval4' => 42}]}].map(&:inspect), 'object' => ['Value.new(:objval1)', 'Value.new(:objval2)'], } KEYS.each do |key_type, keys| VALUES.each do |val_type, vals| (keys.size/2).times do |k| keypair = keys[2*k,2] (vals.size/2).times do |v| valpair = vals[2*v,2] 4.times do |i| key1, key2 = i % 2 == 0 ? keypair : keypair.reverse val1, val2 = i < 2 ? valpair : valpair.reverse code = %{it 'reads from keys like a Hash' do store[#{key1}].should be_nil store.load(#{key1}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = #{val1} (store[#{key1}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(#{key1}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(#{key1}).should be_nil end it 'removes all keys from the store with clear' do store[#{key1}] = #{val1} store[#{key2}] = #{val2} store.clear.should equal(store) store.key?(#{key1}).should be_false store.key?(#{key2}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(#{key1}, #{val1}).should == #{val1} end it 'fetches a key with a block with fetch, if the key is not available' do key = #{key1} value = #{val1} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(#{key1}, options).should be_false store.load(#{key1}, options).should be_nil store.fetch(#{key1}, 42, options).should == 42 store.fetch(#{key1}, options) { 42 }.should == 42 store.delete(#{key1}, options).should be_nil store.clear(options).should equal(store) store.store(#{key1}, #{val1}, options).should == #{val1} end} (SPECS["null_#{key_type}key_#{val_type}value"] ||= []) << code code = %{it 'writes values to keys that like a Hash' do store[#{key1}] = #{val1} store[#{key1}].should == #{val1} store.load(#{key1}).should == #{val1} end it 'returns true from #key? if a key is available' do store[#{key1}] = #{val1} store.key?(#{key1}).should be_true end it 'stores values with #store' do value = #{val1} store.store(#{key1}, value).should equal(value) store[#{key1}].should == #{val1} store.load(#{key1}).should == #{val1} end it 'stores values after clear' do store[#{key1}] = #{val1} store[#{key2}] = #{val2} store.clear.should equal(store) store[#{key1}] = #{val1} store[#{key1}].should == #{val1} store[#{key2}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[#{key1}] = #{val1} store.delete(#{key1}).should == #{val1} store.key?(#{key1}).should be_false end it 'overwrites existing values' do store[#{key1}] = #{val1} store[#{key1}].should == #{val1} store[#{key1}] = #{val2} store[#{key1}].should == #{val2} end it 'stores frozen values' do value = #{val1}.freeze (store[#{key1}] = value).should equal(value) store[#{key1}].should == #{val1} end it 'stores frozen keys' do key = #{key1}.freeze store[key] = #{val1} store[#{key1}].should == #{val1} end} if val_type != 'nil' code << %{ it 'fetches a key with a default value with fetch, if the key is available' do store[#{key1}] = #{val1} store.fetch(#{key1}, #{val2}).should == #{val1} end it 'does not run the block in fetch if the key is available' do store[#{key1}] = #{val1} unaltered = 'unaltered' store.fetch(#{key1}) { unaltered = 'altered' } unaltered.should == 'unaltered' end} end (SPECS["store_#{key_type}key_#{val_type}value"] ||= []) << code if val_type != 'boolean' && val_type != 'nil' && val_type != 'integer' && val_type != 'number' (SPECS["returndifferent_#{key_type}key_#{val_type}value"] ||= []) << %{it 'guarantees that a different value is retrieved' do value = #{val1} store[#{key1}] = value store[#{key1}].should_not be_equal(value) end} (SPECS["returnsame_#{key_type}key_#{val_type}value"] ||= []) << %{it 'guarantees that the same value is retrieved' do value = #{val1} store[#{key1}] = value store[#{key1}].should be_equal(value) end} end code = %{it 'persists values' do store[#{key1}] = #{val1} store.close @store = nil store[#{key1}].should == #{val1} end} (SPECS["persist_#{key_type}key_#{val_type}value"] ||= []) << code end end end end end SPECS['store_large'] = %{it 'should store values up to 32k' do value = 'x' * (32 * 1024) store['large'] = value store['large'].should == value end it 'should store keys up to 128 bytes' do key = 'x' * 128 store[key] = 'value' store[key].should == 'value' end} SPECS['not_persist'] = %{it 'does not persist values' do store['key'] = 'val' store.close @store = nil store['key'].should be_nil end} SPECS['multiprocess'] = %{it 'supports access by multiple instances/processes' do store['key'] = 'val' store2 = new_store store2['key'].should == 'val' store2.close end} SPECS['expires'] = %{it 'supports expires on store and []', :retry => 3 do store.store('key1', 'val1', :expires => 3) store['key1'].should == 'val1' sleep 1 store['key1'].should == 'val1' sleep 3 store['key1'].should be_nil end it 'supports strict expires on store and []' do store.store('key1', 'val1', :expires => 2) store['key1'].should == 'val1' sleep 3 # Sleep 3 seconds because after 2 seconds the value can still exist! store['key1'].should be_nil end it 'supports expires on store and fetch', :retry => 3 do store.store('key1', 'val1', :expires => 3) store.fetch('key1').should == 'val1' sleep 1 store.fetch('key1').should == 'val1' sleep 3 store.fetch('key1').should be_nil end it 'supports strict expires on store and fetch' do store.store('key1', 'val1', :expires => 2) store.fetch('key1').should == 'val1' sleep 3 # Sleep 3 seconds because after 2 seconds the value can still exist! store.fetch('key1').should be_nil end it 'supports 0 as no-expires on store and []' do store.store('key1', 'val1', :expires => 0) store['key1'].should == 'val1' sleep 2 store['key1'].should == 'val1' end it 'supports false as no-expires on store and []' do store.store('key1', 'val1', :expires => false) store['key1'].should == 'val1' sleep 2 store['key1'].should == 'val1' end it 'supports expires on store and load', :retry => 3 do store.store('key1', 'val1', :expires => 3) store.load('key1').should == 'val1' sleep 1 store.load('key1').should == 'val1' sleep 3 store.load('key1').should be_nil end it 'supports strict expires on store and load' do store.store('key1', 'val1', :expires => 2) store.load('key1').should == 'val1' sleep 3 # Sleep 3 seconds because after 2 seconds the value can still exist! store.load('key1').should be_nil end it 'supports expires on store and #key?', :retry => 3 do store.store('key1', 'val1', :expires => 3) store.key?('key1').should be_true sleep 1 store.key?('key1').should be_true sleep 3 store.key?('key1').should be_false end it 'supports strict expires on store and #key?' do store.store('key1', 'val1', :expires => 2) store.key?('key1').should be_true sleep 3 # Sleep 3 seconds because after 2 seconds the value can still exist! store.key?('key1').should be_false end it 'supports updating the expiration time in load', :retry => 3 do store.store('key2', 'val2', :expires => 3) store['key2'].should == 'val2' sleep 1 store.load('key2', :expires => 5).should == 'val2' store['key2'].should == 'val2' sleep 3 store['key2'].should == 'val2' sleep 3 store['key2'].should be_nil end it 'supports 0 as no-expires in load' do store.store('key1', 'val1', :expires => 2) store.load('key1', :expires => 0).should == 'val1' sleep 3 store.load('key1').should == 'val1' end it 'supports false as no-expires in load' do store.store('key1', 'val1', :expires => 2) store.load('key1', :expires => false).should == 'val1' sleep 3 store.load('key1').should == 'val1' end it 'supports updating the expiration time in #key?', :retry => 3 do store.store('key2', 'val2', :expires => 3) store['key2'].should == 'val2' sleep 1 store.key?('key2', :expires => 5).should be_true store['key2'].should == 'val2' sleep 3 store['key2'].should == 'val2' sleep 3 store['key2'].should be_nil end it 'supports 0 as no-expires in #key?' do store.store('key1', 'val1', :expires => 2) store.key?('key1', :expires => 0).should be_true sleep 3 store['key1'].should == 'val1' end it 'supports false as no-expires in #key?' do store.store('key1', 'val1', :expires => 2) store.key?('key1', :expires => false ).should be_true sleep 3 store['key1'].should == 'val1' end it 'supports updating the expiration time in fetch', :retry => 3 do store.store('key1', 'val1', :expires => 3) store['key1'].should == 'val1' sleep 1 store.fetch('key1', nil, :expires => 5).should == 'val1' store['key1'].should == 'val1' sleep 3 store['key1'].should == 'val1' sleep 3 store['key1'].should be_nil end it 'supports 0 as no-expires in fetch' do store.store('key1', 'val1', :expires => 2) store.fetch('key1', nil, :expires => 0).should == 'val1' sleep 3 store.load('key1').should == 'val1' end it 'supports false as no-expires in fetch' do store.store('key1', 'val1', :expires => 2) store.fetch('key1', nil, :expires => false).should == 'val1' sleep 3 store.load('key1').should == 'val1' end it 'strictly respects expires in delete' do store.store('key2', 'val2', :expires => 2) store['key2'].should == 'val2' sleep 3 # Sleep 3 seconds because after 2 seconds the value can still exist! store.delete('key2').should be_nil end it 'respects expires in delete', :retry => 3 do store.store('key2', 'val2', :expires => 3) store['key2'].should == 'val2' sleep 1 store['key2'].should == 'val2' sleep 3 store.delete('key2').should be_nil end it 'supports the #expires syntactic sugar', :retry => 3 do store.store('persistent_key', 'persistent_value', :expires => 0) store.expires(1).store('key2', 'val2') store['key2'].should == 'val2' sleep 2 store.delete('key2').should be_nil store['persistent_key'].should == 'persistent_value' end it 'supports false as no-expires on store and []' do store.store('key1', 'val1', :expires => false) store['key1'].should == 'val1' sleep 2 store['key1'].should == 'val1' end it 'does not update the expiration time in #key? when not asked to do so', :retry => 3 do store.store('key1', 'val1', :expires => 1) store.key?('key1').should be_true store.key?('key1', :expires => nil).should be_true sleep 2 store.key?('key1').should be_false end it 'does not update the expiration time in fetch when not asked to do so', :retry => 3 do store.store('key1', 'val1', :expires => 1) store.fetch('key1').should == 'val1' store.fetch('key1', :expires => nil).should == 'val1' sleep 2 store.fetch('key1').should be_nil end it 'does not update the expiration time in load when not asked to do so', :retry => 3 do store.store('key1', 'val1', :expires => 1) store.load('key1').should == 'val1' store.load('key1', :expires => nil).should == 'val1' sleep 2 store.load('key1').should be_nil end} SPECS['default_expires'] = %{it 'does set default expiration time' do store['key1'] = 'val1' store.key?('key1').should be_true store.fetch('key1').should == 'val1' store.load('key1').should == 'val1' sleep 2 store.key?('key1').should be_false store.fetch('key1').should be_nil store.load('key1').should be_nil end} SPECS['not_increment'] = %{it 'does not support #increment' do expect do store.increment('inckey') end.to raise_error(NotImplementedError) end it 'does not support #decrement' do expect do store.increment('inckey') end.to raise_error(NotImplementedError) end} SPECS['concurrent_increment'] = %{def increment_thread(name) Thread.new do s = new_store 100.times do |i| 100.times do |j| s.increment("counter\#{j}", 1, :expires => false) Thread.pass if rand(1000) >= 995 end s.store("\#{name}\#{i}", i.to_s, :expires => false) end s.close end end it 'have atomic increment across multiple processes' do a = increment_thread('a') b = increment_thread('b') c = increment_thread('c') a.join b.join c.join 100.times do |i| store["a\#{i}"].should == i.to_s store["b\#{i}"].should == i.to_s store["c\#{i}"].should == i.to_s end 100.times do |j| store.raw["counter\#{j}"].should == 300.to_s end end} SPECS['concurrent_create'] = %{def create_thread(name) Thread.new do s = new_store 1000.times do |i| s[i.to_s].should == name if s.create(i.to_s, name, :expires => false) Thread.pass if rand(100) >= 99 end s.close end end it 'have atomic create across multiple processes' do a = create_thread('a') b = create_thread('b') c = create_thread('c') a.join b.join c.join end} SPECS['increment'] = %{it 'initializes in #increment with 1' do store.key?('inckey').should be_false store.increment('inckey').should == 1 store.key?('inckey').should be_true store.raw['inckey'].should == '1' store.raw.load('inckey').should == '1' store.load('inckey', :raw => true).should == '1' store.delete('inckey', :raw => true).should == '1' store.key?('inckey').should be_false end it 'initializes in #increment with higher value' do store.increment('inckey', 42).should == 42 store.key?('inckey').should be_true store.raw['inckey'].should == '42' store.delete('inckey', :raw => true).should == '42' end it 'initializes in #increment with 0' do store.increment('inckey', 0).should == 0 store.key?('inckey').should be_true store.raw['inckey'].should == '0' store.delete('inckey', :raw => true).should == '0' end it 'initializes in #decrement with 0' do store.decrement('inckey', 0).should == 0 store.raw['inckey'].should == '0' end it 'initializes in #decrement with negative value' do store.decrement('inckey', -42).should == 42 store.raw['inckey'].should == '42' end it 'supports incrementing existing value by value' do store.increment('inckey').should == 1 store.increment('inckey', 42).should == 43 store.raw['inckey'].should == '43' end it 'supports decrementing existing value by value' do store.increment('inckey').should == 1 store.decrement('inckey').should == 0 store.increment('inckey', 42).should == 42 store.decrement('inckey', 2).should == 40 store.raw['inckey'].should == '40' end it 'supports incrementing existing value by 0' do store.increment('inckey').should == 1 store.increment('inckey', 0).should == 1 store.raw['inckey'].should == '1' end it 'supports decrementing existing value' do store.increment('inckey', 10).should == 10 store.increment('inckey', -5).should == 5 store.raw['inckey'].should == '5' store.increment('inckey', -5).should == 0 store.raw['inckey'].should == '0' end it 'interprets raw value as integer' do store.store('inckey', '42', :raw => true) store.increment('inckey').should == 43 store.raw['inckey'].should == '43' end it 'raises error in #increment on non integer value' do store['strkey'] = 'value' expect do store.increment('strkey') end.to raise_error end it 'raises error in #decrement on non integer value' do store['strkey'] = 'value' expect do store.decrement('strkey') end.to raise_error end it 'supports Semaphore' do a = Moneta::Semaphore.new(store, 'semaphore', 2) b = Moneta::Semaphore.new(store, 'semaphore', 2) c = Moneta::Semaphore.new(store, 'semaphore', 2) a.synchronize do a.locked?.should be_true b.synchronize do b.locked?.should be_true c.try_lock.should be_false end end end } SPECS['create'] = %{it 'creates the given key' do store.create('key','value').should be_true store['key'].should == 'value' end it 'creates raw value with the given key' do store.raw.create('key','value').should be_true store.raw['key'].should == 'value' end it 'does not create a key if it exists' do store['key'] = 'value' store.create('key','another value').should be_false store['key'].should == 'value' end it 'supports Mutex' do a = Moneta::Mutex.new(store, 'mutex') b = Moneta::Mutex.new(store, 'mutex') a.lock.should be_true b.try_lock.should be_false a.unlock.should be_nil end } SPECS['not_create'] = %{it 'does not support #create' do expect do store.create('key','value') end.to raise_error(NotImplementedError) end} SPECS['create_expires'] = %{it 'creates the given key and expires it' do store.create('key','value', :expires => 1).should be_true store['key'].should == 'value' sleep 2 store.key?('key').should be_false end it 'does not change expires if the key exists' do store.store('key', 'value', :expires => false).should == 'value' store.create('key','another value', :expires => 1).should be_false store['key'].should == 'value' sleep 2 store['key'].should == 'value' store.key?('key').should be_true end} SPECS['marshallable_key'] = %{it 'refuses to #[] from keys that cannot be marshalled' do expect do store[Struct.new(:foo).new(:bar)] end.to raise_error(marshal_error) end it 'refuses to load from keys that cannot be marshalled' do expect do store.load(Struct.new(:foo).new(:bar)) end.to raise_error(marshal_error) end it 'refuses to fetch from keys that cannot be marshalled' do expect do store.fetch(Struct.new(:foo).new(:bar), true) end.to raise_error(marshal_error) end it 'refuses to #[]= to keys that cannot be marshalled' do expect do store[Struct.new(:foo).new(:bar)] = 'value' end.to raise_error(marshal_error) end it 'refuses to store to keys that cannot be marshalled' do expect do store.store Struct.new(:foo).new(:bar), 'value' end.to raise_error(marshal_error) end it 'refuses to check for #key? if the key cannot be marshalled' do expect do store.key? Struct.new(:foo).new(:bar) end.to raise_error(marshal_error) end it 'refuses to delete a key if the key cannot be marshalled' do expect do store.delete Struct.new(:foo).new(:bar) end.to raise_error(marshal_error) end} SPECS['marshallable_value'] = %{it 'refuses to store values that cannot be marshalled' do expect do store.store 'key', Struct.new(:foo).new(:bar) end.to raise_error(marshal_error) end} SPECS['transform_value'] = %{it 'allows to bypass transformer with :raw' do store['key'] = 'value' load_value(store.load('key', :raw => true)).should == 'value' store.store('key', 'value', :raw => true) store.load('key', :raw => true).should == 'value' store.delete('key', :raw => true).should == 'value' end it 'allows to bypass transformer with raw syntactic sugar' do store['key'] = 'value' load_value(store.raw.load('key')).should == 'value' store.raw.store('key', 'value') store.raw['key'].should == 'value' store.raw.load('key').should == 'value' store.raw.delete('key').should == 'value' store.raw['key'] = 'value2' store.raw['key'].should == 'value2' end it 'returns unmarshalled value' do store.store('key', 'unmarshalled value', :raw => true) store.load('key', :raw => true).should == 'unmarshalled value' end it 'might raise exception on invalid value' do store.store('key', 'unmarshalled value', :raw => true) begin store['key'].should == load_value('unmarshalled value') store.delete('key').should == load_value('unmarshalled value') rescue Exception => ex expect do store['key'] end.to raise_error expect do store.delete('key') end.to raise_error end end} SPECS['transform_value_expires'] = %{it 'allows to bypass transformer with :raw' do store['key'] = 'value' load_value(store.load('key', :raw => true)).should == 'value' store['key'] = [1,2,3] load_value(store.load('key', :raw => true)).should == [[1,2,3]] store['key'] = nil load_value(store.load('key', :raw => true)).should == [nil] store['key'] = false load_value(store.load('key', :raw => true)).should be_false store.store('key', 'value', :expires => 10) load_value(store.load('key', :raw => true)).first.should == 'value' load_value(store.load('key', :raw => true)).last.should respond_to(:to_int) store.store('key', 'value', :raw => true) store.load('key', :raw => true).should == 'value' store.delete('key', :raw => true).should == 'value' end it 'returns unmarshalled value' do store.store('key', 'unmarshalled value', :raw => true) store.load('key', :raw => true).should == 'unmarshalled value' end it 'might raise exception on invalid value' do store.store('key', 'unmarshalled value', :raw => true) begin store['key'].should == load_value('unmarshalled value') store.delete('key').should == load_value('unmarshalled value') rescue Exception => ex expect do store['key'] end.to raise_error expect do store.delete('key') end.to raise_error end end} SPECS['features'] = %{it 'should report correct features' do store.features.sort_by(&:to_s).should == features end it 'should have frozen features' do store.features.frozen?.should be_true end it 'should have #supports?' do features.each do |f| store.supports?(f).should be_true end store.supports?(:unknown).should be_false end} specs_code = "#{header}\n" SPECS.each do |key, code| specs_code << "#################### #{key} ####################\n\n" << "shared_examples_for '#{key}' do\n " << [code].flatten.join("\n\n").gsub("\n", "\n ") << "\nend\n\n" end specs_code.gsub!(/\n +\n/, "\n\n") File.open(File.join(PATH, 'monetaspecs.rb'), 'w') {|out| out << specs_code } TESTS.each do |name, options| build = options.delete(:build) store = options.delete(:store) load_value = options.delete(:load_value) || 'Marshal.load(value)' specs_code = [] specs = options.delete(:specs) specs.specs.sort.each do |s| specs_code << " it_should_behave_like '#{s}'" if SPECS[s.to_s] specs.key.each do |k| specs.value.each do |v| x = "#{s}_#{k}key_#{v}value" specs_code << " it_should_behave_like '#{x}'" if SPECS[x] end end end preamble = options.delete(:preamble).to_s.gsub("\n", "\n ") opts = options.delete(:options) opts = ', ' << opts if opts build ||= "Moneta.new(#{store.inspect}#{opts}, :logger => {:file => File.join(make_tempdir, '#{name}.log')})" code = %{#{header}require 'helper' describe_moneta #{name.inspect} do #{preamble}def features #{specs.features.to_a.inspect} end def new_store #{build.gsub("\n", "\n ")} end def load_value(value) #{load_value} end include_context 'setup_store' #{specs_code.join("\n")}#{options[:tests].to_s.gsub("\n", "\n ")} end } code.gsub!(/\n +\n/, "\n\n") File.open(File.join(PATH, 'moneta', "#{name}_spec.rb"), 'w') {|out| out << code } end ruby-moneta-0.7.20/script/install-bundle000077500000000000000000000017101232153565500202170ustar00rootroot00000000000000#!/usr/bin/env ruby # Inspired by https://coderwall.com/p/x8exja def cmd(s) puts s system(s) || abort("#{s} failed") end if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx' ruby = 'rbx' elsif defined?(JRUBY_VERSION) ruby = 'jruby' else ruby = 'mri' end BUNDLE_FILE = "moneta-bundle-#{RUBY_VERSION}-#{ruby}.tar.gz" if system("curl -f -u moneta:#{ENV['DAV_PW']} -k -o #{BUNDLE_FILE} https://mendler.net/dav/#{BUNDLE_FILE}") cmd 'rm -rf .bundle' cmd "tar -xpf #{BUNDLE_FILE}" cmd "rm -f #{BUNDLE_FILE}" # Write newest moneta version in Gemfile.lock require './lib/moneta/version' File.open('Gemfile.lock', 'r+') do |fp| content = fp.read content.gsub!(/moneta\s*\(.*?\)/, "moneta (#{Moneta::VERSION})") fp.truncate(0) fp.pos = 0 fp.write(content) end else cmd 'bundle install --path .bundle' cmd 'bundle update' cmd 'bundle install --deployment --path .bundle' cmd "tar -cpzf #{BUNDLE_FILE} Gemfile.lock .bundle" end ruby-moneta-0.7.20/script/install-kyotocabinet000077500000000000000000000010561232153565500214440ustar00rootroot00000000000000#!/bin/bash if `wget --no-check-certificate --quiet -O kyotocabinet.tar.gz https://moneta:$DAV_PW@mendler.net/dav/kyotocabinet.tar.gz`; then tar -xf kyotocabinet.tar.gz else wget http://fallabs.com/kyotocabinet/pkg/kyotocabinet-1.2.76.tar.gz tar -xzf kyotocabinet-*.tar.gz rm kyotocabinet-*.tar.gz cd kyotocabinet-* ./configure --prefix=/usr make cd .. tar -czf kyotocabinet.tar.gz kyotocabinet-* curl -u moneta:$DAV_PW -k -T kyotocabinet.tar.gz https://mendler.net/dav/ || echo 'Nothing uploaded' fi cd kyotocabinet-* sudo make install ruby-moneta-0.7.20/script/memusage000077500000000000000000000011621232153565500171060ustar00rootroot00000000000000#!/usr/bin/env ruby $: << File.join(File.dirname(__FILE__), '..', 'lib') def memusage `pmap #{$$} | tail -1`[10..-1].strip.to_i end def shrink last = memusage loop do GC.start sleep 1 m = memusage break if m == last last = m end end $last_memusage = 0 def stats shrink m = memusage delta = m - $last_memusage $last_memusage = m puts "# #{m}K #{delta >= 0 ? '+' : ''}#{delta}K" end stats %q{require 'moneta' Moneta.new(:Memory) Moneta.new(:File, :dir => 'filestore') Moneta.new(:MemcachedNative) Moneta.new(:MemcachedDalli)}.each_line do |line| puts line eval(line) stats end ruby-moneta-0.7.20/script/parallel-tests000077500000000000000000000043321232153565500202410ustar00rootroot00000000000000#!/usr/bin/env ruby def rspec(spec) if system("rspec #{spec}") true elsif sig = $?.termsig found = Signal.list.to_a.select {|name, id| id == sig }.first puts "\e[31m########## SIG#{found ? found.first : sig} rspec #{spec} ##########\e[0m" false else puts "rspec terminated with #{$?.exitstatus}" false end end ENV['PARALLEL_TESTS'] = 'yes' specs = Dir['spec/*/*_spec.rb'].sort # Shuffle specs to ensure equal distribution over the test groups # We have to shuffle with the same seed every time because rake is started # multiple times! old_seed = srand(43) specs.shuffle! srand(old_seed) # FIXME: # # * QuickLZ segfaults because of an assertion # QuickLZ is also not maintained on Github, but on Bitbucket # and I don't know where the issue tracker is. # # * PStore increment/locking doesn't work correctly on JRuby # unstable = %w(quicklz riak cassandra) unstable += %w(pstore) if defined?(JRUBY_VERSION) unstable_re = /#{unstable.join('|')}/ unstable = specs.select {|s| s =~ unstable_re } specs -= unstable group = ARGV.first || '1/1' case group when /^(\d+)\/(\d+)$/ n = $1.to_i max = $2.to_i if n == max specs = specs[(n-1)*(specs.size/max)..-1] else specs = specs[(n-1)*(specs.size/max), specs.size/max] end when 'unstable' specs = unstable else puts "Invalid test group #{group}" exit 1 end puts "The following specs will be executed:\n\t#{specs.join "\n\t"}\n\n" # Memcached and Redis specs cannot be used in parallel # because of flushing and lacking namespaces parallel = [] %w(memcached redis client shared riak tokyotyrant couch cassandra).each do |name| serial = specs.select { |s| s.include?(name) } unless serial.empty? specs -= serial parallel << serial end end parallel += specs.map {|s| [s] } threads = [] failed = false parallel.each do |serial| threads << Thread.new do begin serial.each do |spec| failed = true unless rspec(spec) end ensure threads.delete Thread.current end end sleep 0.1 sleep 0.1 while threads.size >= 5 end sleep 0.1 until threads.empty? if failed puts "\e[31m########## MONETA TESTSUITE FAILED ##########\e[0m" exit 1 end puts "\e[32m########## MONETA TESTSUITE SUCCEDED ##########\e[0m" ruby-moneta-0.7.20/script/start-services000077500000000000000000000004571232153565500202670ustar00rootroot00000000000000#!/bin/bash echo 'Starting TokyoTyrant' /usr/sbin/ttserver -dmn -pid /tmp/ttserver.pid -log /tmp/ttserver.log -port 1978 sudo service riak start & sudo service couchdb start & sudo service redis-server start & sudo service cassandra start & sudo service memcached start & sudo service mongodb start & ruby-moneta-0.7.20/script/travis-logs000077500000000000000000000007371232153565500175640ustar00rootroot00000000000000#! /usr/bin/env ruby require 'travis' require 'cgi' require 'fileutils' FileUtils.mkpath('logs') `git remote -v | grep origin | head -n1` =~ /github\.com:(.*?)\.git/ repo = Travis::Repository.find($1) build = repo.recent_builds.select {|b| b.finished_at }.first build.jobs.each do |j| c = j.config id = "logs/#{j.allow_failures? ? 'allowed-' : ''}#{j.state}-#{c['rvm']}-#{CGI.escape c['env']}" puts "Downloading #{j.id}" File.open(id, 'w') {|f| f.write(j.log.body) } end ruby-moneta-0.7.20/script/upload-bundle000077500000000000000000000001671232153565500200420ustar00rootroot00000000000000#!/bin/bash curl -f -u moneta:$DAV_PW -k -T moneta-bundle-*.tar.gz https://mendler.net/dav/ || echo 'Nothing uploaded' ruby-moneta-0.7.20/script/wait-services000077500000000000000000000004451232153565500200730ustar00rootroot00000000000000#!/bin/bash sudo service riak start sudo service couchdb start sudo service redis-server start sudo service cassandra start sudo service memcached start sudo service mongodb start # Waiting for servers to start sleep 3 echo 'TokyoTyrant status' ps aux | grep ttserver cat /tmp/ttserver.log ruby-moneta-0.7.20/spec/000077500000000000000000000000001232153565500150035ustar00rootroot00000000000000ruby-moneta-0.7.20/spec/action_dispatch/000077500000000000000000000000001232153565500201375ustar00rootroot00000000000000ruby-moneta-0.7.20/spec/action_dispatch/fixtures/000077500000000000000000000000001232153565500220105ustar00rootroot00000000000000ruby-moneta-0.7.20/spec/action_dispatch/fixtures/session_autoload_test/000077500000000000000000000000001232153565500264225ustar00rootroot00000000000000ruby-moneta-0.7.20/spec/action_dispatch/fixtures/session_autoload_test/foo.rb000066400000000000000000000002551232153565500275340ustar00rootroot00000000000000module SessionAutoloadTest class Foo def initialize(bar='baz') @bar = bar end def inspect "#<#{self.class} bar:#{@bar.inspect}>" end end end ruby-moneta-0.7.20/spec/action_dispatch/session_moneta_store_spec.rb000066400000000000000000000122231232153565500257400ustar00rootroot00000000000000require 'action_dispatch' require 'action_controller' require 'action_dispatch/middleware/session/moneta_store' require 'minitest/autorun' class MonetaStoreTest < ActionDispatch::IntegrationTest class TestController < ActionController::Base def no_session_access head :ok end def set_session_value session[:foo] = "bar" head :ok end def set_serialized_session_value session[:foo] = SessionAutoloadTest::Foo.new head :ok end def get_session_value render :text => "foo: #{session[:foo].inspect}" end def get_session_id render :text => "#{request.session_options[:id]}" end def call_reset_session session[:bar] reset_session session[:bar] = "baz" head :ok end end def test_setting_and_getting_session_value with_test_route_set do get '/set_session_value' assert_response :success assert cookies['_session_id'] get '/get_session_value' assert_response :success assert_equal 'foo: "bar"', response.body end end def test_getting_nil_session_value with_test_route_set do get '/get_session_value' assert_response :success assert_equal 'foo: nil', response.body end end def test_getting_session_value_after_session_reset with_test_route_set do get '/set_session_value' assert_response :success assert cookies['_session_id'] session_cookie = cookies.send(:hash_for)['_session_id'] get '/call_reset_session' assert_response :success assert_not_equal [], headers['Set-Cookie'] cookies << session_cookie # replace our new session_id with our old, pre-reset session_id get '/get_session_value' assert_response :success assert_equal 'foo: nil', response.body, "data for this session should have been obliterated from cache" end end def test_getting_from_nonexistent_session with_test_route_set do get '/get_session_value' assert_response :success assert_equal 'foo: nil', response.body assert_nil cookies['_session_id'], "should only create session on write, not read" end end def test_setting_session_value_after_session_reset with_test_route_set do get '/set_session_value' assert_response :success assert cookies['_session_id'] session_id = cookies['_session_id'] get '/call_reset_session' assert_response :success assert_not_equal [], headers['Set-Cookie'] get '/get_session_value' assert_response :success assert_equal 'foo: nil', response.body get '/get_session_id' assert_response :success assert_not_equal session_id, response.body end end def test_getting_session_id with_test_route_set do get '/set_session_value' assert_response :success assert cookies['_session_id'] session_id = cookies['_session_id'] get '/get_session_id' assert_response :success assert_equal session_id, response.body, "should be able to read session id without accessing the session hash" end end def test_deserializes_unloaded_class with_test_route_set do with_autoload_path do get '/set_serialized_session_value' assert_response :success assert cookies['_session_id'] end with_autoload_path do get '/get_session_id' assert_response :success end with_autoload_path do get '/get_session_value' assert_response :success assert_equal 'foo: #', response.body, "should auto-load unloaded class" end end end def test_doesnt_write_session_cookie_if_session_id_is_already_exists with_test_route_set do get '/set_session_value' assert_response :success assert cookies['_session_id'] get '/get_session_value' assert_response :success assert_equal nil, headers['Set-Cookie'], "should not resend the cookie again if session_id cookie is already exists" end end def test_prevents_session_fixation with_test_route_set do get '/get_session_value' assert_response :success assert_equal 'foo: nil', response.body session_id = cookies['_session_id'] reset! get '/set_session_value', :_session_id => session_id assert_response :success assert_not_equal session_id, cookies['_session_id'] end end private def with_autoload_path path = File.join(File.dirname(__FILE__), 'fixtures') if ActiveSupport::Dependencies.autoload_paths.include?(path) yield else begin ActiveSupport::Dependencies.autoload_paths << path yield ensure ActiveSupport::Dependencies.autoload_paths.reject! {|p| p == path} ActiveSupport::Dependencies.clear end end end def with_test_route_set with_routing do |set| set.draw do get ':action', :to => ::MonetaStoreTest::TestController end @app = ActionDispatch::MiddlewareStack.new do |middleware| middleware.use ActionDispatch::Session::MonetaStore, :key => '_session_id', :store => :Memory end.build(set) yield end end end ruby-moneta-0.7.20/spec/active_support/000077500000000000000000000000001232153565500200525ustar00rootroot00000000000000ruby-moneta-0.7.20/spec/active_support/cache_moneta_store_spec.rb000066400000000000000000000126401232153565500252360ustar00rootroot00000000000000require 'moneta' require 'active_support' require 'active_support/cache/moneta_store' require 'ostruct' describe ActiveSupport::Cache::MonetaStore do before(:all) do @events = [] ActiveSupport::Notifications.subscribe(/^cache_(.*)\.active_support$/) do |*args| @events << ActiveSupport::Notifications::Event.new(*args) end end before(:each) do @events.clear @store = ActiveSupport::Cache::MonetaStore.new(:store => Moneta.new(:Memory)) @rabbit = OpenStruct.new :name => 'bunny' @white_rabbit = OpenStruct.new :color => 'white' @store.write 'rabbit', @rabbit @store.delete 'counter' @store.delete 'rub-a-dub' end it 'reads the data' do @store.read('rabbit').should == @rabbit end it 'writes the data' do @store.write 'rabbit', @white_rabbit @store.read('rabbit').should == @white_rabbit end it 'writes the data with expiration time' do @store.write 'rabbit', @white_rabbit, :expires_in => 1.second @store.read('rabbit').should == @white_rabbit sleep 2 @store.read('rabbit').should be_nil end it 'deletes data' do @store.delete 'rabbit' @store.read('rabbit').should be_nil end it 'verifies existence of an object in the store' do @store.exist?('rabbit').should == true (!!@store.exist?('rab-a-dub')).should == false end it 'fetches data' do @store.fetch('rabbit').should == @rabbit @store.fetch('rub-a-dub').should be_nil @store.fetch('rub-a-dub') { 'Flora de Cana' } @store.fetch('rub-a-dub').should == 'Flora de Cana' @store.fetch('rabbit', :force => true) # force cache miss @store.fetch('rabbit', :force => true, :expires_in => 1.second) { @white_rabbit } @store.fetch('rabbit').should == @white_rabbit sleep 2 @store.fetch('rabbit').should be_nil end it 'reads multiple keys' do @store.write 'irish whisky', 'Jameson' result = @store.read_multi 'rabbit', 'irish whisky' result['rabbit'].should == @rabbit result['irish whisky'].should == 'Jameson' end it 'reads multiple keys and returns only the matched ones' do @store.delete 'irish whisky' result = @store.read_multi 'rabbit', 'irish whisky' result.should_not include('irish whisky') result.should include('rabbit') end it 'increments a key' do 3.times { @store.increment 'counter' } @store.read('counter', :raw => true).should == '3' end it 'decrements a key' do 3.times { @store.increment 'counter' } 2.times { @store.decrement 'counter' } @store.read('counter', :raw => true).should == '1' end it 'increments a key by given value' do @store.increment 'counter', 3 @store.read('counter', :raw => true).should == '3' end it 'decrements a key by given value' do 3.times { @store.increment 'counter' } @store.decrement 'counter', 2 @store.read('counter', :raw => true).should == '1' end describe 'notifications' do it 'notifies on #fetch' do with_notifications do @store.fetch('radiohead') { 'House Of Cards' } end read, generate, write = @events read.name.should == 'cache_read.active_support' read.payload.should == { :key => 'radiohead', :super_operation => :fetch } generate.name.should == 'cache_generate.active_support' generate.payload.should == { :key => 'radiohead' } write.name.should == 'cache_write.active_support' write.payload.should == { :key => 'radiohead' } end it 'notifies on #read' do with_notifications do @store.read 'metallica' end read = @events.first read.name.should == 'cache_read.active_support' read.payload.should == { :key => 'metallica', :hit => false } end it 'notifies on #write' do with_notifications do @store.write 'depeche mode', 'Enjoy The Silence' end write = @events.first write.name.should == 'cache_write.active_support' write.payload.should == { :key => 'depeche mode' } end it 'notifies on #delete' do with_notifications do @store.delete 'the new cardigans' end delete = @events.first delete.name.should == 'cache_delete.active_support' delete.payload.should == { :key => 'the new cardigans' } end it 'notifies on #exist?' do with_notifications do @store.exist? 'the smiths' end exist = @events.first exist.name.should == 'cache_exist?.active_support' exist.payload.should == { :key => 'the smiths' } end it 'notifies on #increment' do with_notifications do @store.increment 'pearl jam' end increment = @events.first increment.name.should == 'cache_increment.active_support' increment.payload.should == { :key => 'pearl jam', :amount => 1 } end it 'notifies on #decrement' do with_notifications do @store.decrement 'placebo' end decrement = @events.first decrement.name.should == 'cache_decrement.active_support' decrement.payload.should == { :key => 'placebo', :amount => 1 } end it 'should notify on clear' do with_notifications do @store.clear end clear = @events.first clear.name.should == 'cache_clear.active_support' clear.payload.should == { :key => nil } end end private def with_notifications ActiveSupport::Cache::MonetaStore.instrument = true yield ensure ActiveSupport::Cache::MonetaStore.instrument = false end end ruby-moneta-0.7.20/spec/helper.rb000066400000000000000000000102701232153565500166070ustar00rootroot00000000000000require 'rspec' require 'rspec/core/formatters/base_text_formatter' require 'rspec/retry' require 'moneta' require 'fileutils' require 'monetaspecs' class MonetaParallelFormatter < RSpec::Core::Formatters::BaseTextFormatter def start(*args) output.puts colorise_summary("STARTING #{ARGV.join(' ')}") @stopped = false @passed_count = 0 @heartbeat = Thread.new do count = 0 until @stopped if (count += 1) % 60 == 0 output.puts(color("RUNNING #{ARGV.join(' ')} - #{@passed_count} passed, #{failed_examples.size} failures", failed_examples.empty? ? RSpec.configuration.success_color : RSpec.configuration.failure_color)) end sleep 0.5 end end end def example_passed(example) super @passed_count += 1 end def stop @stopped = true @heartbeat.join end def dump_summary(duration, example_count, failure_count, pending_count) @duration = duration @example_count = example_count @failure_count = failure_count @pending_count = pending_count output.puts colorise_summary(summary_line(example_count, failure_count, pending_count)) dump_commands_to_rerun_failed_examples end def summary_line(example_count, failure_count, pending_count) "FINISHED #{ARGV.join(' ')} in #{format_duration(duration)} - #{super}" end end RSpec.configure do |config| config.verbose_retry = true config.color_enabled = true config.tty = true config.formatter = ENV['PARALLEL_TESTS'] ? MonetaParallelFormatter : :progress end # Disable jruby stdout pollution by memcached if defined?(JRUBY_VERSION) require 'java' properties = java.lang.System.getProperties(); properties.put('net.spy.log.LoggerImpl', 'net.spy.memcached.compat.log.SunLogger'); java.lang.System.setProperties(properties); java.util.logging.Logger.getLogger('').setLevel(java.util.logging.Level::OFF) end class Value attr_accessor :x def initialize(x) @x = x end def ==(other) Value === other && other.x == x end def eql?(other) Value === other && other.x == x end def hash x.hash end end def start_restserver require 'rack' require 'webrick' require 'rack/moneta_rest' # Keep webrick quiet ::WEBrick::HTTPServer.class_eval do def access_log(config, req, res); end end ::WEBrick::BasicLog.class_eval do def log(level, data); end end Thread.start do Rack::Server.start(:app => Rack::Builder.app do use Rack::Lint map '/moneta' do run Rack::MonetaRest.new(:store => :Memory) end end, :environment => :none, :server => :webrick, :Port => 8808) end sleep 1 end def start_server(*args) server = Moneta::Server.new(*args) Thread.new { server.run } sleep 0.1 until server.running? rescue Exception => ex puts "Failed to start server - #{ex.message}" end def make_tempdir # Expand path since datamapper needs absolute path in setup tempdir = File.expand_path(File.join(File.dirname(__FILE__), 'tmp')) FileUtils.mkpath(tempdir) tempdir end def marshal_error # HACK: Marshalling structs in rubinius without class name throws # NoMethodError (to_sym). TODO: Create an issue for rubinius! if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx' RUBY_VERSION < '1.9' ? ArgumentError : NoMethodError else TypeError end end class InitializeStore def initialize(&block) instance_eval(&block) store = new_store store['foo'] = 'bar' store.clear store.close end def method_missing(*args) end end def describe_moneta(name, &block) begin InitializeStore.new(&block) describe(name, &block) rescue LoadError => ex puts "\e[31mTest #{name} not executed: #{ex.class} - #{ex.message}\e[0m" rescue Exception => ex puts "\e[31mTest #{name} not executed: #{ex.class} - #{ex.message}\e[0m" puts ex.backtrace.join("\n") end end shared_context 'setup_store' do def store @store ||= new_store end before do store.clear end after do if store store.close.should == nil @store = nil end end end ruby-moneta-0.7.20/spec/moneta/000077500000000000000000000000001232153565500162665ustar00rootroot00000000000000ruby-moneta-0.7.20/spec/moneta/adapter_activerecord_exisiting_connection_spec.rb000066400000000000000000000023741232153565500303070ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_activerecord_exisiting_connection" do require 'active_record' ActiveRecord::Base.establish_connection :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :database => 'moneta', :username => 'root' def features [:create, :increment] end def new_store Moneta::Adapters::ActiveRecord.new(:table => 'adapter_activerecord_existing_connection') end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_activerecord_spec.rb000066400000000000000000000051441232153565500240030ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_activerecord" do def features [:create, :increment] end def new_store Moneta::Adapters::ActiveRecord.new(:table => 'adapter_activerecord', :connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :database => 'moneta', :username => 'root' }) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' it 'updates an existing key/value' do store['foo/bar'] = '1' store['foo/bar'] = '2' store.table.where(:k => 'foo/bar').count.should == 1 end it 'supports different tables same database' do store1 = Moneta::Adapters::ActiveRecord.new(:table => 'adapter_activerecord1', :connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :database => 'moneta', :username => 'root' }) store2 = Moneta::Adapters::ActiveRecord.new(:table => 'adapter_activerecord2', :connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :database => 'moneta', :username => 'root' }) store1['key'] = 'value1' store2['key'] = 'value2' store1['key'].should == 'value1' store2['key'].should == 'value2' store1.close store2.close end it 'supports different databases same table' do store1 = Moneta::Adapters::ActiveRecord.new(:table => 'adapter_activerecord', :connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :database => 'moneta_activerecord1', :username => 'root' }) store2 = Moneta::Adapters::ActiveRecord.new(:table => 'adapter_activerecord', :connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :database => 'moneta_activerecord2', :username => 'root' }) store1['key'] = 'value1' store2['key'] = 'value2' store1['key'].should == 'value1' store2['key'].should == 'value2' store1.close store2.close end end ruby-moneta-0.7.20/spec/moneta/adapter_cassandra_spec.rb000066400000000000000000000017421232153565500232700ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_cassandra" do def features [:expires] end def new_store Moneta::Adapters::Cassandra.new(:keyspace => 'adapter_cassandra') end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_cassandra_with_default_expires_spec.rb000066400000000000000000000021051232153565500275600ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_cassandra_with_default_expires" do def features [:expires] end def new_store Moneta::Adapters::Cassandra.new(:keyspace => 'adapter_cassandra_with_default_expires', :expires => 1) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'default_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_client_spec.rb000066400000000000000000000020431232153565500226020ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_client" do start_server(Moneta::Adapters::Memory.new) def features [:create, :increment] end def new_store Moneta::Adapters::Client.new end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_cookie_spec.rb000066400000000000000000000014421232153565500225770ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_cookie" do def features [:create, :increment] end def new_store Moneta::Adapters::Cookie.new end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'not_persist' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_couch_spec.rb000066400000000000000000000021731232153565500224310ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_couch" do def features [:create] end def new_store Moneta::Adapters::Couch.new(:db => 'adapter_couch') end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'multiprocess' it_should_behave_like 'not_increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_datamapper_spec.rb000066400000000000000000000041241232153565500234440ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_datamapper" do require 'dm-core' DataMapper.setup(:default, :adapter => :in_memory) def features [:create] end def new_store Moneta::Adapters::DataMapper.new(:setup => "mysql://root:@localhost/moneta", :table => "adapter_datamapper") end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'multiprocess' it_should_behave_like 'not_increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' it 'does not cross contaminate when storing' do first = Moneta::Adapters::DataMapper.new(:setup => "mysql://root:@localhost/moneta", :table => "datamapper_first") first.clear second = Moneta::Adapters::DataMapper.new(:repository => :sample, :setup => "mysql://root:@localhost/moneta", :table => "datamapper_second") second.clear first['key'] = 'value' second['key'] = 'value2' first['key'].should == 'value' second['key'].should == 'value2' end it 'does not cross contaminate when deleting' do first = Moneta::Adapters::DataMapper.new(:setup => "mysql://root:@localhost/moneta", :table => "datamapper_first") first.clear second = Moneta::Adapters::DataMapper.new(:repository => :sample, :setup => "mysql://root:@localhost/moneta", :table => "datamapper_second") second.clear first['key'] = 'value' second['key'] = 'value2' first.delete('key').should == 'value' first.key?('key').should be_false second['key'].should == 'value2' end end ruby-moneta-0.7.20/spec/moneta/adapter_daybreak_spec.rb000066400000000000000000000016441232153565500231140ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_daybreak" do def features [:create, :increment] end def new_store Moneta::Adapters::Daybreak.new(:file => File.join(make_tempdir, "adapter_daybreak")) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_dbm_spec.rb000066400000000000000000000016371232153565500220760ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_dbm" do def features [:create, :increment] end def new_store Moneta::Adapters::DBM.new(:file => File.join(make_tempdir, "adapter_dbm")) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_file_spec.rb000066400000000000000000000020431232153565500222430ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_file" do def features [:create, :increment] end def new_store Moneta::Adapters::File.new(:dir => File.join(make_tempdir, "adapter_file")) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_fog_spec.rb000066400000000000000000000021411232153565500220760ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_fog" do require 'fog' Fog.mock! def features [] end def new_store Moneta::Adapters::Fog.new(:aws_access_key_id => 'fake_access_key_id', :aws_secret_access_key => 'fake_secret_access_key', :provider => 'AWS', :dir => 'adapter_fog') end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'features' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_gdbm_spec.rb000066400000000000000000000016421232153565500222410ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_gdbm" do def features [:create, :increment] end def new_store Moneta::Adapters::GDBM.new(:file => File.join(make_tempdir, "adapter_gdbm")) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_hbase_spec.rb000066400000000000000000000017361232153565500224160ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_hbase" do def features [:increment] end def new_store Moneta::Adapters::HBase.new(:table => 'adapter_hbase') end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_increment' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_kyotocabinet_spec.rb000066400000000000000000000016761232153565500240320ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_kyotocabinet" do def features [:create, :increment] end def new_store Moneta::Adapters::KyotoCabinet.new(:file => File.join(make_tempdir, "adapter_kyotocabinet.kch")) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_leveldb_spec.rb000066400000000000000000000016521232153565500227460ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_leveldb" do def features [:create, :increment] end def new_store Moneta::Adapters::LevelDB.new(:dir => File.join(make_tempdir, "adapter_leveldb")) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_lmdb_spec.rb000066400000000000000000000017101232153565500222420ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_lmdb" do def features [:create, :increment] end def new_store Moneta::Adapters::LMDB.new(:dir => File.join(make_tempdir, "adapter_lmdb")) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_lmdb_with_db_spec.rb000066400000000000000000000017571232153565500237550ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_lmdb_with_db" do def features [:create, :increment] end def new_store Moneta::Adapters::LMDB.new(:dir => File.join(make_tempdir, "adapter_lmdb"), :db => "adapter_lmdb_with_db") end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_localmemcache_spec.rb000066400000000000000000000017311232153565500241040ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_localmemcache" do def features [] end def new_store Moneta::Adapters::LocalMemCache.new(:file => File.join(make_tempdir, "adapter_localmemcache")) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'features' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_lruhash_spec.rb000066400000000000000000000023201232153565500227700ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_lruhash" do def features [:create, :increment] end def new_store Moneta::Adapters::LRUHash.new end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'not_persist' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' it 'deletes oldest' do store = Moneta::Adapters::LRUHash.new(:max_size => 10) store[0] = 'y' (1..1000).each do |i| store[i] = 'x' store[0].should == 'y' store.instance_variable_get(:@entry).size.should == [10, i+1].min (0...[9, i-1].min).each do |j| store.instance_variable_get(:@entry)[i-j].should_not be_nil end store.key?(i-9).should be_false if i > 9 end end end ruby-moneta-0.7.20/spec/moneta/adapter_memcached_dalli_spec.rb000066400000000000000000000022051232153565500243770ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_memcached_dalli" do def features [:create, :expires, :increment] end def new_store Moneta::Adapters::MemcachedDalli.new(:namespace => "adapter_memcached_dalli") end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_memcached_dalli_with_default_expires_spec.rb000066400000000000000000000022521232153565500306770ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_memcached_dalli_with_default_expires" do def features [:create, :expires, :increment] end def new_store Moneta::Adapters::MemcachedDalli.new(:expires => 1) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'default_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_memcached_native_spec.rb000066400000000000000000000022101232153565500245740ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_memcached_native" do def features [:create, :expires, :increment] end def new_store Moneta::Adapters::MemcachedNative.new(:namespace => "adapter_memcached_native") end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_memcached_native_with_default_expires_spec.rb000066400000000000000000000022541232153565500311020ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_memcached_native_with_default_expires" do def features [:create, :expires, :increment] end def new_store Moneta::Adapters::MemcachedNative.new(:expires => 1) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'default_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_memcached_spec.rb000066400000000000000000000021641232153565500232360ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_memcached" do def features [:create, :expires, :increment] end def new_store Moneta::Adapters::Memcached.new(:namespace => "adapter_memcached") end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_memcached_with_default_expires_spec.rb000066400000000000000000000022371232153565500275350ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_memcached_with_default_expires" do def features [:create, :expires, :increment] end def new_store Moneta::Adapters::Memcached.new(:expires => 1) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'default_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_memory_spec.rb000066400000000000000000000216001232153565500226340ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_memory" do def features [:create, :increment] end def new_store Moneta::Adapters::Memory.new end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returnsame_objectkey_objectvalue' it_should_behave_like 'returnsame_objectkey_stringvalue' it_should_behave_like 'returnsame_objectkey_binaryvalue' it_should_behave_like 'returnsame_objectkey_hashvalue' it_should_behave_like 'returnsame_stringkey_objectvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_stringkey_binaryvalue' it_should_behave_like 'returnsame_stringkey_hashvalue' it_should_behave_like 'returnsame_binarykey_objectvalue' it_should_behave_like 'returnsame_binarykey_stringvalue' it_should_behave_like 'returnsame_binarykey_binaryvalue' it_should_behave_like 'returnsame_binarykey_hashvalue' it_should_behave_like 'returnsame_hashkey_objectvalue' it_should_behave_like 'returnsame_hashkey_stringvalue' it_should_behave_like 'returnsame_hashkey_binaryvalue' it_should_behave_like 'returnsame_hashkey_hashvalue' it_should_behave_like 'returnsame_booleankey_objectvalue' it_should_behave_like 'returnsame_booleankey_stringvalue' it_should_behave_like 'returnsame_booleankey_binaryvalue' it_should_behave_like 'returnsame_booleankey_hashvalue' it_should_behave_like 'returnsame_nilkey_objectvalue' it_should_behave_like 'returnsame_nilkey_stringvalue' it_should_behave_like 'returnsame_nilkey_binaryvalue' it_should_behave_like 'returnsame_nilkey_hashvalue' it_should_behave_like 'returnsame_integerkey_objectvalue' it_should_behave_like 'returnsame_integerkey_stringvalue' it_should_behave_like 'returnsame_integerkey_binaryvalue' it_should_behave_like 'returnsame_integerkey_hashvalue' it_should_behave_like 'returnsame_numberkey_objectvalue' it_should_behave_like 'returnsame_numberkey_stringvalue' it_should_behave_like 'returnsame_numberkey_binaryvalue' it_should_behave_like 'returnsame_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_mongo_spec.rb000066400000000000000000000042731232153565500224520ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_mongo" do def features [:create, :expires, :increment] end def new_store Moneta::Adapters::Mongo.new(:db => "adapter_mongo") end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'null_pathkey_hashvalue' it_should_behave_like 'null_pathkey_integervalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'persist_pathkey_hashvalue' it_should_behave_like 'persist_pathkey_integervalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_hashvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_pathkey_hashvalue' it_should_behave_like 'store_pathkey_integervalue' it_should_behave_like 'store_large' it 'automatically deletes expired document' do store.store('key', 'val', :expires => 5) store.instance_variable_get(:@collection).find_one('_id' => ::BSON::Binary.new('key')).should_not be_nil sleep 70 # Mongo needs up to 60 seconds store.instance_variable_get(:@collection).find_one('_id' => ::BSON::Binary.new('key')).should be_nil end end ruby-moneta-0.7.20/spec/moneta/adapter_mongo_with_default_expires_spec.rb000066400000000000000000000036131232153565500267450ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_mongo_with_default_expires" do def features [:create, :expires, :increment] end def new_store Moneta::Adapters::Mongo.new(:expires => 1) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'default_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'null_pathkey_hashvalue' it_should_behave_like 'null_pathkey_integervalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'persist_pathkey_hashvalue' it_should_behave_like 'persist_pathkey_integervalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_hashvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_pathkey_hashvalue' it_should_behave_like 'store_pathkey_integervalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_pstore_spec.rb000066400000000000000000000312001232153565500226350ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_pstore" do def features [:create, :increment] end def new_store Moneta::Adapters::PStore.new(:file => File.join(make_tempdir, "adapter_pstore")) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_redis_spec.rb000066400000000000000000000021111232153565500224260ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_redis" do def features [:create, :expires, :increment] end def new_store Moneta::Adapters::Redis.new end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_redis_with_default_expires_spec.rb000066400000000000000000000022271232153565500267340ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_redis_with_default_expires" do def features [:create, :expires, :increment] end def new_store Moneta::Adapters::Redis.new(:expires => 1) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'default_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_restclient_spec.rb000066400000000000000000000017241232153565500235050ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_restclient" do start_restserver def features [] end def new_store Moneta::Adapters::RestClient.new(:url => 'http://localhost:8808/moneta/') end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'features' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_riak_spec.rb000066400000000000000000000017101232153565500222520ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_riak" do require 'riak' Riak.disable_list_keys_warnings = true def features [] end def new_store Moneta::Adapters::Riak.new end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'features' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_sdbm_spec.rb000066400000000000000000000015741232153565500222610ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_sdbm" do def features [:create, :increment] end def new_store Moneta::Adapters::SDBM.new(:file => File.join(make_tempdir, "adapter_sdbm")) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' end ruby-moneta-0.7.20/spec/moneta/adapter_sequel_spec.rb000066400000000000000000000022041232153565500226210ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_sequel" do def features [:create, :increment] end def new_store Moneta::Adapters::Sequel.new(:db => (defined?(JRUBY_VERSION) ? "jdbc:mysql://localhost/moneta?user=root" : "mysql2://root:@localhost/moneta"), :table => "adapter_sequel") end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_sqlite_spec.rb000066400000000000000000000017171232153565500226340ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_sqlite" do def features [:create, :increment] end def new_store Moneta::Adapters::Sqlite.new(:file => File.join(make_tempdir, "adapter_sqlite")) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_tdb_spec.rb000066400000000000000000000016371232153565500221050ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_tdb" do def features [:create, :increment] end def new_store Moneta::Adapters::TDB.new(:file => File.join(make_tempdir, "adapter_tdb")) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_tokyocabinet_bdb_spec.rb000066400000000000000000000017211232153565500246300ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_tokyocabinet_bdb" do def features [:create, :increment] end def new_store Moneta::Adapters::TokyoCabinet.new(:file => File.join(make_tempdir, "adapter_tokyocabinet_bdb"), :type => :bdb) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_tokyocabinet_hdb_spec.rb000066400000000000000000000017211232153565500246360ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_tokyocabinet_hdb" do def features [:create, :increment] end def new_store Moneta::Adapters::TokyoCabinet.new(:file => File.join(make_tempdir, "adapter_tokyocabinet_hdb"), :type => :hdb) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_tokyotyrant_spec.rb000066400000000000000000000020001232153565500237240ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_tokyotyrant" do def features [:create, :increment] end def new_store Moneta::Adapters::TokyoTyrant.new end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/adapter_yaml_spec.rb000066400000000000000000000044541232153565500222760ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "adapter_yaml" do def features [:create, :increment] end def new_store Moneta::Adapters::YAML.new(:file => File.join(make_tempdir, "adapter_yaml")) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/builder_spec.rb000066400000000000000000000012041232153565500212500ustar00rootroot00000000000000require 'moneta' describe Moneta::Builder do it 'raises an error if #use is called after #adapter' do expect do Moneta::Builder.new do adapter :Null use :Lock end.build end.to raise_error /Please check/ end it 'raises an error if #adapter called twice' do expect do Moneta::Builder.new do adapter :Null adapter :Null end.build end.to raise_error /Please check/ end it 'raises an error if no #adapter is specified' do expect do Moneta::Builder.new do use :Lock use :Lock end.build end.to raise_error /Please check/ end end ruby-moneta-0.7.20/spec/moneta/cache_file_memory_spec.rb000066400000000000000000000026701232153565500232640ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "cache_file_memory" do def features [:create, :increment] end def new_store Moneta.build do use(:Cache) do adapter { adapter :File, :dir => File.join(make_tempdir, "cache_file_memory") } cache { adapter :Memory } end end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' it 'stores loaded values in cache' do store.adapter['foo'] = 'bar' store.cache['foo'].should be_nil store['foo'].should == 'bar' store.cache['foo'].should == 'bar' store.adapter.delete('foo') store['foo'].should == 'bar' store.delete('foo') store['foo'].should be_nil end end ruby-moneta-0.7.20/spec/moneta/cache_memory_null_spec.rb000066400000000000000000000016271232153565500233200ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "cache_memory_null" do def features [:create, :increment] end def new_store Moneta.build do use(:Cache) do adapter(Moneta::Adapters::Memory.new) cache(Moneta::Adapters::Null.new) end end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'not_persist' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/expires_file_spec.rb000066400000000000000000000057721232153565500223160ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "expires_file" do def features [:create, :expires, :increment] end def new_store Moneta.build do use :Expires use :Transformer, :key => [:marshal, :escape], :value => :marshal adapter :File, :dir => File.join(make_tempdir, "expires-file") end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' it 'deletes expired value in underlying file storage' do store.store('foo', 'bar', :expires => 2) store['foo'].should == 'bar' sleep 1 store['foo'].should == 'bar' sleep 2 store['foo'].should be_nil store.adapter['foo'].should be_nil store.adapter.adapter['foo'].should be_nil end end ruby-moneta-0.7.20/spec/moneta/expires_memory_spec.rb000066400000000000000000000217711232153565500227040ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "expires_memory" do def features [:create, :expires, :increment] end def new_store Moneta.build do use :Expires adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returnsame_objectkey_objectvalue' it_should_behave_like 'returnsame_objectkey_stringvalue' it_should_behave_like 'returnsame_objectkey_binaryvalue' it_should_behave_like 'returnsame_objectkey_hashvalue' it_should_behave_like 'returnsame_stringkey_objectvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_stringkey_binaryvalue' it_should_behave_like 'returnsame_stringkey_hashvalue' it_should_behave_like 'returnsame_binarykey_objectvalue' it_should_behave_like 'returnsame_binarykey_stringvalue' it_should_behave_like 'returnsame_binarykey_binaryvalue' it_should_behave_like 'returnsame_binarykey_hashvalue' it_should_behave_like 'returnsame_hashkey_objectvalue' it_should_behave_like 'returnsame_hashkey_stringvalue' it_should_behave_like 'returnsame_hashkey_binaryvalue' it_should_behave_like 'returnsame_hashkey_hashvalue' it_should_behave_like 'returnsame_booleankey_objectvalue' it_should_behave_like 'returnsame_booleankey_stringvalue' it_should_behave_like 'returnsame_booleankey_binaryvalue' it_should_behave_like 'returnsame_booleankey_hashvalue' it_should_behave_like 'returnsame_nilkey_objectvalue' it_should_behave_like 'returnsame_nilkey_stringvalue' it_should_behave_like 'returnsame_nilkey_binaryvalue' it_should_behave_like 'returnsame_nilkey_hashvalue' it_should_behave_like 'returnsame_integerkey_objectvalue' it_should_behave_like 'returnsame_integerkey_stringvalue' it_should_behave_like 'returnsame_integerkey_binaryvalue' it_should_behave_like 'returnsame_integerkey_hashvalue' it_should_behave_like 'returnsame_numberkey_objectvalue' it_should_behave_like 'returnsame_numberkey_stringvalue' it_should_behave_like 'returnsame_numberkey_binaryvalue' it_should_behave_like 'returnsame_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/expires_memory_with_default_expires_spec.rb000066400000000000000000000221071232153565500271740ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "expires_memory_with_default_expires" do def features [:create, :expires, :increment] end def new_store Moneta.build do use :Expires, :expires => 1 adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'default_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returnsame_objectkey_objectvalue' it_should_behave_like 'returnsame_objectkey_stringvalue' it_should_behave_like 'returnsame_objectkey_binaryvalue' it_should_behave_like 'returnsame_objectkey_hashvalue' it_should_behave_like 'returnsame_stringkey_objectvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_stringkey_binaryvalue' it_should_behave_like 'returnsame_stringkey_hashvalue' it_should_behave_like 'returnsame_binarykey_objectvalue' it_should_behave_like 'returnsame_binarykey_stringvalue' it_should_behave_like 'returnsame_binarykey_binaryvalue' it_should_behave_like 'returnsame_binarykey_hashvalue' it_should_behave_like 'returnsame_hashkey_objectvalue' it_should_behave_like 'returnsame_hashkey_stringvalue' it_should_behave_like 'returnsame_hashkey_binaryvalue' it_should_behave_like 'returnsame_hashkey_hashvalue' it_should_behave_like 'returnsame_booleankey_objectvalue' it_should_behave_like 'returnsame_booleankey_stringvalue' it_should_behave_like 'returnsame_booleankey_binaryvalue' it_should_behave_like 'returnsame_booleankey_hashvalue' it_should_behave_like 'returnsame_nilkey_objectvalue' it_should_behave_like 'returnsame_nilkey_stringvalue' it_should_behave_like 'returnsame_nilkey_binaryvalue' it_should_behave_like 'returnsame_nilkey_hashvalue' it_should_behave_like 'returnsame_integerkey_objectvalue' it_should_behave_like 'returnsame_integerkey_stringvalue' it_should_behave_like 'returnsame_integerkey_binaryvalue' it_should_behave_like 'returnsame_integerkey_hashvalue' it_should_behave_like 'returnsame_numberkey_objectvalue' it_should_behave_like 'returnsame_numberkey_stringvalue' it_should_behave_like 'returnsame_numberkey_binaryvalue' it_should_behave_like 'returnsame_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/lock_spec.rb000066400000000000000000000216271232153565500205650ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "lock" do def features [:create, :increment] end def new_store Moneta.build do use :Lock adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returnsame_objectkey_objectvalue' it_should_behave_like 'returnsame_objectkey_stringvalue' it_should_behave_like 'returnsame_objectkey_binaryvalue' it_should_behave_like 'returnsame_objectkey_hashvalue' it_should_behave_like 'returnsame_stringkey_objectvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_stringkey_binaryvalue' it_should_behave_like 'returnsame_stringkey_hashvalue' it_should_behave_like 'returnsame_binarykey_objectvalue' it_should_behave_like 'returnsame_binarykey_stringvalue' it_should_behave_like 'returnsame_binarykey_binaryvalue' it_should_behave_like 'returnsame_binarykey_hashvalue' it_should_behave_like 'returnsame_hashkey_objectvalue' it_should_behave_like 'returnsame_hashkey_stringvalue' it_should_behave_like 'returnsame_hashkey_binaryvalue' it_should_behave_like 'returnsame_hashkey_hashvalue' it_should_behave_like 'returnsame_booleankey_objectvalue' it_should_behave_like 'returnsame_booleankey_stringvalue' it_should_behave_like 'returnsame_booleankey_binaryvalue' it_should_behave_like 'returnsame_booleankey_hashvalue' it_should_behave_like 'returnsame_nilkey_objectvalue' it_should_behave_like 'returnsame_nilkey_stringvalue' it_should_behave_like 'returnsame_nilkey_binaryvalue' it_should_behave_like 'returnsame_nilkey_hashvalue' it_should_behave_like 'returnsame_integerkey_objectvalue' it_should_behave_like 'returnsame_integerkey_stringvalue' it_should_behave_like 'returnsame_integerkey_binaryvalue' it_should_behave_like 'returnsame_integerkey_hashvalue' it_should_behave_like 'returnsame_numberkey_objectvalue' it_should_behave_like 'returnsame_numberkey_stringvalue' it_should_behave_like 'returnsame_numberkey_binaryvalue' it_should_behave_like 'returnsame_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/mutex_spec.rb000066400000000000000000000031301232153565500207640ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "mutex" do def features [] end def new_store Moneta.new(:Memory, :logger => {:file => File.join(make_tempdir, 'mutex.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it 'should have #lock' do mutex = Moneta::Mutex.new(store, 'mutex') mutex.lock.should be_true mutex.locked?.should be_true expect do mutex.lock end.to raise_error(RuntimeError) expect do mutex.try_lock end.to raise_error(RuntimeError) mutex.unlock.should be_nil mutex.locked?.should be_false end it 'should have #enter' do mutex = Moneta::Mutex.new(store, 'mutex') mutex.enter.should be_true mutex.locked?.should be_true expect do mutex.enter end.to raise_error(RuntimeError) expect do mutex.try_enter end.to raise_error(RuntimeError) mutex.leave.should be_nil mutex.locked?.should be_false end it 'should lock with #lock' do a = Moneta::Mutex.new(store, 'mutex') b = Moneta::Mutex.new(store, 'mutex') a.lock.should be_true b.try_lock.should be_false a.unlock.should be_nil end it 'should have lock timeout' do a = Moneta::Mutex.new(store, 'mutex') b = Moneta::Mutex.new(store, 'mutex') a.lock.should be_true b.lock(1).should be_false a.unlock.should be_nil end it 'should have #synchronize' do mutex = Moneta::Mutex.new(store, 'mutex') mutex.synchronize do mutex.locked?.should be_true end mutex.locked?.should be_false end end ruby-moneta-0.7.20/spec/moneta/null_adapter_spec.rb000066400000000000000000000072241232153565500223040ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "null_adapter" do def features [] end def new_store Moneta::Adapters::Null.new end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' end ruby-moneta-0.7.20/spec/moneta/optionmerger_spec.rb000066400000000000000000000117271232153565500223470ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "optionmerger" do def features [] end def new_store Moneta.new(:Memory, :logger => {:file => File.join(make_tempdir, 'optionmerger.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it '#with should return OptionMerger' do options = {:optionname => :optionvalue} merger = store.with(options) merger.should be_instance_of(Moneta::OptionMerger) end it 'saves default options' do options = {:optionname => :optionvalue} merger = store.with(options) Moneta::OptionMerger::METHODS.each do |method| merger.default_options[method].should equal(options) end end PREFIX = [['alpha', nil], ['beta', nil], ['alpha', 'beta']] it 'merges options' do merger = store.with(:opt1 => :val1, :opt2 => :val2).with(:opt2 => :overwrite, :opt3 => :val3) Moneta::OptionMerger::METHODS.each do |method| merger.default_options[method].should == {:opt1 => :val1, :opt2 => :overwrite, :opt3 => :val3} end end it 'merges options only for some methods' do PREFIX.each do |(alpha,beta)| options = {:opt1 => :val1, :opt2 => :val2, :prefix => alpha} merger = store.with(options).with(:opt2 => :overwrite, :opt3 => :val3, :prefix => beta, :only => :clear) (Moneta::OptionMerger::METHODS - [:clear]).each do |method| merger.default_options[method].should equal(options) end merger.default_options[:clear].should == {:opt1 => :val1, :opt2 => :overwrite, :opt3 => :val3, :prefix => "#{alpha}#{beta}"} merger = store.with(options).with(:opt2 => :overwrite, :opt3 => :val3, :prefix => beta, :only => [:load, :store]) (Moneta::OptionMerger::METHODS - [:load, :store]).each do |method| merger.default_options[method].should equal(options) end merger.default_options[:load].should == {:opt1 => :val1, :opt2 => :overwrite, :opt3 => :val3, :prefix => "#{alpha}#{beta}"} merger.default_options[:store].should == {:opt1 => :val1, :opt2 => :overwrite, :opt3 => :val3, :prefix => "#{alpha}#{beta}"} end end it 'merges options except for some methods' do PREFIX.each do |(alpha,beta)| options = {:opt1 => :val1, :opt2 => :val2, :prefix => alpha} merger = store.with(options).with(:opt2 => :overwrite, :opt3 => :val3, :except => :clear, :prefix => beta) (Moneta::OptionMerger::METHODS - [:clear]).each do |method| merger.default_options[method].should == {:opt1 => :val1, :opt2 => :overwrite, :opt3 => :val3, :prefix => "#{alpha}#{beta}"} end merger.default_options[:clear].should equal(options) merger = store.with(options).with(:opt2 => :overwrite, :opt3 => :val3, :prefix => beta, :except => [:load, :store]) (Moneta::OptionMerger::METHODS - [:load, :store]).each do |method| merger.default_options[method].should == {:opt1 => :val1, :opt2 => :overwrite, :opt3 => :val3, :prefix => "#{alpha}#{beta}"} end merger.default_options[:load].should equal(options) merger.default_options[:store].should equal(options) end end it 'has method #raw' do store.raw.default_options.should == {:store=>{:raw=>true},:create=>{:raw=>true},:load=>{:raw=>true},:delete=>{:raw=>true}} store.raw.should equal(store.raw.raw) end it 'has method #expires' do store.expires(10).default_options.should == {:store=>{:expires=>10},:create=>{:expires=>10},:increment=>{:expires=>10}} end it 'has method #prefix' do store.prefix('a').default_options.should == {:store=>{:prefix=>'a'},:load=>{:prefix=>'a'},:create=>{:prefix=>'a'}, :delete=>{:prefix=>'a'},:key? => {:prefix=>'a'},:increment=>{:prefix=>'a'}} store.prefix('a').prefix('b').default_options.should == {:store=>{:prefix=>'ab'},:load=>{:prefix=>'ab'},:create=>{:prefix=>'ab'}, :delete=>{:prefix=>'ab'},:key? => {:prefix=>'ab'},:increment=>{:prefix=>'ab'}} store.raw.prefix('b').default_options.should == {:store=>{:raw=>true,:prefix=>'b'},:load=>{:raw=>true,:prefix=>'b'},:create=>{:raw=>true,:prefix=>'b'},:delete=>{:raw=>true,:prefix=>'b'},:key? => {:prefix=>'b'},:increment=>{:prefix=>'b'}} store.prefix('a').raw.default_options.should == {:store=>{:raw=>true,:prefix=>'a'},:load=>{:raw=>true,:prefix=>'a'},:create=>{:raw=>true,:prefix=>'a'},:delete=>{:raw=>true,:prefix=>'a'},:key? => {:prefix=>'a'},:increment=>{:prefix=>'a'}} end it 'supports adding proxis using #with' do compressed_store = store.with(:prefix => 'compressed') do use :Transformer, :value => :zlib end store['key'] = 'uncompressed value' compressed_store['key'] = 'compressed value' store['key'].should == 'uncompressed value' compressed_store['key'].should == 'compressed value' store.key?('compressedkey').should be_true # Check if value is compressed compressed_store['key'].should_not == store['compressedkey'] end end ruby-moneta-0.7.20/spec/moneta/pool_spec.rb000066400000000000000000000021031232153565500205720ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "pool" do def features [:create, :increment] end def new_store Moneta.build do use :Pool do adapter :File, :dir => File.join(make_tempdir, "pool") end end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/proxy_expires_memory_spec.rb000066400000000000000000000220411232153565500241340ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "proxy_expires_memory" do def features [:create, :expires, :increment] end def new_store Moneta.build do use :Proxy use :Expires use :Proxy adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returnsame_objectkey_objectvalue' it_should_behave_like 'returnsame_objectkey_stringvalue' it_should_behave_like 'returnsame_objectkey_binaryvalue' it_should_behave_like 'returnsame_objectkey_hashvalue' it_should_behave_like 'returnsame_stringkey_objectvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_stringkey_binaryvalue' it_should_behave_like 'returnsame_stringkey_hashvalue' it_should_behave_like 'returnsame_binarykey_objectvalue' it_should_behave_like 'returnsame_binarykey_stringvalue' it_should_behave_like 'returnsame_binarykey_binaryvalue' it_should_behave_like 'returnsame_binarykey_hashvalue' it_should_behave_like 'returnsame_hashkey_objectvalue' it_should_behave_like 'returnsame_hashkey_stringvalue' it_should_behave_like 'returnsame_hashkey_binaryvalue' it_should_behave_like 'returnsame_hashkey_hashvalue' it_should_behave_like 'returnsame_booleankey_objectvalue' it_should_behave_like 'returnsame_booleankey_stringvalue' it_should_behave_like 'returnsame_booleankey_binaryvalue' it_should_behave_like 'returnsame_booleankey_hashvalue' it_should_behave_like 'returnsame_nilkey_objectvalue' it_should_behave_like 'returnsame_nilkey_stringvalue' it_should_behave_like 'returnsame_nilkey_binaryvalue' it_should_behave_like 'returnsame_nilkey_hashvalue' it_should_behave_like 'returnsame_integerkey_objectvalue' it_should_behave_like 'returnsame_integerkey_stringvalue' it_should_behave_like 'returnsame_integerkey_binaryvalue' it_should_behave_like 'returnsame_integerkey_hashvalue' it_should_behave_like 'returnsame_numberkey_objectvalue' it_should_behave_like 'returnsame_numberkey_stringvalue' it_should_behave_like 'returnsame_numberkey_binaryvalue' it_should_behave_like 'returnsame_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/proxy_redis_spec.rb000066400000000000000000000021721232153565500221760ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "proxy_redis" do def features [:create, :expires, :increment] end def new_store Moneta.build do use :Proxy use :Proxy adapter :Redis end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/semaphore_spec.rb000066400000000000000000000040321232153565500216070ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "semaphore" do def features [] end def new_store Moneta.new(:Memory, :logger => {:file => File.join(make_tempdir, 'semaphore.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it 'should have #lock' do mutex = Moneta::Semaphore.new(store, 'semaphore') mutex.lock.should be_true mutex.locked?.should be_true expect do mutex.lock end.to raise_error(RuntimeError) expect do mutex.try_lock end.to raise_error(RuntimeError) mutex.unlock.should be_nil mutex.locked?.should be_false end it 'should have #enter' do mutex = Moneta::Semaphore.new(store, 'semaphore') mutex.enter.should be_true mutex.locked?.should be_true expect do mutex.enter end.to raise_error(RuntimeError) expect do mutex.try_enter end.to raise_error(RuntimeError) mutex.leave.should be_nil mutex.locked?.should be_false end it 'should lock with #lock' do a = Moneta::Semaphore.new(store, 'semaphore') b = Moneta::Semaphore.new(store, 'semaphore') a.lock.should be_true b.try_lock.should be_false a.unlock.should be_nil end it 'should have lock timeout' do a = Moneta::Semaphore.new(store, 'semaphore') b = Moneta::Semaphore.new(store, 'semaphore') a.lock.should be_true b.lock(1).should be_false a.unlock.should be_nil end it 'should count concurrent accesses' do a = Moneta::Semaphore.new(store, 'semaphore', 2) b = Moneta::Semaphore.new(store, 'semaphore', 2) c = Moneta::Semaphore.new(store, 'semaphore', 2) a.synchronize do a.locked?.should be_true b.synchronize do b.locked?.should be_true c.try_lock.should be_false end end end it 'should have #synchronize' do semaphore = Moneta::Semaphore.new(store, 'semaphore') semaphore.synchronize do semaphore.locked?.should be_true end semaphore.locked?.should be_false end end ruby-moneta-0.7.20/spec/moneta/shared_tcp_spec.rb000066400000000000000000000024631232153565500217460ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "shared_tcp" do def features [:create, :increment] end def new_store Moneta.build do use(:Shared, :port => 9001) do adapter :PStore, :file => File.join(make_tempdir, 'shared_tcp') end end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' it 'shares values' do store['shared_key'] = 'shared_value' second = new_store second.key?('shared_key').should be_true second['shared_key'].should == 'shared_value' second.close end end ruby-moneta-0.7.20/spec/moneta/shared_unix_spec.rb000066400000000000000000000025401232153565500221370ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "shared_unix" do def features [:create, :increment] end def new_store Moneta.build do use(:Shared, :socket => File.join(make_tempdir, 'shared_unix.socket')) do adapter :PStore, :file => File.join(make_tempdir, 'shared_unix') end end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' it 'shares values' do store['shared_key'] = 'shared_value' second = new_store second.key?('shared_key').should be_true second['shared_key'].should == 'shared_value' second.close end end ruby-moneta-0.7.20/spec/moneta/stack_file_memory_spec.rb000066400000000000000000000021501232153565500233170ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "stack_file_memory" do def features [] end def new_store Moneta.build do use(:Stack) do add(Moneta.new(:Null)) add(Moneta::Adapters::Null.new) add { adapter :File, :dir => File.join(make_tempdir, "stack_file_memory") } add { adapter :Memory } end end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'features' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/stack_memory_file_spec.rb000066400000000000000000000021751232153565500233260ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "stack_memory_file" do def features [:create, :increment] end def new_store Moneta.build do use(:Stack) do add { adapter :Memory } add { adapter :File, :dir => File.join(make_tempdir, "stack_memory_file") } end end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/standard_activerecord_spec.rb000066400000000000000000000317241232153565500241660ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_activerecord" do def features [:create, :increment] end def new_store Moneta.new(:ActiveRecord, :table => 'standard_activerecord', :connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :database => 'moneta', :username => 'root' }, :logger => {:file => File.join(make_tempdir, 'standard_activerecord.log')}) end def load_value(value) ::Marshal.load(value.unpack('m').first) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_activerecord_with_expires_spec.rb000066400000000000000000000321521232153565500267540ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_activerecord_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:ActiveRecord, :table => 'standard_activerecord_with_expires', :connection => { :adapter => (defined?(JRUBY_VERSION) ? 'jdbcmysql' : 'mysql2'), :database => 'moneta', :username => 'root' }, :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_activerecord_with_expires.log')}) end def load_value(value) ::Marshal.load(value.unpack('m').first) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_cassandra_spec.rb000066400000000000000000000313721232153565500234520ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_cassandra" do def features [:expires] end def new_store Moneta.new(:Cassandra, :keyspace => "simple_cassandra", :logger => {:file => File.join(make_tempdir, 'standard_cassandra.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_client_tcp_spec.rb000066400000000000000000000323471232153565500236420ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_client_tcp" do start_server(Moneta::Adapters::Memory.new) def features [:create, :increment] end def new_store Moneta.new(:Client, :logger => {:file => File.join(make_tempdir, 'standard_client_tcp.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'supports multiple clients' do client = Moneta.new(:Client) client['shared_key'] = 'shared_val' (1..100).each do |i| Thread.new do client = Moneta.new(:Client) (1.100).each do |j| client['shared_key'].should == 'shared_val' client["key-#{j}-#{i}"] = "val-#{j}-#{i}" client["key-#{j}-#{i}"].should == "val-#{j}-#{i}" end end end end end ruby-moneta-0.7.20/spec/moneta/standard_client_unix_spec.rb000066400000000000000000000316731232153565500240400ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_client_unix" do start_server(Moneta::Adapters::Memory.new, :socket => File.join(make_tempdir, 'standard_client_unix')) def features [:create, :increment] end def new_store Moneta.new(:Client, :socket => File.join(make_tempdir, 'standard_client_unix'), :logger => {:file => File.join(make_tempdir, 'standard_client_unix.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_couch_spec.rb000066400000000000000000000313771232153565500226210ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_couch" do def features [:create] end def new_store Moneta.new(:Couch, :db => 'standard_couch', :logger => {:file => File.join(make_tempdir, 'standard_couch.log')}) end def load_value(value) ::Marshal.load(value.unpack('m').first) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'not_increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_couch_with_expires_spec.rb000066400000000000000000000316251232153565500254070ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_couch_with_expires" do def features [:create, :expires] end def new_store Moneta.new(:Couch, :db => 'standard_couch_with_expires', :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_couch_with_expires.log')}) end def load_value(value) ::Marshal.load(value.unpack('m').first) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'not_increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_datamapper_spec.rb000066400000000000000000000316111232153565500236250ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_datamapper" do require 'dm-core' DataMapper.setup(:default, :adapter => :in_memory) def features [:create] end def new_store Moneta.new(:DataMapper, :setup => "mysql://root:@localhost/moneta", :table => "simple_datamapper", :logger => {:file => File.join(make_tempdir, 'standard_datamapper.log')}) end def load_value(value) ::Marshal.load(value.unpack('m').first) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'not_increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_datamapper_with_expires_spec.rb000066400000000000000000000320371232153565500264220ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_datamapper_with_expires" do require 'dm-core' DataMapper.setup(:default, :adapter => :in_memory) def features [:create, :expires] end def new_store Moneta.new(:DataMapper, :setup => "mysql://root:@localhost/moneta", :table => "simple_datamapper_with_expires", :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_datamapper_with_expires.log')}) end def load_value(value) ::Marshal.load(value.unpack('m').first) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'not_increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_datamapper_with_repository_spec.rb000066400000000000000000000317171232153565500271660ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_datamapper_with_repository" do require 'dm-core' DataMapper.setup(:default, :adapter => :in_memory) def features [:create] end def new_store Moneta.new(:DataMapper, :repository => :repo, :setup => "mysql://root:@localhost/moneta", :table => "simple_datamapper_with_repository", :logger => {:file => File.join(make_tempdir, 'standard_datamapper_with_repository.log')}) end def load_value(value) ::Marshal.load(value.unpack('m').first) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'not_increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_daybreak_spec.rb000066400000000000000000000313051232153565500232710ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_daybreak" do def features [:create, :increment] end def new_store Moneta.new(:Daybreak, :file => File.join(make_tempdir, "simple_daybreak"), :logger => {:file => File.join(make_tempdir, 'standard_daybreak.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_daybreak_with_expires_spec.rb000066400000000000000000000315331232153565500260660ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_daybreak_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:Daybreak, :file => File.join(make_tempdir, "simple_daybreak_with_expires"), :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_daybreak_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_dbm_spec.rb000066400000000000000000000312611232153565500222520ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_dbm" do def features [:create, :increment] end def new_store Moneta.new(:DBM, :file => File.join(make_tempdir, "simple_dbm"), :logger => {:file => File.join(make_tempdir, 'standard_dbm.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_dbm_with_expires_spec.rb000066400000000000000000000315071232153565500250470ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_dbm_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:DBM, :file => File.join(make_tempdir, "simple_dbm_with_expires"), :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_dbm_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_file_spec.rb000066400000000000000000000314661232153565500224360ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_file" do def features [:create, :increment] end def new_store Moneta.new(:File, :dir => File.join(make_tempdir, "simple_file"), :logger => {:file => File.join(make_tempdir, 'standard_file.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_file_with_expires_spec.rb000066400000000000000000000317141232153565500252240ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_file_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:File, :dir => File.join(make_tempdir, "simple_file_with_expires"), :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_file_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_fog_spec.rb000066400000000000000000000315771232153565500222750ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_fog" do require 'fog' Fog.mock! def features [] end def new_store Moneta.new(:Fog, :aws_access_key_id => 'fake_access_key_id', :aws_secret_access_key => 'fake_secret_access_key', :provider => 'AWS', :dir => 'standard_fog', :logger => {:file => File.join(make_tempdir, 'standard_fog.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'features' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_fog_with_expires_spec.rb000066400000000000000000000320011232153565500250460ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_fog_with_expires" do require 'fog' Fog.mock! def features [:expires] end def new_store Moneta.new(:Fog, :aws_access_key_id => 'fake_access_key_id', :aws_secret_access_key => 'fake_secret_access_key', :provider => 'AWS', :dir => 'standard_fog_with_expires', :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_fog_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_gdbm_spec.rb000066400000000000000000000312651232153565500224250ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_gdbm" do def features [:create, :increment] end def new_store Moneta.new(:GDBM, :file => File.join(make_tempdir, "simple_gdbm"), :logger => {:file => File.join(make_tempdir, 'standard_gdbm.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_gdbm_with_expires_spec.rb000066400000000000000000000315131232153565500252130ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_gdbm_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:GDBM, :file => File.join(make_tempdir, "simple_gdbm_with_expires"), :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_gdbm_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_hashfile_spec.rb000066400000000000000000000315061232153565500232750ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_hashfile" do def features [:create, :increment] end def new_store Moneta.new(:HashFile, :dir => File.join(make_tempdir, "simple_hashfile"), :logger => {:file => File.join(make_tempdir, 'standard_hashfile.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_hashfile_with_expires_spec.rb000066400000000000000000000317341232153565500260720ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_hashfile_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:HashFile, :dir => File.join(make_tempdir, "simple_hashfile_with_expires"), :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_hashfile_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_hbase_spec.rb000066400000000000000000000313621232153565500225740ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_hbase" do def features [:increment] end def new_store Moneta.new(:HBase, :table => "simple_hbase", :logger => {:file => File.join(make_tempdir, 'standard_hbase.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_increment' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_hbase_with_expires_spec.rb000066400000000000000000000316541232153565500253720ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_hbase_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:HBase, :table => "simple_hbase", :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_hbase_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_kyotocabinet_spec.rb000066400000000000000000000313311232153565500242010ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_kyotocabinet" do def features [:create, :increment] end def new_store Moneta.new(:KyotoCabinet, :file => File.join(make_tempdir, "simple_kyotocabinet.kch"), :logger => {:file => File.join(make_tempdir, 'standard_kyotocabinet.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_kyotocabinet_with_expires_spec.rb000066400000000000000000000315571232153565500270050ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_kyotocabinet_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:KyotoCabinet, :file => File.join(make_tempdir, "simple_kyotocabinet_with_expires.kch"), :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_kyotocabinet_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_leveldb_spec.rb000066400000000000000000000313001232153565500231170ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_leveldb" do def features [:create, :increment] end def new_store Moneta.new(:LevelDB, :dir => File.join(make_tempdir, "simple_leveldb"), :logger => {:file => File.join(make_tempdir, 'standard_leveldb.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_leveldb_with_expires_spec.rb000066400000000000000000000315261232153565500257230ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_leveldb_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:LevelDB, :dir => File.join(make_tempdir, "simple_leveldb_with_expires"), :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_leveldb_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_lmdb_spec.rb000066400000000000000000000313331232153565500224260ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_lmdb" do def features [:create, :increment] end def new_store Moneta.new(:LMDB, :dir => File.join(make_tempdir, "simple_lmdb"), :logger => {:file => File.join(make_tempdir, 'standard_lmdb.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_lmdb_with_expires_spec.rb000066400000000000000000000315611232153565500252230ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_lmdb_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:LMDB, :dir => File.join(make_tempdir, "simple_lmdb_with_expires"), :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_lmdb_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_localmemcache_spec.rb000066400000000000000000000313651232153565500242720ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_localmemcache" do def features [] end def new_store Moneta.new(:LocalMemCache, :file => File.join(make_tempdir, "simple_localmemcache"), :logger => {:file => File.join(make_tempdir, 'standard_localmemcache.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'features' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_localmemcache_with_expires_spec.rb000066400000000000000000000315401232153565500270570ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_localmemcache_with_expires" do def features [:expires] end def new_store Moneta.new(:LocalMemCache, :file => File.join(make_tempdir, "simple_localmemcache_with_expires"), :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_localmemcache_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_lruhash_spec.rb000066400000000000000000000223431232153565500231570ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_lruhash" do def features [:create, :increment] end def new_store Moneta.new(:LRUHash, :logger => {:file => File.join(make_tempdir, 'standard_lruhash.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_lruhash_with_expires_spec.rb000066400000000000000000000225541232153565500257550ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_lruhash_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:LRUHash, :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_lruhash_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_memcached_dalli_spec.rb000066400000000000000000000316431232153565500245670ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_memcached_dalli" do def features [:create, :expires, :increment] end def new_store Moneta.new(:MemcachedDalli, :namespace => "simple_memcached_dalli", :logger => {:file => File.join(make_tempdir, 'standard_memcached_dalli.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_memcached_native_spec.rb000066400000000000000000000316471232153565500247740ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_memcached_native" do def features [:create, :expires, :increment] end def new_store Moneta.new(:MemcachedNative, :namespace => "simple_memcached_native", :logger => {:file => File.join(make_tempdir, 'standard_memcached_native.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_memcached_spec.rb000066400000000000000000000316141232153565500234200ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_memcached" do def features [:create, :expires, :increment] end def new_store Moneta.new(:Memcached, :namespace => "simple_memcached", :logger => {:file => File.join(make_tempdir, 'standard_memcached.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_memory_spec.rb000066400000000000000000000223401232153565500230160ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_memory" do def features [:create, :increment] end def new_store Moneta.new(:Memory, :logger => {:file => File.join(make_tempdir, 'standard_memory.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_memory_with_compress_spec.rb000066400000000000000000000224501232153565500257660ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_memory_with_compress" do def features [:create, :increment] end def new_store Moneta.new(:Memory, :compress => true, :logger => {:file => File.join(make_tempdir, 'standard_memory_with_compress.log')}) end def load_value(value) Marshal.load(::Zlib::Inflate.inflate(value)) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_memory_with_expires_spec.rb000066400000000000000000000225511232153565500256140ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_memory_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:Memory, :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_memory_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_memory_with_json_key_serializer_spec.rb000066400000000000000000000076311232153565500302110ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_memory_with_json_key_serializer" do def features [:create, :increment] end def new_store Moneta.new(:Memory, :key_serializer => :json, :logger => {:file => File.join(make_tempdir, 'standard_memory_with_json_key_serializer.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_memory_with_json_serializer_spec.rb000066400000000000000000000036671232153565500273460ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_memory_with_json_serializer" do def features [:create, :increment] end def new_store Moneta.new(:Memory, :serializer => :json, :logger => {:file => File.join(make_tempdir, 'standard_memory_with_json_serializer.log')}) end def load_value(value) ::MultiJson.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'not_persist' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_memory_with_json_value_serializer_spec.rb000066400000000000000000000102251232153565500305260ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_memory_with_json_value_serializer" do def features [:create, :increment] end def new_store Moneta.new(:Memory, :value_serializer => :json, :logger => {:file => File.join(make_tempdir, 'standard_memory_with_json_value_serializer.log')}) end def load_value(value) ::MultiJson.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_memory_with_prefix_spec.rb000066400000000000000000000224151232153565500254310ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_memory_with_prefix" do def features [:create, :increment] end def new_store Moneta.new(:Memory, :prefix => "moneta", :logger => {:file => File.join(make_tempdir, 'standard_memory_with_prefix.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_memory_with_snappy_compress_spec.rb000066400000000000000000000224621232153565500273630ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_memory_with_snappy_compress" do def features [:create, :increment] end def new_store Moneta.new(:Memory, :compress => :snappy, :logger => {:file => File.join(make_tempdir, 'standard_memory_with_snappy_compress.log')}) end def load_value(value) Marshal.load(::Snappy.inflate(value)) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_mongo_spec.rb000066400000000000000000000315671232153565500226400ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_mongo" do def features [:create, :expires, :increment] end def new_store Moneta.new(:Mongo, :db => 'standard_mongo', :logger => {:file => File.join(make_tempdir, 'standard_mongo.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_null_spec.rb000066400000000000000000000134021232153565500224570ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_null" do def features [] end def new_store Moneta.new(:Null, :logger => {:file => File.join(make_tempdir, 'standard_null.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'features' it_should_behave_like 'marshallable_key' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' end ruby-moneta-0.7.20/spec/moneta/standard_pstore_spec.rb000066400000000000000000000314611232153565500230260ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_pstore" do def features [:create, :increment] end def new_store Moneta.new(:PStore, :file => File.join(make_tempdir, "simple_pstore"), :logger => {:file => File.join(make_tempdir, 'standard_pstore.log')}) end def load_value(value) value end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_pstore_with_expires_spec.rb000066400000000000000000000317071232153565500256230ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_pstore_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:PStore, :file => File.join(make_tempdir, "simple_pstore_with_expires"), :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_pstore_with_expires.log')}) end def load_value(value) value end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_redis_spec.rb000066400000000000000000000315361232153565500226230ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_redis" do def features [:create, :expires, :increment] end def new_store Moneta.new(:Redis, :logger => {:file => File.join(make_tempdir, 'standard_redis.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_restclient_spec.rb000066400000000000000000000313561232153565500236710ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_restclient" do start_restserver def features [] end def new_store Moneta.new(:RestClient, :url => 'http://localhost:8808/moneta/', :logger => {:file => File.join(make_tempdir, 'standard_restclient.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'features' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_riak_spec.rb000066400000000000000000000313701232153565500224370ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_riak" do require 'riak' Riak.disable_list_keys_warnings = true def features [] end def new_store Moneta.new(:Riak, :bucket => 'standard_riak', :logger => {:file => File.join(make_tempdir, 'standard_riak.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'features' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_riak_with_expires_spec.rb000066400000000000000000000315431232153565500252330ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_riak_with_expires" do require 'riak' Riak.disable_list_keys_warnings = true def features [:expires] end def new_store Moneta.new(:Riak, :bucket => 'standard_riak_with_expires', :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_riak_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'not_increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_sdbm_spec.rb000066400000000000000000000312171232153565500224360ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_sdbm" do def features [:create, :increment] end def new_store Moneta.new(:SDBM, :file => File.join(make_tempdir, "simple_sdbm"), :logger => {:file => File.join(make_tempdir, 'standard_sdbm.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_sdbm_with_expires_spec.rb000066400000000000000000000314451232153565500252330ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_sdbm_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:SDBM, :file => File.join(make_tempdir, "simple_sdbm_with_expires"), :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_sdbm_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_sequel_spec.rb000066400000000000000000000316331232153565500230110ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_sequel" do def features [:create, :increment] end def new_store Moneta.new(:Sequel, :db => (defined?(JRUBY_VERSION) ? "jdbc:mysql://localhost/moneta?user=root" : "mysql2://root:@localhost/moneta"), :table => "simple_sequel", :logger => {:file => File.join(make_tempdir, 'standard_sequel.log')}) end def load_value(value) ::Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_sequel_with_expires_spec.rb000066400000000000000000000320611232153565500255770ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_sequel_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:Sequel, :db => (defined?(JRUBY_VERSION) ? "jdbc:mysql://localhost/moneta?user=root" : "mysql2://root:@localhost/moneta"), :table => "simple_sequel_with_expires", :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_sequel_with_expires.log')}) end def load_value(value) ::Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_sqlite_spec.rb000066400000000000000000000313441232153565500230130ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_sqlite" do def features [:create, :increment] end def new_store Moneta.new(:Sqlite, :file => File.join(make_tempdir, "simple_sqlite"), :logger => {:file => File.join(make_tempdir, 'standard_sqlite.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_sqlite_with_expires_spec.rb000066400000000000000000000315721232153565500256100ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_sqlite_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:Sqlite, :file => File.join(make_tempdir, "simple_sqlite_with_expires"), :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_sqlite_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_tdb_spec.rb000066400000000000000000000312611232153565500222610ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_tdb" do def features [:create, :increment] end def new_store Moneta.new(:TDB, :file => File.join(make_tempdir, "simple_tdb"), :logger => {:file => File.join(make_tempdir, 'standard_tdb.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_tdb_with_expires_spec.rb000066400000000000000000000315071232153565500250560ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_tdb_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:TDB, :file => File.join(make_tempdir, "simple_tdb_with_expires"), :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_tdb_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_tokyocabinet_spec.rb000066400000000000000000000313251232153565500242040ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_tokyocabinet" do def features [:create, :increment] end def new_store Moneta.new(:TokyoCabinet, :file => File.join(make_tempdir, "simple_tokyocabinet"), :logger => {:file => File.join(make_tempdir, 'standard_tokyocabinet.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_tokyocabinet_with_expires_spec.rb000066400000000000000000000315531232153565500270010ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_tokyocabinet_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:TokyoCabinet, :file => File.join(make_tempdir, "simple_tokyocabinet_with_expires"), :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_tokyocabinet_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_tokyotyrant_spec.rb000066400000000000000000000314331232153565500241200ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_tokyotyrant" do def features [:create, :increment] end def new_store Moneta.new(:TokyoTyrant, :logger => {:file => File.join(make_tempdir, 'standard_tokyotyrant.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_tokyotyrant_with_expires_spec.rb000066400000000000000000000316441232153565500267160ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_tokyotyrant_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:TokyoTyrant, :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_tokyotyrant_with_expires.log')}) end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'concurrent_create' it_should_behave_like 'concurrent_increment' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/standard_yaml_spec.rb000066400000000000000000000312411232153565500224500ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_yaml" do def features [:create, :increment] end def new_store Moneta.new(:YAML, :file => File.join(make_tempdir, "simple_yaml"), :logger => {:file => File.join(make_tempdir, 'standard_yaml.log')}) end def load_value(value) value end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' end ruby-moneta-0.7.20/spec/moneta/standard_yaml_with_expires_spec.rb000066400000000000000000000314671232153565500252540ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "standard_yaml_with_expires" do def features [:create, :expires, :increment] end def new_store Moneta.new(:YAML, :file => File.join(make_tempdir, "simple_yaml_with_expires"), :expires => true, :logger => {:file => File.join(make_tempdir, 'standard_yaml_with_expires.log')}) end def load_value(value) value end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'create_expires' it_should_behave_like 'expires' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'multiprocess' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'persist_objectkey_objectvalue' it_should_behave_like 'persist_objectkey_stringvalue' it_should_behave_like 'persist_objectkey_binaryvalue' it_should_behave_like 'persist_objectkey_hashvalue' it_should_behave_like 'persist_objectkey_booleanvalue' it_should_behave_like 'persist_objectkey_nilvalue' it_should_behave_like 'persist_objectkey_integervalue' it_should_behave_like 'persist_objectkey_numbervalue' it_should_behave_like 'persist_stringkey_objectvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_stringkey_binaryvalue' it_should_behave_like 'persist_stringkey_hashvalue' it_should_behave_like 'persist_stringkey_booleanvalue' it_should_behave_like 'persist_stringkey_nilvalue' it_should_behave_like 'persist_stringkey_integervalue' it_should_behave_like 'persist_stringkey_numbervalue' it_should_behave_like 'persist_binarykey_objectvalue' it_should_behave_like 'persist_binarykey_stringvalue' it_should_behave_like 'persist_binarykey_binaryvalue' it_should_behave_like 'persist_binarykey_hashvalue' it_should_behave_like 'persist_binarykey_booleanvalue' it_should_behave_like 'persist_binarykey_nilvalue' it_should_behave_like 'persist_binarykey_integervalue' it_should_behave_like 'persist_binarykey_numbervalue' it_should_behave_like 'persist_hashkey_objectvalue' it_should_behave_like 'persist_hashkey_stringvalue' it_should_behave_like 'persist_hashkey_binaryvalue' it_should_behave_like 'persist_hashkey_hashvalue' it_should_behave_like 'persist_hashkey_booleanvalue' it_should_behave_like 'persist_hashkey_nilvalue' it_should_behave_like 'persist_hashkey_integervalue' it_should_behave_like 'persist_hashkey_numbervalue' it_should_behave_like 'persist_booleankey_objectvalue' it_should_behave_like 'persist_booleankey_stringvalue' it_should_behave_like 'persist_booleankey_binaryvalue' it_should_behave_like 'persist_booleankey_hashvalue' it_should_behave_like 'persist_booleankey_booleanvalue' it_should_behave_like 'persist_booleankey_nilvalue' it_should_behave_like 'persist_booleankey_integervalue' it_should_behave_like 'persist_booleankey_numbervalue' it_should_behave_like 'persist_nilkey_objectvalue' it_should_behave_like 'persist_nilkey_stringvalue' it_should_behave_like 'persist_nilkey_binaryvalue' it_should_behave_like 'persist_nilkey_hashvalue' it_should_behave_like 'persist_nilkey_booleanvalue' it_should_behave_like 'persist_nilkey_nilvalue' it_should_behave_like 'persist_nilkey_integervalue' it_should_behave_like 'persist_nilkey_numbervalue' it_should_behave_like 'persist_integerkey_objectvalue' it_should_behave_like 'persist_integerkey_stringvalue' it_should_behave_like 'persist_integerkey_binaryvalue' it_should_behave_like 'persist_integerkey_hashvalue' it_should_behave_like 'persist_integerkey_booleanvalue' it_should_behave_like 'persist_integerkey_nilvalue' it_should_behave_like 'persist_integerkey_integervalue' it_should_behave_like 'persist_integerkey_numbervalue' it_should_behave_like 'persist_numberkey_objectvalue' it_should_behave_like 'persist_numberkey_stringvalue' it_should_behave_like 'persist_numberkey_binaryvalue' it_should_behave_like 'persist_numberkey_hashvalue' it_should_behave_like 'persist_numberkey_booleanvalue' it_should_behave_like 'persist_numberkey_nilvalue' it_should_behave_like 'persist_numberkey_integervalue' it_should_behave_like 'persist_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value_expires' end ruby-moneta-0.7.20/spec/moneta/transformer_bencode_spec.rb000066400000000000000000000037541232153565500236570ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_bencode" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => :bencode, :value => :bencode adapter :Memory end end def load_value(value) ::BEncode.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::BencodeKeyBencodeValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_bert_spec.rb000066400000000000000000000037341232153565500232120ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_bert" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => :bert, :value => :bert adapter :Memory end end def load_value(value) ::BERT.decode(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::BertKeyBertValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_bson_spec.rb000066400000000000000000000037461232153565500232220ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_bson" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => :bson, :value => :bson adapter :Memory end end def load_value(value) ::BSON.deserialize(value)['v'] end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::BsonKeyBsonValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_bzip2_spec.rb000066400000000000000000000037561232153565500233100ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_bzip2" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :value => :bzip2 adapter :Memory end end def load_value(value) ::Bzip2.uncompress(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::Bzip2Value.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_json_spec.rb000066400000000000000000000037371232153565500232320ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_json" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => :json, :value => :json adapter :Memory end end def load_value(value) ::MultiJson.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::JsonKeyJsonValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_key_inspect_spec.rb000066400000000000000000000074611232153565500245740ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_key_inspect" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => :inspect adapter :Memory end end def load_value(value) value end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'returnsame_stringkey_objectvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_stringkey_binaryvalue' it_should_behave_like 'returnsame_stringkey_hashvalue' it_should_behave_like 'returnsame_hashkey_objectvalue' it_should_behave_like 'returnsame_hashkey_stringvalue' it_should_behave_like 'returnsame_hashkey_binaryvalue' it_should_behave_like 'returnsame_hashkey_hashvalue' it_should_behave_like 'returnsame_integerkey_objectvalue' it_should_behave_like 'returnsame_integerkey_stringvalue' it_should_behave_like 'returnsame_integerkey_binaryvalue' it_should_behave_like 'returnsame_integerkey_hashvalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::InspectKey.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_key_marshal_spec.rb000066400000000000000000000220651232153565500245530ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_key_marshal" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => :marshal adapter :Memory end end def load_value(value) value end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returnsame_objectkey_objectvalue' it_should_behave_like 'returnsame_objectkey_stringvalue' it_should_behave_like 'returnsame_objectkey_binaryvalue' it_should_behave_like 'returnsame_objectkey_hashvalue' it_should_behave_like 'returnsame_stringkey_objectvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_stringkey_binaryvalue' it_should_behave_like 'returnsame_stringkey_hashvalue' it_should_behave_like 'returnsame_binarykey_objectvalue' it_should_behave_like 'returnsame_binarykey_stringvalue' it_should_behave_like 'returnsame_binarykey_binaryvalue' it_should_behave_like 'returnsame_binarykey_hashvalue' it_should_behave_like 'returnsame_hashkey_objectvalue' it_should_behave_like 'returnsame_hashkey_stringvalue' it_should_behave_like 'returnsame_hashkey_binaryvalue' it_should_behave_like 'returnsame_hashkey_hashvalue' it_should_behave_like 'returnsame_booleankey_objectvalue' it_should_behave_like 'returnsame_booleankey_stringvalue' it_should_behave_like 'returnsame_booleankey_binaryvalue' it_should_behave_like 'returnsame_booleankey_hashvalue' it_should_behave_like 'returnsame_nilkey_objectvalue' it_should_behave_like 'returnsame_nilkey_stringvalue' it_should_behave_like 'returnsame_nilkey_binaryvalue' it_should_behave_like 'returnsame_nilkey_hashvalue' it_should_behave_like 'returnsame_integerkey_objectvalue' it_should_behave_like 'returnsame_integerkey_stringvalue' it_should_behave_like 'returnsame_integerkey_binaryvalue' it_should_behave_like 'returnsame_integerkey_hashvalue' it_should_behave_like 'returnsame_numberkey_objectvalue' it_should_behave_like 'returnsame_numberkey_stringvalue' it_should_behave_like 'returnsame_numberkey_binaryvalue' it_should_behave_like 'returnsame_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalKey.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_key_to_s_spec.rb000066400000000000000000000074501232153565500240710ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_key_to_s" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => :to_s adapter :Memory end end def load_value(value) value end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'returnsame_stringkey_objectvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_stringkey_binaryvalue' it_should_behave_like 'returnsame_stringkey_hashvalue' it_should_behave_like 'returnsame_hashkey_objectvalue' it_should_behave_like 'returnsame_hashkey_stringvalue' it_should_behave_like 'returnsame_hashkey_binaryvalue' it_should_behave_like 'returnsame_hashkey_hashvalue' it_should_behave_like 'returnsame_integerkey_objectvalue' it_should_behave_like 'returnsame_integerkey_stringvalue' it_should_behave_like 'returnsame_integerkey_binaryvalue' it_should_behave_like 'returnsame_integerkey_hashvalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::To_sKey.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_key_yaml_spec.rb000066400000000000000000000220541232153565500240640ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_key_yaml" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => :yaml adapter :Memory end end def load_value(value) value end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returnsame_objectkey_objectvalue' it_should_behave_like 'returnsame_objectkey_stringvalue' it_should_behave_like 'returnsame_objectkey_binaryvalue' it_should_behave_like 'returnsame_objectkey_hashvalue' it_should_behave_like 'returnsame_stringkey_objectvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_stringkey_binaryvalue' it_should_behave_like 'returnsame_stringkey_hashvalue' it_should_behave_like 'returnsame_binarykey_objectvalue' it_should_behave_like 'returnsame_binarykey_stringvalue' it_should_behave_like 'returnsame_binarykey_binaryvalue' it_should_behave_like 'returnsame_binarykey_hashvalue' it_should_behave_like 'returnsame_hashkey_objectvalue' it_should_behave_like 'returnsame_hashkey_stringvalue' it_should_behave_like 'returnsame_hashkey_binaryvalue' it_should_behave_like 'returnsame_hashkey_hashvalue' it_should_behave_like 'returnsame_booleankey_objectvalue' it_should_behave_like 'returnsame_booleankey_stringvalue' it_should_behave_like 'returnsame_booleankey_binaryvalue' it_should_behave_like 'returnsame_booleankey_hashvalue' it_should_behave_like 'returnsame_nilkey_objectvalue' it_should_behave_like 'returnsame_nilkey_stringvalue' it_should_behave_like 'returnsame_nilkey_binaryvalue' it_should_behave_like 'returnsame_nilkey_hashvalue' it_should_behave_like 'returnsame_integerkey_objectvalue' it_should_behave_like 'returnsame_integerkey_stringvalue' it_should_behave_like 'returnsame_integerkey_binaryvalue' it_should_behave_like 'returnsame_integerkey_hashvalue' it_should_behave_like 'returnsame_numberkey_objectvalue' it_should_behave_like 'returnsame_numberkey_stringvalue' it_should_behave_like 'returnsame_numberkey_binaryvalue' it_should_behave_like 'returnsame_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::YamlKey.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_lz4_spec.rb000066400000000000000000000037461232153565500227720ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_lz4" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :value => :lz4 adapter :Memory end end def load_value(value) ::LZ4.uncompress(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::Lz4Value.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_lzma_spec.rb000066400000000000000000000037521232153565500232210ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_lzma" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :value => :lzma adapter :Memory end end def load_value(value) ::LZMA.decompress(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::LzmaValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_lzo_spec.rb000066400000000000000000000037461232153565500230650ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_lzo" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :value => :lzo adapter :Memory end end def load_value(value) ::LZO.decompress(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::LzoValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_base64_spec.rb000066400000000000000000000226721232153565500250530ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_base64" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :base64], :value => [:marshal, :base64] adapter :Memory end end def load_value(value) ::Marshal.load(value.unpack('m').first) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalBase64KeyMarshalBase64Value.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_city128_spec.rb000066400000000000000000000226301232153565500251640ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_city128" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :city128], :value => :marshal adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalCity128KeyMarshalValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_city32_spec.rb000066400000000000000000000226251232153565500251020ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_city32" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :city32], :value => :marshal adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalCity32KeyMarshalValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_city64_spec.rb000066400000000000000000000226251232153565500251070ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_city64" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :city64], :value => :marshal adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalCity64KeyMarshalValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_escape_spec.rb000066400000000000000000000226251232153565500252250ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_escape" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :escape], :value => :marshal adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalEscapeKeyMarshalValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_hex_spec.rb000066400000000000000000000226461232153565500245540ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_hex" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :hex], :value => [:marshal, :hex] adapter :Memory end end def load_value(value) ::Marshal.load([value].pack('H*')) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalHexKeyMarshalHexValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_hmac_spec.rb000066400000000000000000000227321232153565500246740ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_hmac" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => :marshal, :value => [:marshal, :hmac], :secret => 'secret' adapter :Memory end end def load_value(value) ::Marshal.load(::Moneta::Transformer::Helper.hmacverify(value, 'secret')) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalKeyMarshalHmacValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_md5_spec.rb000066400000000000000000000226141232153565500244500ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_md5" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :md5], :value => :marshal adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalMd5KeyMarshalValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_md5_spread_spec.rb000066400000000000000000000226421232153565500260070ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_md5_spread" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :md5, :spread], :value => :marshal adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalMd5SpreadKeyMarshalValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_prefix_spec.rb000066400000000000000000000226521232153565500252620ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_prefix" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :prefix], :value => :marshal, :prefix => 'moneta' adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalPrefixKeyMarshalValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_qp_spec.rb000066400000000000000000000226461232153565500244100ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_qp" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :qp], :value => [:marshal, :qp] adapter :Memory end end def load_value(value) ::Marshal.load(value.unpack('M').first) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalQpKeyMarshalQpValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_rmd160_spec.rb000066400000000000000000000226251232153565500247760ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_rmd160" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :rmd160], :value => :marshal adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalRmd160KeyMarshalValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_sha1_spec.rb000066400000000000000000000226171232153565500246220ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_sha1" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :sha1], :value => :marshal adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalSha1KeyMarshalValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_sha256_spec.rb000066400000000000000000000226251232153565500247750ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_sha256" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :sha256], :value => :marshal adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalSha256KeyMarshalValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_sha384_spec.rb000066400000000000000000000226251232153565500247770ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_sha384" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :sha384], :value => :marshal adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalSha384KeyMarshalValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_sha512_spec.rb000066400000000000000000000226251232153565500247700ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_sha512" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :sha512], :value => :marshal adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalSha512KeyMarshalValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_spec.rb000066400000000000000000000224011232153565500236750ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => :marshal, :value => :marshal adapter :Memory end end def load_value(value) ::Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalKeyMarshalValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_truncate_spec.rb000066400000000000000000000226521232153565500256120ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_truncate" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :truncate], :value => :marshal, :maxlen => 64 adapter :Memory end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalTruncateKeyMarshalValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_marshal_uuencode_spec.rb000066400000000000000000000227041232153565500255720ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_marshal_uuencode" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => [:marshal, :uuencode], :value => [:marshal, :uuencode] adapter :Memory end end def load_value(value) ::Marshal.load(value.unpack('u').first) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'marshallable_key' it_should_behave_like 'marshallable_value' it_should_behave_like 'not_persist' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalUuencodeKeyMarshalUuencodeValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_msgpack_spec.rb000066400000000000000000000037621232153565500237040ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_msgpack" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => :msgpack, :value => :msgpack adapter :Memory end end def load_value(value) ::MessagePack.unpack(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MsgpackKeyMsgpackValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_ox_spec.rb000066400000000000000000000223501232153565500226770ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_ox" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => :ox, :value => :ox adapter :Memory end end def load_value(value) ::Ox.parse_obj(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::OxKeyOxValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_php_spec.rb000066400000000000000000000037331232153565500230440ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_php" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => :php, :value => :php adapter :Memory end end def load_value(value) ::PHP.unserialize(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::PhpKeyPhpValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_quicklz_spec.rb000066400000000000000000000037661232153565500237450ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_quicklz" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :value => :quicklz adapter :Memory end end def load_value(value) ::QuickLZ.decompress(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::QuicklzValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_snappy_spec.rb000066400000000000000000000037571232153565500235750ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_snappy" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :value => :snappy adapter :Memory end end def load_value(value) ::Snappy.inflate(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::SnappyValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_tnet_spec.rb000066400000000000000000000037451232153565500232320ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_tnet" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => :tnet, :value => :tnet adapter :Memory end end def load_value(value) ::TNetstring.parse(value).first end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::TnetKeyTnetValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_value_marshal_spec.rb000066400000000000000000000223531232153565500250770ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_value_marshal" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :value => :marshal adapter :Memory end end def load_value(value) ::Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::MarshalValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_value_yaml_spec.rb000066400000000000000000000223371232153565500244140ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_value_yaml" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :value => :yaml adapter :Memory end end def load_value(value) ::YAML.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::YamlValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_yaml_spec.rb000066400000000000000000000223571232153565500232220ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_yaml" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :key => :yaml, :value => :yaml adapter :Memory end end def load_value(value) ::YAML.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_objectkey_objectvalue' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_objectkey_binaryvalue' it_should_behave_like 'null_objectkey_hashvalue' it_should_behave_like 'null_objectkey_booleanvalue' it_should_behave_like 'null_objectkey_nilvalue' it_should_behave_like 'null_objectkey_integervalue' it_should_behave_like 'null_objectkey_numbervalue' it_should_behave_like 'null_stringkey_objectvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_stringkey_binaryvalue' it_should_behave_like 'null_stringkey_hashvalue' it_should_behave_like 'null_stringkey_booleanvalue' it_should_behave_like 'null_stringkey_nilvalue' it_should_behave_like 'null_stringkey_integervalue' it_should_behave_like 'null_stringkey_numbervalue' it_should_behave_like 'null_binarykey_objectvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_binarykey_binaryvalue' it_should_behave_like 'null_binarykey_hashvalue' it_should_behave_like 'null_binarykey_booleanvalue' it_should_behave_like 'null_binarykey_nilvalue' it_should_behave_like 'null_binarykey_integervalue' it_should_behave_like 'null_binarykey_numbervalue' it_should_behave_like 'null_hashkey_objectvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_hashkey_binaryvalue' it_should_behave_like 'null_hashkey_hashvalue' it_should_behave_like 'null_hashkey_booleanvalue' it_should_behave_like 'null_hashkey_nilvalue' it_should_behave_like 'null_hashkey_integervalue' it_should_behave_like 'null_hashkey_numbervalue' it_should_behave_like 'null_booleankey_objectvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_booleankey_binaryvalue' it_should_behave_like 'null_booleankey_hashvalue' it_should_behave_like 'null_booleankey_booleanvalue' it_should_behave_like 'null_booleankey_nilvalue' it_should_behave_like 'null_booleankey_integervalue' it_should_behave_like 'null_booleankey_numbervalue' it_should_behave_like 'null_nilkey_objectvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_nilkey_binaryvalue' it_should_behave_like 'null_nilkey_hashvalue' it_should_behave_like 'null_nilkey_booleanvalue' it_should_behave_like 'null_nilkey_nilvalue' it_should_behave_like 'null_nilkey_integervalue' it_should_behave_like 'null_nilkey_numbervalue' it_should_behave_like 'null_integerkey_objectvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_integerkey_binaryvalue' it_should_behave_like 'null_integerkey_hashvalue' it_should_behave_like 'null_integerkey_booleanvalue' it_should_behave_like 'null_integerkey_nilvalue' it_should_behave_like 'null_integerkey_integervalue' it_should_behave_like 'null_integerkey_numbervalue' it_should_behave_like 'null_numberkey_objectvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'null_numberkey_binaryvalue' it_should_behave_like 'null_numberkey_hashvalue' it_should_behave_like 'null_numberkey_booleanvalue' it_should_behave_like 'null_numberkey_nilvalue' it_should_behave_like 'null_numberkey_integervalue' it_should_behave_like 'null_numberkey_numbervalue' it_should_behave_like 'returndifferent_objectkey_objectvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_binaryvalue' it_should_behave_like 'returndifferent_objectkey_hashvalue' it_should_behave_like 'returndifferent_stringkey_objectvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_binaryvalue' it_should_behave_like 'returndifferent_stringkey_hashvalue' it_should_behave_like 'returndifferent_binarykey_objectvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_binarykey_binaryvalue' it_should_behave_like 'returndifferent_binarykey_hashvalue' it_should_behave_like 'returndifferent_hashkey_objectvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_hashkey_binaryvalue' it_should_behave_like 'returndifferent_hashkey_hashvalue' it_should_behave_like 'returndifferent_booleankey_objectvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_booleankey_binaryvalue' it_should_behave_like 'returndifferent_booleankey_hashvalue' it_should_behave_like 'returndifferent_nilkey_objectvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_nilkey_binaryvalue' it_should_behave_like 'returndifferent_nilkey_hashvalue' it_should_behave_like 'returndifferent_integerkey_objectvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_binaryvalue' it_should_behave_like 'returndifferent_integerkey_hashvalue' it_should_behave_like 'returndifferent_numberkey_objectvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_binaryvalue' it_should_behave_like 'returndifferent_numberkey_hashvalue' it_should_behave_like 'store_objectkey_objectvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_objectkey_binaryvalue' it_should_behave_like 'store_objectkey_hashvalue' it_should_behave_like 'store_objectkey_booleanvalue' it_should_behave_like 'store_objectkey_nilvalue' it_should_behave_like 'store_objectkey_integervalue' it_should_behave_like 'store_objectkey_numbervalue' it_should_behave_like 'store_stringkey_objectvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_stringkey_binaryvalue' it_should_behave_like 'store_stringkey_hashvalue' it_should_behave_like 'store_stringkey_booleanvalue' it_should_behave_like 'store_stringkey_nilvalue' it_should_behave_like 'store_stringkey_integervalue' it_should_behave_like 'store_stringkey_numbervalue' it_should_behave_like 'store_binarykey_objectvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_binarykey_binaryvalue' it_should_behave_like 'store_binarykey_hashvalue' it_should_behave_like 'store_binarykey_booleanvalue' it_should_behave_like 'store_binarykey_nilvalue' it_should_behave_like 'store_binarykey_integervalue' it_should_behave_like 'store_binarykey_numbervalue' it_should_behave_like 'store_hashkey_objectvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_hashkey_binaryvalue' it_should_behave_like 'store_hashkey_hashvalue' it_should_behave_like 'store_hashkey_booleanvalue' it_should_behave_like 'store_hashkey_nilvalue' it_should_behave_like 'store_hashkey_integervalue' it_should_behave_like 'store_hashkey_numbervalue' it_should_behave_like 'store_booleankey_objectvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_booleankey_binaryvalue' it_should_behave_like 'store_booleankey_hashvalue' it_should_behave_like 'store_booleankey_booleanvalue' it_should_behave_like 'store_booleankey_nilvalue' it_should_behave_like 'store_booleankey_integervalue' it_should_behave_like 'store_booleankey_numbervalue' it_should_behave_like 'store_nilkey_objectvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_nilkey_binaryvalue' it_should_behave_like 'store_nilkey_hashvalue' it_should_behave_like 'store_nilkey_booleanvalue' it_should_behave_like 'store_nilkey_nilvalue' it_should_behave_like 'store_nilkey_integervalue' it_should_behave_like 'store_nilkey_numbervalue' it_should_behave_like 'store_integerkey_objectvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_integerkey_binaryvalue' it_should_behave_like 'store_integerkey_hashvalue' it_should_behave_like 'store_integerkey_booleanvalue' it_should_behave_like 'store_integerkey_nilvalue' it_should_behave_like 'store_integerkey_integervalue' it_should_behave_like 'store_integerkey_numbervalue' it_should_behave_like 'store_numberkey_objectvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_numberkey_binaryvalue' it_should_behave_like 'store_numberkey_hashvalue' it_should_behave_like 'store_numberkey_booleanvalue' it_should_behave_like 'store_numberkey_nilvalue' it_should_behave_like 'store_numberkey_integervalue' it_should_behave_like 'store_numberkey_numbervalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::YamlKeyYamlValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/transformer_zlib_spec.rb000066400000000000000000000037601232153565500232150ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "transformer_zlib" do def features [:create, :increment] end def new_store Moneta.build do use :Transformer, :value => :zlib adapter :Memory end end def load_value(value) ::Zlib::Inflate.inflate(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'null_objectkey_stringvalue' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_binarykey_stringvalue' it_should_behave_like 'null_hashkey_stringvalue' it_should_behave_like 'null_booleankey_stringvalue' it_should_behave_like 'null_nilkey_stringvalue' it_should_behave_like 'null_integerkey_stringvalue' it_should_behave_like 'null_numberkey_stringvalue' it_should_behave_like 'returndifferent_objectkey_stringvalue' it_should_behave_like 'returndifferent_stringkey_stringvalue' it_should_behave_like 'returndifferent_binarykey_stringvalue' it_should_behave_like 'returndifferent_hashkey_stringvalue' it_should_behave_like 'returndifferent_booleankey_stringvalue' it_should_behave_like 'returndifferent_nilkey_stringvalue' it_should_behave_like 'returndifferent_integerkey_stringvalue' it_should_behave_like 'returndifferent_numberkey_stringvalue' it_should_behave_like 'store_objectkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_binarykey_stringvalue' it_should_behave_like 'store_hashkey_stringvalue' it_should_behave_like 'store_booleankey_stringvalue' it_should_behave_like 'store_nilkey_stringvalue' it_should_behave_like 'store_integerkey_stringvalue' it_should_behave_like 'store_numberkey_stringvalue' it_should_behave_like 'store_large' it_should_behave_like 'transform_value' it 'compile transformer class' do store.should_not be_nil Moneta::Transformer::ZlibValue.should_not be_nil end end ruby-moneta-0.7.20/spec/moneta/weak_create_spec.rb000066400000000000000000000022231232153565500220760ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "weak_create" do require 'fog' Fog.mock! def features [:create] end def new_store Moneta.build do use :WeakCreate adapter :Fog, :aws_access_key_id => 'fake_access_key_id', :aws_secret_access_key => 'fake_secret_access_key', :provider => 'AWS', :dir => 'weak_create' end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'create' it_should_behave_like 'features' it_should_behave_like 'multiprocess' it_should_behave_like 'not_increment' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/moneta/weak_increment_spec.rb000066400000000000000000000022371232153565500226240ustar00rootroot00000000000000# coding: binary # Generated by generate-specs require 'helper' describe_moneta "weak_increment" do require 'fog' Fog.mock! def features [:increment] end def new_store Moneta.build do use :WeakIncrement adapter :Fog, :aws_access_key_id => 'fake_access_key_id', :aws_secret_access_key => 'fake_secret_access_key', :provider => 'AWS', :dir => 'weak_increment' end end def load_value(value) Marshal.load(value) end include_context 'setup_store' it_should_behave_like 'features' it_should_behave_like 'increment' it_should_behave_like 'multiprocess' it_should_behave_like 'not_create' it_should_behave_like 'null_stringkey_stringvalue' it_should_behave_like 'null_pathkey_stringvalue' it_should_behave_like 'persist_stringkey_stringvalue' it_should_behave_like 'persist_pathkey_stringvalue' it_should_behave_like 'returnsame_stringkey_stringvalue' it_should_behave_like 'returnsame_pathkey_stringvalue' it_should_behave_like 'store_stringkey_stringvalue' it_should_behave_like 'store_pathkey_stringvalue' it_should_behave_like 'store_large' end ruby-moneta-0.7.20/spec/monetaspecs.rb000066400000000000000000060277051232153565500176720ustar00rootroot00000000000000# coding: binary # Generated by generate-specs #################### null_nilkey_nilvalue #################### shared_examples_for 'null_nilkey_nilvalue' do it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = '' store[0] = nil store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, '', options).should == '' end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = '' store[nil] = nil store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, '', options).should == '' end it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = nil store[0] = '' store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, nil, options).should == nil end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = nil store[nil] = '' store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, nil, options).should == nil end it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = 0 store[0] = false store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, 0, options).should == 0 end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = 0 store[nil] = false store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, 0, options).should == 0 end it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = false store[0] = 0 store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, false, options).should == false end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = false store[nil] = 0 store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, false, options).should == false end end #################### store_nilkey_nilvalue #################### shared_examples_for 'store_nilkey_nilvalue' do it 'writes values to keys that like a Hash' do store[nil] = '' store[nil].should == '' store.load(nil).should == '' end it 'returns true from #key? if a key is available' do store[nil] = '' store.key?(nil).should be_true end it 'stores values with #store' do value = '' store.store(nil, value).should equal(value) store[nil].should == '' store.load(nil).should == '' end it 'stores values after clear' do store[nil] = '' store[0] = nil store.clear.should equal(store) store[nil] = '' store[nil].should == '' store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = '' store.delete(nil).should == '' store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = '' store[nil].should == '' store[nil] = nil store[nil].should == nil end it 'stores frozen values' do value = ''.freeze (store[nil] = value).should equal(value) store[nil].should == '' end it 'stores frozen keys' do key = nil.freeze store[key] = '' store[nil].should == '' end it 'writes values to keys that like a Hash' do store[0] = '' store[0].should == '' store.load(0).should == '' end it 'returns true from #key? if a key is available' do store[0] = '' store.key?(0).should be_true end it 'stores values with #store' do value = '' store.store(0, value).should equal(value) store[0].should == '' store.load(0).should == '' end it 'stores values after clear' do store[0] = '' store[nil] = nil store.clear.should equal(store) store[0] = '' store[0].should == '' store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = '' store.delete(0).should == '' store.key?(0).should be_false end it 'overwrites existing values' do store[0] = '' store[0].should == '' store[0] = nil store[0].should == nil end it 'stores frozen values' do value = ''.freeze (store[0] = value).should equal(value) store[0].should == '' end it 'stores frozen keys' do key = 0.freeze store[key] = '' store[0].should == '' end it 'writes values to keys that like a Hash' do store[nil] = nil store[nil].should == nil store.load(nil).should == nil end it 'returns true from #key? if a key is available' do store[nil] = nil store.key?(nil).should be_true end it 'stores values with #store' do value = nil store.store(nil, value).should equal(value) store[nil].should == nil store.load(nil).should == nil end it 'stores values after clear' do store[nil] = nil store[0] = '' store.clear.should equal(store) store[nil] = nil store[nil].should == nil store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = nil store.delete(nil).should == nil store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = nil store[nil].should == nil store[nil] = '' store[nil].should == '' end it 'stores frozen values' do value = nil.freeze (store[nil] = value).should equal(value) store[nil].should == nil end it 'stores frozen keys' do key = nil.freeze store[key] = nil store[nil].should == nil end it 'writes values to keys that like a Hash' do store[0] = nil store[0].should == nil store.load(0).should == nil end it 'returns true from #key? if a key is available' do store[0] = nil store.key?(0).should be_true end it 'stores values with #store' do value = nil store.store(0, value).should equal(value) store[0].should == nil store.load(0).should == nil end it 'stores values after clear' do store[0] = nil store[nil] = '' store.clear.should equal(store) store[0] = nil store[0].should == nil store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = nil store.delete(0).should == nil store.key?(0).should be_false end it 'overwrites existing values' do store[0] = nil store[0].should == nil store[0] = '' store[0].should == '' end it 'stores frozen values' do value = nil.freeze (store[0] = value).should equal(value) store[0].should == nil end it 'stores frozen keys' do key = 0.freeze store[key] = nil store[0].should == nil end it 'writes values to keys that like a Hash' do store[nil] = 0 store[nil].should == 0 store.load(nil).should == 0 end it 'returns true from #key? if a key is available' do store[nil] = 0 store.key?(nil).should be_true end it 'stores values with #store' do value = 0 store.store(nil, value).should equal(value) store[nil].should == 0 store.load(nil).should == 0 end it 'stores values after clear' do store[nil] = 0 store[0] = false store.clear.should equal(store) store[nil] = 0 store[nil].should == 0 store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = 0 store.delete(nil).should == 0 store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = 0 store[nil].should == 0 store[nil] = false store[nil].should == false end it 'stores frozen values' do value = 0.freeze (store[nil] = value).should equal(value) store[nil].should == 0 end it 'stores frozen keys' do key = nil.freeze store[key] = 0 store[nil].should == 0 end it 'writes values to keys that like a Hash' do store[0] = 0 store[0].should == 0 store.load(0).should == 0 end it 'returns true from #key? if a key is available' do store[0] = 0 store.key?(0).should be_true end it 'stores values with #store' do value = 0 store.store(0, value).should equal(value) store[0].should == 0 store.load(0).should == 0 end it 'stores values after clear' do store[0] = 0 store[nil] = false store.clear.should equal(store) store[0] = 0 store[0].should == 0 store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = 0 store.delete(0).should == 0 store.key?(0).should be_false end it 'overwrites existing values' do store[0] = 0 store[0].should == 0 store[0] = false store[0].should == false end it 'stores frozen values' do value = 0.freeze (store[0] = value).should equal(value) store[0].should == 0 end it 'stores frozen keys' do key = 0.freeze store[key] = 0 store[0].should == 0 end it 'writes values to keys that like a Hash' do store[nil] = false store[nil].should == false store.load(nil).should == false end it 'returns true from #key? if a key is available' do store[nil] = false store.key?(nil).should be_true end it 'stores values with #store' do value = false store.store(nil, value).should equal(value) store[nil].should == false store.load(nil).should == false end it 'stores values after clear' do store[nil] = false store[0] = 0 store.clear.should equal(store) store[nil] = false store[nil].should == false store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = false store.delete(nil).should == false store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = false store[nil].should == false store[nil] = 0 store[nil].should == 0 end it 'stores frozen values' do value = false.freeze (store[nil] = value).should equal(value) store[nil].should == false end it 'stores frozen keys' do key = nil.freeze store[key] = false store[nil].should == false end it 'writes values to keys that like a Hash' do store[0] = false store[0].should == false store.load(0).should == false end it 'returns true from #key? if a key is available' do store[0] = false store.key?(0).should be_true end it 'stores values with #store' do value = false store.store(0, value).should equal(value) store[0].should == false store.load(0).should == false end it 'stores values after clear' do store[0] = false store[nil] = 0 store.clear.should equal(store) store[0] = false store[0].should == false store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = false store.delete(0).should == false store.key?(0).should be_false end it 'overwrites existing values' do store[0] = false store[0].should == false store[0] = 0 store[0].should == 0 end it 'stores frozen values' do value = false.freeze (store[0] = value).should equal(value) store[0].should == false end it 'stores frozen keys' do key = 0.freeze store[key] = false store[0].should == false end end #################### persist_nilkey_nilvalue #################### shared_examples_for 'persist_nilkey_nilvalue' do it 'persists values' do store[nil] = '' store.close @store = nil store[nil].should == '' end it 'persists values' do store[0] = '' store.close @store = nil store[0].should == '' end it 'persists values' do store[nil] = nil store.close @store = nil store[nil].should == nil end it 'persists values' do store[0] = nil store.close @store = nil store[0].should == nil end it 'persists values' do store[nil] = 0 store.close @store = nil store[nil].should == 0 end it 'persists values' do store[0] = 0 store.close @store = nil store[0].should == 0 end it 'persists values' do store[nil] = false store.close @store = nil store[nil].should == false end it 'persists values' do store[0] = false store.close @store = nil store[0].should == false end end #################### null_nilkey_integervalue #################### shared_examples_for 'null_nilkey_integervalue' do it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = 41 store[0] = -12 store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, 41, options).should == 41 end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = 41 store[nil] = -12 store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, 41, options).should == 41 end it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = -12 store[0] = 41 store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, -12, options).should == -12 end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = -12 store[nil] = 41 store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, -12, options).should == -12 end end #################### store_nilkey_integervalue #################### shared_examples_for 'store_nilkey_integervalue' do it 'writes values to keys that like a Hash' do store[nil] = 41 store[nil].should == 41 store.load(nil).should == 41 end it 'returns true from #key? if a key is available' do store[nil] = 41 store.key?(nil).should be_true end it 'stores values with #store' do value = 41 store.store(nil, value).should equal(value) store[nil].should == 41 store.load(nil).should == 41 end it 'stores values after clear' do store[nil] = 41 store[0] = -12 store.clear.should equal(store) store[nil] = 41 store[nil].should == 41 store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = 41 store.delete(nil).should == 41 store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = 41 store[nil].should == 41 store[nil] = -12 store[nil].should == -12 end it 'stores frozen values' do value = 41.freeze (store[nil] = value).should equal(value) store[nil].should == 41 end it 'stores frozen keys' do key = nil.freeze store[key] = 41 store[nil].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store[nil] = 41 store.fetch(nil, -12).should == 41 end it 'does not run the block in fetch if the key is available' do store[nil] = 41 unaltered = 'unaltered' store.fetch(nil) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0] = 41 store[0].should == 41 store.load(0).should == 41 end it 'returns true from #key? if a key is available' do store[0] = 41 store.key?(0).should be_true end it 'stores values with #store' do value = 41 store.store(0, value).should equal(value) store[0].should == 41 store.load(0).should == 41 end it 'stores values after clear' do store[0] = 41 store[nil] = -12 store.clear.should equal(store) store[0] = 41 store[0].should == 41 store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = 41 store.delete(0).should == 41 store.key?(0).should be_false end it 'overwrites existing values' do store[0] = 41 store[0].should == 41 store[0] = -12 store[0].should == -12 end it 'stores frozen values' do value = 41.freeze (store[0] = value).should equal(value) store[0].should == 41 end it 'stores frozen keys' do key = 0.freeze store[key] = 41 store[0].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store[0] = 41 store.fetch(0, -12).should == 41 end it 'does not run the block in fetch if the key is available' do store[0] = 41 unaltered = 'unaltered' store.fetch(0) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[nil] = -12 store[nil].should == -12 store.load(nil).should == -12 end it 'returns true from #key? if a key is available' do store[nil] = -12 store.key?(nil).should be_true end it 'stores values with #store' do value = -12 store.store(nil, value).should equal(value) store[nil].should == -12 store.load(nil).should == -12 end it 'stores values after clear' do store[nil] = -12 store[0] = 41 store.clear.should equal(store) store[nil] = -12 store[nil].should == -12 store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = -12 store.delete(nil).should == -12 store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = -12 store[nil].should == -12 store[nil] = 41 store[nil].should == 41 end it 'stores frozen values' do value = -12.freeze (store[nil] = value).should equal(value) store[nil].should == -12 end it 'stores frozen keys' do key = nil.freeze store[key] = -12 store[nil].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store[nil] = -12 store.fetch(nil, 41).should == -12 end it 'does not run the block in fetch if the key is available' do store[nil] = -12 unaltered = 'unaltered' store.fetch(nil) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0] = -12 store[0].should == -12 store.load(0).should == -12 end it 'returns true from #key? if a key is available' do store[0] = -12 store.key?(0).should be_true end it 'stores values with #store' do value = -12 store.store(0, value).should equal(value) store[0].should == -12 store.load(0).should == -12 end it 'stores values after clear' do store[0] = -12 store[nil] = 41 store.clear.should equal(store) store[0] = -12 store[0].should == -12 store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = -12 store.delete(0).should == -12 store.key?(0).should be_false end it 'overwrites existing values' do store[0] = -12 store[0].should == -12 store[0] = 41 store[0].should == 41 end it 'stores frozen values' do value = -12.freeze (store[0] = value).should equal(value) store[0].should == -12 end it 'stores frozen keys' do key = 0.freeze store[key] = -12 store[0].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store[0] = -12 store.fetch(0, 41).should == -12 end it 'does not run the block in fetch if the key is available' do store[0] = -12 unaltered = 'unaltered' store.fetch(0) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_nilkey_integervalue #################### shared_examples_for 'persist_nilkey_integervalue' do it 'persists values' do store[nil] = 41 store.close @store = nil store[nil].should == 41 end it 'persists values' do store[0] = 41 store.close @store = nil store[0].should == 41 end it 'persists values' do store[nil] = -12 store.close @store = nil store[nil].should == -12 end it 'persists values' do store[0] = -12 store.close @store = nil store[0].should == -12 end end #################### null_nilkey_numbervalue #################### shared_examples_for 'null_nilkey_numbervalue' do it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = 123.456 store[0] = -98.7 store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = 123.456 store[nil] = -98.7 store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = -98.7 store[0] = 123.456 store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = -98.7 store[nil] = 123.456 store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = 340282366920938463463374607431768211456 store[0] = 33 store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = 340282366920938463463374607431768211456 store[nil] = 33 store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = 33 store[0] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, 33, options).should == 33 end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = 33 store[nil] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, 33, options).should == 33 end end #################### store_nilkey_numbervalue #################### shared_examples_for 'store_nilkey_numbervalue' do it 'writes values to keys that like a Hash' do store[nil] = 123.456 store[nil].should == 123.456 store.load(nil).should == 123.456 end it 'returns true from #key? if a key is available' do store[nil] = 123.456 store.key?(nil).should be_true end it 'stores values with #store' do value = 123.456 store.store(nil, value).should equal(value) store[nil].should == 123.456 store.load(nil).should == 123.456 end it 'stores values after clear' do store[nil] = 123.456 store[0] = -98.7 store.clear.should equal(store) store[nil] = 123.456 store[nil].should == 123.456 store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = 123.456 store.delete(nil).should == 123.456 store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = 123.456 store[nil].should == 123.456 store[nil] = -98.7 store[nil].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store[nil] = value).should equal(value) store[nil].should == 123.456 end it 'stores frozen keys' do key = nil.freeze store[key] = 123.456 store[nil].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store[nil] = 123.456 store.fetch(nil, -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store[nil] = 123.456 unaltered = 'unaltered' store.fetch(nil) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0] = 123.456 store[0].should == 123.456 store.load(0).should == 123.456 end it 'returns true from #key? if a key is available' do store[0] = 123.456 store.key?(0).should be_true end it 'stores values with #store' do value = 123.456 store.store(0, value).should equal(value) store[0].should == 123.456 store.load(0).should == 123.456 end it 'stores values after clear' do store[0] = 123.456 store[nil] = -98.7 store.clear.should equal(store) store[0] = 123.456 store[0].should == 123.456 store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = 123.456 store.delete(0).should == 123.456 store.key?(0).should be_false end it 'overwrites existing values' do store[0] = 123.456 store[0].should == 123.456 store[0] = -98.7 store[0].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store[0] = value).should equal(value) store[0].should == 123.456 end it 'stores frozen keys' do key = 0.freeze store[key] = 123.456 store[0].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store[0] = 123.456 store.fetch(0, -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store[0] = 123.456 unaltered = 'unaltered' store.fetch(0) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[nil] = -98.7 store[nil].should == -98.7 store.load(nil).should == -98.7 end it 'returns true from #key? if a key is available' do store[nil] = -98.7 store.key?(nil).should be_true end it 'stores values with #store' do value = -98.7 store.store(nil, value).should equal(value) store[nil].should == -98.7 store.load(nil).should == -98.7 end it 'stores values after clear' do store[nil] = -98.7 store[0] = 123.456 store.clear.should equal(store) store[nil] = -98.7 store[nil].should == -98.7 store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = -98.7 store.delete(nil).should == -98.7 store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = -98.7 store[nil].should == -98.7 store[nil] = 123.456 store[nil].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store[nil] = value).should equal(value) store[nil].should == -98.7 end it 'stores frozen keys' do key = nil.freeze store[key] = -98.7 store[nil].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store[nil] = -98.7 store.fetch(nil, 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store[nil] = -98.7 unaltered = 'unaltered' store.fetch(nil) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0] = -98.7 store[0].should == -98.7 store.load(0).should == -98.7 end it 'returns true from #key? if a key is available' do store[0] = -98.7 store.key?(0).should be_true end it 'stores values with #store' do value = -98.7 store.store(0, value).should equal(value) store[0].should == -98.7 store.load(0).should == -98.7 end it 'stores values after clear' do store[0] = -98.7 store[nil] = 123.456 store.clear.should equal(store) store[0] = -98.7 store[0].should == -98.7 store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = -98.7 store.delete(0).should == -98.7 store.key?(0).should be_false end it 'overwrites existing values' do store[0] = -98.7 store[0].should == -98.7 store[0] = 123.456 store[0].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store[0] = value).should equal(value) store[0].should == -98.7 end it 'stores frozen keys' do key = 0.freeze store[key] = -98.7 store[0].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store[0] = -98.7 store.fetch(0, 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store[0] = -98.7 unaltered = 'unaltered' store.fetch(0) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[nil] = 340282366920938463463374607431768211456 store[nil].should == 340282366920938463463374607431768211456 store.load(nil).should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store[nil] = 340282366920938463463374607431768211456 store.key?(nil).should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store(nil, value).should equal(value) store[nil].should == 340282366920938463463374607431768211456 store.load(nil).should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store[nil] = 340282366920938463463374607431768211456 store[0] = 33 store.clear.should equal(store) store[nil] = 340282366920938463463374607431768211456 store[nil].should == 340282366920938463463374607431768211456 store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = 340282366920938463463374607431768211456 store.delete(nil).should == 340282366920938463463374607431768211456 store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = 340282366920938463463374607431768211456 store[nil].should == 340282366920938463463374607431768211456 store[nil] = 33 store[nil].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store[nil] = value).should equal(value) store[nil].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = nil.freeze store[key] = 340282366920938463463374607431768211456 store[nil].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store[nil] = 340282366920938463463374607431768211456 store.fetch(nil, 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store[nil] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch(nil) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0] = 340282366920938463463374607431768211456 store[0].should == 340282366920938463463374607431768211456 store.load(0).should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store[0] = 340282366920938463463374607431768211456 store.key?(0).should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store(0, value).should equal(value) store[0].should == 340282366920938463463374607431768211456 store.load(0).should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store[0] = 340282366920938463463374607431768211456 store[nil] = 33 store.clear.should equal(store) store[0] = 340282366920938463463374607431768211456 store[0].should == 340282366920938463463374607431768211456 store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = 340282366920938463463374607431768211456 store.delete(0).should == 340282366920938463463374607431768211456 store.key?(0).should be_false end it 'overwrites existing values' do store[0] = 340282366920938463463374607431768211456 store[0].should == 340282366920938463463374607431768211456 store[0] = 33 store[0].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store[0] = value).should equal(value) store[0].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = 0.freeze store[key] = 340282366920938463463374607431768211456 store[0].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store[0] = 340282366920938463463374607431768211456 store.fetch(0, 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store[0] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch(0) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[nil] = 33 store[nil].should == 33 store.load(nil).should == 33 end it 'returns true from #key? if a key is available' do store[nil] = 33 store.key?(nil).should be_true end it 'stores values with #store' do value = 33 store.store(nil, value).should equal(value) store[nil].should == 33 store.load(nil).should == 33 end it 'stores values after clear' do store[nil] = 33 store[0] = 340282366920938463463374607431768211456 store.clear.should equal(store) store[nil] = 33 store[nil].should == 33 store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = 33 store.delete(nil).should == 33 store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = 33 store[nil].should == 33 store[nil] = 340282366920938463463374607431768211456 store[nil].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store[nil] = value).should equal(value) store[nil].should == 33 end it 'stores frozen keys' do key = nil.freeze store[key] = 33 store[nil].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store[nil] = 33 store.fetch(nil, 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store[nil] = 33 unaltered = 'unaltered' store.fetch(nil) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0] = 33 store[0].should == 33 store.load(0).should == 33 end it 'returns true from #key? if a key is available' do store[0] = 33 store.key?(0).should be_true end it 'stores values with #store' do value = 33 store.store(0, value).should equal(value) store[0].should == 33 store.load(0).should == 33 end it 'stores values after clear' do store[0] = 33 store[nil] = 340282366920938463463374607431768211456 store.clear.should equal(store) store[0] = 33 store[0].should == 33 store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = 33 store.delete(0).should == 33 store.key?(0).should be_false end it 'overwrites existing values' do store[0] = 33 store[0].should == 33 store[0] = 340282366920938463463374607431768211456 store[0].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store[0] = value).should equal(value) store[0].should == 33 end it 'stores frozen keys' do key = 0.freeze store[key] = 33 store[0].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store[0] = 33 store.fetch(0, 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store[0] = 33 unaltered = 'unaltered' store.fetch(0) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_nilkey_numbervalue #################### shared_examples_for 'persist_nilkey_numbervalue' do it 'persists values' do store[nil] = 123.456 store.close @store = nil store[nil].should == 123.456 end it 'persists values' do store[0] = 123.456 store.close @store = nil store[0].should == 123.456 end it 'persists values' do store[nil] = -98.7 store.close @store = nil store[nil].should == -98.7 end it 'persists values' do store[0] = -98.7 store.close @store = nil store[0].should == -98.7 end it 'persists values' do store[nil] = 340282366920938463463374607431768211456 store.close @store = nil store[nil].should == 340282366920938463463374607431768211456 end it 'persists values' do store[0] = 340282366920938463463374607431768211456 store.close @store = nil store[0].should == 340282366920938463463374607431768211456 end it 'persists values' do store[nil] = 33 store.close @store = nil store[nil].should == 33 end it 'persists values' do store[0] = 33 store.close @store = nil store[0].should == 33 end end #################### null_nilkey_booleanvalue #################### shared_examples_for 'null_nilkey_booleanvalue' do it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = true store[0] = false store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, true, options).should == true end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = true store[nil] = false store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, true, options).should == true end it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = false store[0] = true store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, false, options).should == false end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = false store[nil] = true store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, false, options).should == false end end #################### store_nilkey_booleanvalue #################### shared_examples_for 'store_nilkey_booleanvalue' do it 'writes values to keys that like a Hash' do store[nil] = true store[nil].should == true store.load(nil).should == true end it 'returns true from #key? if a key is available' do store[nil] = true store.key?(nil).should be_true end it 'stores values with #store' do value = true store.store(nil, value).should equal(value) store[nil].should == true store.load(nil).should == true end it 'stores values after clear' do store[nil] = true store[0] = false store.clear.should equal(store) store[nil] = true store[nil].should == true store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = true store.delete(nil).should == true store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = true store[nil].should == true store[nil] = false store[nil].should == false end it 'stores frozen values' do value = true.freeze (store[nil] = value).should equal(value) store[nil].should == true end it 'stores frozen keys' do key = nil.freeze store[key] = true store[nil].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store[nil] = true store.fetch(nil, false).should == true end it 'does not run the block in fetch if the key is available' do store[nil] = true unaltered = 'unaltered' store.fetch(nil) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0] = true store[0].should == true store.load(0).should == true end it 'returns true from #key? if a key is available' do store[0] = true store.key?(0).should be_true end it 'stores values with #store' do value = true store.store(0, value).should equal(value) store[0].should == true store.load(0).should == true end it 'stores values after clear' do store[0] = true store[nil] = false store.clear.should equal(store) store[0] = true store[0].should == true store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = true store.delete(0).should == true store.key?(0).should be_false end it 'overwrites existing values' do store[0] = true store[0].should == true store[0] = false store[0].should == false end it 'stores frozen values' do value = true.freeze (store[0] = value).should equal(value) store[0].should == true end it 'stores frozen keys' do key = 0.freeze store[key] = true store[0].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store[0] = true store.fetch(0, false).should == true end it 'does not run the block in fetch if the key is available' do store[0] = true unaltered = 'unaltered' store.fetch(0) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[nil] = false store[nil].should == false store.load(nil).should == false end it 'returns true from #key? if a key is available' do store[nil] = false store.key?(nil).should be_true end it 'stores values with #store' do value = false store.store(nil, value).should equal(value) store[nil].should == false store.load(nil).should == false end it 'stores values after clear' do store[nil] = false store[0] = true store.clear.should equal(store) store[nil] = false store[nil].should == false store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = false store.delete(nil).should == false store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = false store[nil].should == false store[nil] = true store[nil].should == true end it 'stores frozen values' do value = false.freeze (store[nil] = value).should equal(value) store[nil].should == false end it 'stores frozen keys' do key = nil.freeze store[key] = false store[nil].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store[nil] = false store.fetch(nil, true).should == false end it 'does not run the block in fetch if the key is available' do store[nil] = false unaltered = 'unaltered' store.fetch(nil) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0] = false store[0].should == false store.load(0).should == false end it 'returns true from #key? if a key is available' do store[0] = false store.key?(0).should be_true end it 'stores values with #store' do value = false store.store(0, value).should equal(value) store[0].should == false store.load(0).should == false end it 'stores values after clear' do store[0] = false store[nil] = true store.clear.should equal(store) store[0] = false store[0].should == false store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = false store.delete(0).should == false store.key?(0).should be_false end it 'overwrites existing values' do store[0] = false store[0].should == false store[0] = true store[0].should == true end it 'stores frozen values' do value = false.freeze (store[0] = value).should equal(value) store[0].should == false end it 'stores frozen keys' do key = 0.freeze store[key] = false store[0].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store[0] = false store.fetch(0, true).should == false end it 'does not run the block in fetch if the key is available' do store[0] = false unaltered = 'unaltered' store.fetch(0) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_nilkey_booleanvalue #################### shared_examples_for 'persist_nilkey_booleanvalue' do it 'persists values' do store[nil] = true store.close @store = nil store[nil].should == true end it 'persists values' do store[0] = true store.close @store = nil store[0].should == true end it 'persists values' do store[nil] = false store.close @store = nil store[nil].should == false end it 'persists values' do store[0] = false store.close @store = nil store[0].should == false end end #################### null_nilkey_stringvalue #################### shared_examples_for 'null_nilkey_stringvalue' do it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = "strval1" store[0] = "strval2" store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = "strval1" store[nil] = "strval2" store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = "strval2" store[0] = "strval1" store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, "strval2", options).should == "strval2" end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = "strval2" store[nil] = "strval1" store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, "strval2", options).should == "strval2" end end #################### store_nilkey_stringvalue #################### shared_examples_for 'store_nilkey_stringvalue' do it 'writes values to keys that like a Hash' do store[nil] = "strval1" store[nil].should == "strval1" store.load(nil).should == "strval1" end it 'returns true from #key? if a key is available' do store[nil] = "strval1" store.key?(nil).should be_true end it 'stores values with #store' do value = "strval1" store.store(nil, value).should equal(value) store[nil].should == "strval1" store.load(nil).should == "strval1" end it 'stores values after clear' do store[nil] = "strval1" store[0] = "strval2" store.clear.should equal(store) store[nil] = "strval1" store[nil].should == "strval1" store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = "strval1" store.delete(nil).should == "strval1" store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = "strval1" store[nil].should == "strval1" store[nil] = "strval2" store[nil].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store[nil] = value).should equal(value) store[nil].should == "strval1" end it 'stores frozen keys' do key = nil.freeze store[key] = "strval1" store[nil].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store[nil] = "strval1" store.fetch(nil, "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store[nil] = "strval1" unaltered = 'unaltered' store.fetch(nil) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0] = "strval1" store[0].should == "strval1" store.load(0).should == "strval1" end it 'returns true from #key? if a key is available' do store[0] = "strval1" store.key?(0).should be_true end it 'stores values with #store' do value = "strval1" store.store(0, value).should equal(value) store[0].should == "strval1" store.load(0).should == "strval1" end it 'stores values after clear' do store[0] = "strval1" store[nil] = "strval2" store.clear.should equal(store) store[0] = "strval1" store[0].should == "strval1" store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = "strval1" store.delete(0).should == "strval1" store.key?(0).should be_false end it 'overwrites existing values' do store[0] = "strval1" store[0].should == "strval1" store[0] = "strval2" store[0].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store[0] = value).should equal(value) store[0].should == "strval1" end it 'stores frozen keys' do key = 0.freeze store[key] = "strval1" store[0].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store[0] = "strval1" store.fetch(0, "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store[0] = "strval1" unaltered = 'unaltered' store.fetch(0) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[nil] = "strval2" store[nil].should == "strval2" store.load(nil).should == "strval2" end it 'returns true from #key? if a key is available' do store[nil] = "strval2" store.key?(nil).should be_true end it 'stores values with #store' do value = "strval2" store.store(nil, value).should equal(value) store[nil].should == "strval2" store.load(nil).should == "strval2" end it 'stores values after clear' do store[nil] = "strval2" store[0] = "strval1" store.clear.should equal(store) store[nil] = "strval2" store[nil].should == "strval2" store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = "strval2" store.delete(nil).should == "strval2" store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = "strval2" store[nil].should == "strval2" store[nil] = "strval1" store[nil].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store[nil] = value).should equal(value) store[nil].should == "strval2" end it 'stores frozen keys' do key = nil.freeze store[key] = "strval2" store[nil].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store[nil] = "strval2" store.fetch(nil, "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store[nil] = "strval2" unaltered = 'unaltered' store.fetch(nil) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0] = "strval2" store[0].should == "strval2" store.load(0).should == "strval2" end it 'returns true from #key? if a key is available' do store[0] = "strval2" store.key?(0).should be_true end it 'stores values with #store' do value = "strval2" store.store(0, value).should equal(value) store[0].should == "strval2" store.load(0).should == "strval2" end it 'stores values after clear' do store[0] = "strval2" store[nil] = "strval1" store.clear.should equal(store) store[0] = "strval2" store[0].should == "strval2" store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = "strval2" store.delete(0).should == "strval2" store.key?(0).should be_false end it 'overwrites existing values' do store[0] = "strval2" store[0].should == "strval2" store[0] = "strval1" store[0].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store[0] = value).should equal(value) store[0].should == "strval2" end it 'stores frozen keys' do key = 0.freeze store[key] = "strval2" store[0].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store[0] = "strval2" store.fetch(0, "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store[0] = "strval2" unaltered = 'unaltered' store.fetch(0) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_nilkey_stringvalue #################### shared_examples_for 'returndifferent_nilkey_stringvalue' do it 'guarantees that a different value is retrieved' do value = "strval1" store[nil] = value store[nil].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval1" store[0] = value store[0].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store[nil] = value store[nil].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store[0] = value store[0].should_not be_equal(value) end end #################### returnsame_nilkey_stringvalue #################### shared_examples_for 'returnsame_nilkey_stringvalue' do it 'guarantees that the same value is retrieved' do value = "strval1" store[nil] = value store[nil].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval1" store[0] = value store[0].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store[nil] = value store[nil].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store[0] = value store[0].should be_equal(value) end end #################### persist_nilkey_stringvalue #################### shared_examples_for 'persist_nilkey_stringvalue' do it 'persists values' do store[nil] = "strval1" store.close @store = nil store[nil].should == "strval1" end it 'persists values' do store[0] = "strval1" store.close @store = nil store[0].should == "strval1" end it 'persists values' do store[nil] = "strval2" store.close @store = nil store[nil].should == "strval2" end it 'persists values' do store[0] = "strval2" store.close @store = nil store[0].should == "strval2" end end #################### null_nilkey_binaryvalue #################### shared_examples_for 'null_nilkey_binaryvalue' do it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = "über" store[0] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, "über", options).should == "über" end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = "über" store[nil] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, "über", options).should == "über" end it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = "\xAA\xBB\xCC" store[0] = "über" store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = "\xAA\xBB\xCC" store[nil] = "über" store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end end #################### store_nilkey_binaryvalue #################### shared_examples_for 'store_nilkey_binaryvalue' do it 'writes values to keys that like a Hash' do store[nil] = "über" store[nil].should == "über" store.load(nil).should == "über" end it 'returns true from #key? if a key is available' do store[nil] = "über" store.key?(nil).should be_true end it 'stores values with #store' do value = "über" store.store(nil, value).should equal(value) store[nil].should == "über" store.load(nil).should == "über" end it 'stores values after clear' do store[nil] = "über" store[0] = "\xAA\xBB\xCC" store.clear.should equal(store) store[nil] = "über" store[nil].should == "über" store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = "über" store.delete(nil).should == "über" store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = "über" store[nil].should == "über" store[nil] = "\xAA\xBB\xCC" store[nil].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store[nil] = value).should equal(value) store[nil].should == "über" end it 'stores frozen keys' do key = nil.freeze store[key] = "über" store[nil].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store[nil] = "über" store.fetch(nil, "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store[nil] = "über" unaltered = 'unaltered' store.fetch(nil) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0] = "über" store[0].should == "über" store.load(0).should == "über" end it 'returns true from #key? if a key is available' do store[0] = "über" store.key?(0).should be_true end it 'stores values with #store' do value = "über" store.store(0, value).should equal(value) store[0].should == "über" store.load(0).should == "über" end it 'stores values after clear' do store[0] = "über" store[nil] = "\xAA\xBB\xCC" store.clear.should equal(store) store[0] = "über" store[0].should == "über" store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = "über" store.delete(0).should == "über" store.key?(0).should be_false end it 'overwrites existing values' do store[0] = "über" store[0].should == "über" store[0] = "\xAA\xBB\xCC" store[0].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store[0] = value).should equal(value) store[0].should == "über" end it 'stores frozen keys' do key = 0.freeze store[key] = "über" store[0].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store[0] = "über" store.fetch(0, "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store[0] = "über" unaltered = 'unaltered' store.fetch(0) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[nil] = "\xAA\xBB\xCC" store[nil].should == "\xAA\xBB\xCC" store.load(nil).should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store[nil] = "\xAA\xBB\xCC" store.key?(nil).should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store(nil, value).should equal(value) store[nil].should == "\xAA\xBB\xCC" store.load(nil).should == "\xAA\xBB\xCC" end it 'stores values after clear' do store[nil] = "\xAA\xBB\xCC" store[0] = "über" store.clear.should equal(store) store[nil] = "\xAA\xBB\xCC" store[nil].should == "\xAA\xBB\xCC" store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = "\xAA\xBB\xCC" store.delete(nil).should == "\xAA\xBB\xCC" store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = "\xAA\xBB\xCC" store[nil].should == "\xAA\xBB\xCC" store[nil] = "über" store[nil].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store[nil] = value).should equal(value) store[nil].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = nil.freeze store[key] = "\xAA\xBB\xCC" store[nil].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store[nil] = "\xAA\xBB\xCC" store.fetch(nil, "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store[nil] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch(nil) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0] = "\xAA\xBB\xCC" store[0].should == "\xAA\xBB\xCC" store.load(0).should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store[0] = "\xAA\xBB\xCC" store.key?(0).should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store(0, value).should equal(value) store[0].should == "\xAA\xBB\xCC" store.load(0).should == "\xAA\xBB\xCC" end it 'stores values after clear' do store[0] = "\xAA\xBB\xCC" store[nil] = "über" store.clear.should equal(store) store[0] = "\xAA\xBB\xCC" store[0].should == "\xAA\xBB\xCC" store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = "\xAA\xBB\xCC" store.delete(0).should == "\xAA\xBB\xCC" store.key?(0).should be_false end it 'overwrites existing values' do store[0] = "\xAA\xBB\xCC" store[0].should == "\xAA\xBB\xCC" store[0] = "über" store[0].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store[0] = value).should equal(value) store[0].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = 0.freeze store[key] = "\xAA\xBB\xCC" store[0].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store[0] = "\xAA\xBB\xCC" store.fetch(0, "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store[0] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch(0) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_nilkey_binaryvalue #################### shared_examples_for 'returndifferent_nilkey_binaryvalue' do it 'guarantees that a different value is retrieved' do value = "über" store[nil] = value store[nil].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "über" store[0] = value store[0].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store[nil] = value store[nil].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store[0] = value store[0].should_not be_equal(value) end end #################### returnsame_nilkey_binaryvalue #################### shared_examples_for 'returnsame_nilkey_binaryvalue' do it 'guarantees that the same value is retrieved' do value = "über" store[nil] = value store[nil].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "über" store[0] = value store[0].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store[nil] = value store[nil].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store[0] = value store[0].should be_equal(value) end end #################### persist_nilkey_binaryvalue #################### shared_examples_for 'persist_nilkey_binaryvalue' do it 'persists values' do store[nil] = "über" store.close @store = nil store[nil].should == "über" end it 'persists values' do store[0] = "über" store.close @store = nil store[0].should == "über" end it 'persists values' do store[nil] = "\xAA\xBB\xCC" store.close @store = nil store[nil].should == "\xAA\xBB\xCC" end it 'persists values' do store[0] = "\xAA\xBB\xCC" store.close @store = nil store[0].should == "\xAA\xBB\xCC" end end #################### null_nilkey_hashvalue #################### shared_examples_for 'null_nilkey_hashvalue' do it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = {"hashval1"=>["array1", 1]} store[0] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = {"hashval1"=>["array1", 1]} store[nil] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[nil] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### store_nilkey_hashvalue #################### shared_examples_for 'store_nilkey_hashvalue' do it 'writes values to keys that like a Hash' do store[nil] = {"hashval1"=>["array1", 1]} store[nil].should == {"hashval1"=>["array1", 1]} store.load(nil).should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store[nil] = {"hashval1"=>["array1", 1]} store.key?(nil).should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store(nil, value).should equal(value) store[nil].should == {"hashval1"=>["array1", 1]} store.load(nil).should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store[nil] = {"hashval1"=>["array1", 1]} store[0] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store[nil] = {"hashval1"=>["array1", 1]} store[nil].should == {"hashval1"=>["array1", 1]} store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = {"hashval1"=>["array1", 1]} store.delete(nil).should == {"hashval1"=>["array1", 1]} store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = {"hashval1"=>["array1", 1]} store[nil].should == {"hashval1"=>["array1", 1]} store[nil] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[nil].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store[nil] = value).should equal(value) store[nil].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = nil.freeze store[key] = {"hashval1"=>["array1", 1]} store[nil].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store[nil] = {"hashval1"=>["array1", 1]} store.fetch(nil, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store[nil] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch(nil) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0] = {"hashval1"=>["array1", 1]} store[0].should == {"hashval1"=>["array1", 1]} store.load(0).should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store[0] = {"hashval1"=>["array1", 1]} store.key?(0).should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store(0, value).should equal(value) store[0].should == {"hashval1"=>["array1", 1]} store.load(0).should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store[0] = {"hashval1"=>["array1", 1]} store[nil] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store[0] = {"hashval1"=>["array1", 1]} store[0].should == {"hashval1"=>["array1", 1]} store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = {"hashval1"=>["array1", 1]} store.delete(0).should == {"hashval1"=>["array1", 1]} store.key?(0).should be_false end it 'overwrites existing values' do store[0] = {"hashval1"=>["array1", 1]} store[0].should == {"hashval1"=>["array1", 1]} store[0] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store[0] = value).should equal(value) store[0].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = 0.freeze store[key] = {"hashval1"=>["array1", 1]} store[0].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store[0] = {"hashval1"=>["array1", 1]} store.fetch(0, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store[0] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch(0) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[nil] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[nil].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(nil).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store[nil] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(nil).should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store(nil, value).should equal(value) store[nil].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(nil).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store[nil] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store[nil] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[nil].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete(nil).should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[nil].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[nil] = {"hashval1"=>["array1", 1]} store[nil].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store[nil] = value).should equal(value) store[nil].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = nil.freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[nil].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store[nil] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(nil, {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store[nil] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch(nil) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(0).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store[0] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(0).should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store(0, value).should equal(value) store[0].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(0).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store[0] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[nil] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store[0] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete(0).should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(0).should be_false end it 'overwrites existing values' do store[0] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[0] = {"hashval1"=>["array1", 1]} store[0].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store[0] = value).should equal(value) store[0].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = 0.freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store[0] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(0, {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store[0] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch(0) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_nilkey_hashvalue #################### shared_examples_for 'returndifferent_nilkey_hashvalue' do it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store[nil] = value store[nil].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store[0] = value store[0].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[nil] = value store[nil].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0] = value store[0].should_not be_equal(value) end end #################### returnsame_nilkey_hashvalue #################### shared_examples_for 'returnsame_nilkey_hashvalue' do it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store[nil] = value store[nil].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store[0] = value store[0].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[nil] = value store[nil].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0] = value store[0].should be_equal(value) end end #################### persist_nilkey_hashvalue #################### shared_examples_for 'persist_nilkey_hashvalue' do it 'persists values' do store[nil] = {"hashval1"=>["array1", 1]} store.close @store = nil store[nil].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store[0] = {"hashval1"=>["array1", 1]} store.close @store = nil store[0].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store[nil] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store[nil].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'persists values' do store[0] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store[0].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### null_nilkey_objectvalue #################### shared_examples_for 'null_nilkey_objectvalue' do it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = Value.new(:objval1) store[0] = Value.new(:objval2) store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = Value.new(:objval1) store[nil] = Value.new(:objval2) store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store[nil].should be_nil store.load(nil).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store[nil] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(nil).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(nil).should be_nil end it 'removes all keys from the store with clear' do store[nil] = Value.new(:objval2) store[0] = Value.new(:objval1) store.clear.should equal(store) store.key?(nil).should be_false store.key?(0).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(nil, Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = nil value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(nil, options).should be_false store.load(nil, options).should be_nil store.fetch(nil, 42, options).should == 42 store.fetch(nil, options) { 42 }.should == 42 store.delete(nil, options).should be_nil store.clear(options).should equal(store) store.store(nil, Value.new(:objval2), options).should == Value.new(:objval2) end it 'reads from keys like a Hash' do store[0].should be_nil store.load(0).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store[0] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0).should be_nil end it 'removes all keys from the store with clear' do store[0] = Value.new(:objval2) store[nil] = Value.new(:objval1) store.clear.should equal(store) store.key?(0).should be_false store.key?(nil).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0, Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = 0 value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0, options).should be_false store.load(0, options).should be_nil store.fetch(0, 42, options).should == 42 store.fetch(0, options) { 42 }.should == 42 store.delete(0, options).should be_nil store.clear(options).should equal(store) store.store(0, Value.new(:objval2), options).should == Value.new(:objval2) end end #################### store_nilkey_objectvalue #################### shared_examples_for 'store_nilkey_objectvalue' do it 'writes values to keys that like a Hash' do store[nil] = Value.new(:objval1) store[nil].should == Value.new(:objval1) store.load(nil).should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store[nil] = Value.new(:objval1) store.key?(nil).should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store(nil, value).should equal(value) store[nil].should == Value.new(:objval1) store.load(nil).should == Value.new(:objval1) end it 'stores values after clear' do store[nil] = Value.new(:objval1) store[0] = Value.new(:objval2) store.clear.should equal(store) store[nil] = Value.new(:objval1) store[nil].should == Value.new(:objval1) store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = Value.new(:objval1) store.delete(nil).should == Value.new(:objval1) store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = Value.new(:objval1) store[nil].should == Value.new(:objval1) store[nil] = Value.new(:objval2) store[nil].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store[nil] = value).should equal(value) store[nil].should == Value.new(:objval1) end it 'stores frozen keys' do key = nil.freeze store[key] = Value.new(:objval1) store[nil].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store[nil] = Value.new(:objval1) store.fetch(nil, Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store[nil] = Value.new(:objval1) unaltered = 'unaltered' store.fetch(nil) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0] = Value.new(:objval1) store[0].should == Value.new(:objval1) store.load(0).should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store[0] = Value.new(:objval1) store.key?(0).should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store(0, value).should equal(value) store[0].should == Value.new(:objval1) store.load(0).should == Value.new(:objval1) end it 'stores values after clear' do store[0] = Value.new(:objval1) store[nil] = Value.new(:objval2) store.clear.should equal(store) store[0] = Value.new(:objval1) store[0].should == Value.new(:objval1) store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = Value.new(:objval1) store.delete(0).should == Value.new(:objval1) store.key?(0).should be_false end it 'overwrites existing values' do store[0] = Value.new(:objval1) store[0].should == Value.new(:objval1) store[0] = Value.new(:objval2) store[0].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store[0] = value).should equal(value) store[0].should == Value.new(:objval1) end it 'stores frozen keys' do key = 0.freeze store[key] = Value.new(:objval1) store[0].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store[0] = Value.new(:objval1) store.fetch(0, Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store[0] = Value.new(:objval1) unaltered = 'unaltered' store.fetch(0) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[nil] = Value.new(:objval2) store[nil].should == Value.new(:objval2) store.load(nil).should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store[nil] = Value.new(:objval2) store.key?(nil).should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store(nil, value).should equal(value) store[nil].should == Value.new(:objval2) store.load(nil).should == Value.new(:objval2) end it 'stores values after clear' do store[nil] = Value.new(:objval2) store[0] = Value.new(:objval1) store.clear.should equal(store) store[nil] = Value.new(:objval2) store[nil].should == Value.new(:objval2) store[0].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[nil] = Value.new(:objval2) store.delete(nil).should == Value.new(:objval2) store.key?(nil).should be_false end it 'overwrites existing values' do store[nil] = Value.new(:objval2) store[nil].should == Value.new(:objval2) store[nil] = Value.new(:objval1) store[nil].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store[nil] = value).should equal(value) store[nil].should == Value.new(:objval2) end it 'stores frozen keys' do key = nil.freeze store[key] = Value.new(:objval2) store[nil].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store[nil] = Value.new(:objval2) store.fetch(nil, Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store[nil] = Value.new(:objval2) unaltered = 'unaltered' store.fetch(nil) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0] = Value.new(:objval2) store[0].should == Value.new(:objval2) store.load(0).should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store[0] = Value.new(:objval2) store.key?(0).should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store(0, value).should equal(value) store[0].should == Value.new(:objval2) store.load(0).should == Value.new(:objval2) end it 'stores values after clear' do store[0] = Value.new(:objval2) store[nil] = Value.new(:objval1) store.clear.should equal(store) store[0] = Value.new(:objval2) store[0].should == Value.new(:objval2) store[nil].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0] = Value.new(:objval2) store.delete(0).should == Value.new(:objval2) store.key?(0).should be_false end it 'overwrites existing values' do store[0] = Value.new(:objval2) store[0].should == Value.new(:objval2) store[0] = Value.new(:objval1) store[0].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store[0] = value).should equal(value) store[0].should == Value.new(:objval2) end it 'stores frozen keys' do key = 0.freeze store[key] = Value.new(:objval2) store[0].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store[0] = Value.new(:objval2) store.fetch(0, Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store[0] = Value.new(:objval2) unaltered = 'unaltered' store.fetch(0) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_nilkey_objectvalue #################### shared_examples_for 'returndifferent_nilkey_objectvalue' do it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store[nil] = value store[nil].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store[0] = value store[0].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store[nil] = value store[nil].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store[0] = value store[0].should_not be_equal(value) end end #################### returnsame_nilkey_objectvalue #################### shared_examples_for 'returnsame_nilkey_objectvalue' do it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store[nil] = value store[nil].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store[0] = value store[0].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store[nil] = value store[nil].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store[0] = value store[0].should be_equal(value) end end #################### persist_nilkey_objectvalue #################### shared_examples_for 'persist_nilkey_objectvalue' do it 'persists values' do store[nil] = Value.new(:objval1) store.close @store = nil store[nil].should == Value.new(:objval1) end it 'persists values' do store[0] = Value.new(:objval1) store.close @store = nil store[0].should == Value.new(:objval1) end it 'persists values' do store[nil] = Value.new(:objval2) store.close @store = nil store[nil].should == Value.new(:objval2) end it 'persists values' do store[0] = Value.new(:objval2) store.close @store = nil store[0].should == Value.new(:objval2) end end #################### null_integerkey_nilvalue #################### shared_examples_for 'null_integerkey_nilvalue' do it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = '' store[42] = nil store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, '', options).should == '' end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = '' store[-10] = nil store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, '', options).should == '' end it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = nil store[42] = '' store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, nil, options).should == nil end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = nil store[-10] = '' store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, nil, options).should == nil end it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = 0 store[42] = false store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, 0, options).should == 0 end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = 0 store[-10] = false store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, 0, options).should == 0 end it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = false store[42] = 0 store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, false, options).should == false end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = false store[-10] = 0 store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, false, options).should == false end end #################### store_integerkey_nilvalue #################### shared_examples_for 'store_integerkey_nilvalue' do it 'writes values to keys that like a Hash' do store[-10] = '' store[-10].should == '' store.load(-10).should == '' end it 'returns true from #key? if a key is available' do store[-10] = '' store.key?(-10).should be_true end it 'stores values with #store' do value = '' store.store(-10, value).should equal(value) store[-10].should == '' store.load(-10).should == '' end it 'stores values after clear' do store[-10] = '' store[42] = nil store.clear.should equal(store) store[-10] = '' store[-10].should == '' store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = '' store.delete(-10).should == '' store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = '' store[-10].should == '' store[-10] = nil store[-10].should == nil end it 'stores frozen values' do value = ''.freeze (store[-10] = value).should equal(value) store[-10].should == '' end it 'stores frozen keys' do key = -10.freeze store[key] = '' store[-10].should == '' end it 'writes values to keys that like a Hash' do store[42] = '' store[42].should == '' store.load(42).should == '' end it 'returns true from #key? if a key is available' do store[42] = '' store.key?(42).should be_true end it 'stores values with #store' do value = '' store.store(42, value).should equal(value) store[42].should == '' store.load(42).should == '' end it 'stores values after clear' do store[42] = '' store[-10] = nil store.clear.should equal(store) store[42] = '' store[42].should == '' store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = '' store.delete(42).should == '' store.key?(42).should be_false end it 'overwrites existing values' do store[42] = '' store[42].should == '' store[42] = nil store[42].should == nil end it 'stores frozen values' do value = ''.freeze (store[42] = value).should equal(value) store[42].should == '' end it 'stores frozen keys' do key = 42.freeze store[key] = '' store[42].should == '' end it 'writes values to keys that like a Hash' do store[-10] = nil store[-10].should == nil store.load(-10).should == nil end it 'returns true from #key? if a key is available' do store[-10] = nil store.key?(-10).should be_true end it 'stores values with #store' do value = nil store.store(-10, value).should equal(value) store[-10].should == nil store.load(-10).should == nil end it 'stores values after clear' do store[-10] = nil store[42] = '' store.clear.should equal(store) store[-10] = nil store[-10].should == nil store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = nil store.delete(-10).should == nil store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = nil store[-10].should == nil store[-10] = '' store[-10].should == '' end it 'stores frozen values' do value = nil.freeze (store[-10] = value).should equal(value) store[-10].should == nil end it 'stores frozen keys' do key = -10.freeze store[key] = nil store[-10].should == nil end it 'writes values to keys that like a Hash' do store[42] = nil store[42].should == nil store.load(42).should == nil end it 'returns true from #key? if a key is available' do store[42] = nil store.key?(42).should be_true end it 'stores values with #store' do value = nil store.store(42, value).should equal(value) store[42].should == nil store.load(42).should == nil end it 'stores values after clear' do store[42] = nil store[-10] = '' store.clear.should equal(store) store[42] = nil store[42].should == nil store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = nil store.delete(42).should == nil store.key?(42).should be_false end it 'overwrites existing values' do store[42] = nil store[42].should == nil store[42] = '' store[42].should == '' end it 'stores frozen values' do value = nil.freeze (store[42] = value).should equal(value) store[42].should == nil end it 'stores frozen keys' do key = 42.freeze store[key] = nil store[42].should == nil end it 'writes values to keys that like a Hash' do store[-10] = 0 store[-10].should == 0 store.load(-10).should == 0 end it 'returns true from #key? if a key is available' do store[-10] = 0 store.key?(-10).should be_true end it 'stores values with #store' do value = 0 store.store(-10, value).should equal(value) store[-10].should == 0 store.load(-10).should == 0 end it 'stores values after clear' do store[-10] = 0 store[42] = false store.clear.should equal(store) store[-10] = 0 store[-10].should == 0 store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = 0 store.delete(-10).should == 0 store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = 0 store[-10].should == 0 store[-10] = false store[-10].should == false end it 'stores frozen values' do value = 0.freeze (store[-10] = value).should equal(value) store[-10].should == 0 end it 'stores frozen keys' do key = -10.freeze store[key] = 0 store[-10].should == 0 end it 'writes values to keys that like a Hash' do store[42] = 0 store[42].should == 0 store.load(42).should == 0 end it 'returns true from #key? if a key is available' do store[42] = 0 store.key?(42).should be_true end it 'stores values with #store' do value = 0 store.store(42, value).should equal(value) store[42].should == 0 store.load(42).should == 0 end it 'stores values after clear' do store[42] = 0 store[-10] = false store.clear.should equal(store) store[42] = 0 store[42].should == 0 store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = 0 store.delete(42).should == 0 store.key?(42).should be_false end it 'overwrites existing values' do store[42] = 0 store[42].should == 0 store[42] = false store[42].should == false end it 'stores frozen values' do value = 0.freeze (store[42] = value).should equal(value) store[42].should == 0 end it 'stores frozen keys' do key = 42.freeze store[key] = 0 store[42].should == 0 end it 'writes values to keys that like a Hash' do store[-10] = false store[-10].should == false store.load(-10).should == false end it 'returns true from #key? if a key is available' do store[-10] = false store.key?(-10).should be_true end it 'stores values with #store' do value = false store.store(-10, value).should equal(value) store[-10].should == false store.load(-10).should == false end it 'stores values after clear' do store[-10] = false store[42] = 0 store.clear.should equal(store) store[-10] = false store[-10].should == false store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = false store.delete(-10).should == false store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = false store[-10].should == false store[-10] = 0 store[-10].should == 0 end it 'stores frozen values' do value = false.freeze (store[-10] = value).should equal(value) store[-10].should == false end it 'stores frozen keys' do key = -10.freeze store[key] = false store[-10].should == false end it 'writes values to keys that like a Hash' do store[42] = false store[42].should == false store.load(42).should == false end it 'returns true from #key? if a key is available' do store[42] = false store.key?(42).should be_true end it 'stores values with #store' do value = false store.store(42, value).should equal(value) store[42].should == false store.load(42).should == false end it 'stores values after clear' do store[42] = false store[-10] = 0 store.clear.should equal(store) store[42] = false store[42].should == false store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = false store.delete(42).should == false store.key?(42).should be_false end it 'overwrites existing values' do store[42] = false store[42].should == false store[42] = 0 store[42].should == 0 end it 'stores frozen values' do value = false.freeze (store[42] = value).should equal(value) store[42].should == false end it 'stores frozen keys' do key = 42.freeze store[key] = false store[42].should == false end end #################### persist_integerkey_nilvalue #################### shared_examples_for 'persist_integerkey_nilvalue' do it 'persists values' do store[-10] = '' store.close @store = nil store[-10].should == '' end it 'persists values' do store[42] = '' store.close @store = nil store[42].should == '' end it 'persists values' do store[-10] = nil store.close @store = nil store[-10].should == nil end it 'persists values' do store[42] = nil store.close @store = nil store[42].should == nil end it 'persists values' do store[-10] = 0 store.close @store = nil store[-10].should == 0 end it 'persists values' do store[42] = 0 store.close @store = nil store[42].should == 0 end it 'persists values' do store[-10] = false store.close @store = nil store[-10].should == false end it 'persists values' do store[42] = false store.close @store = nil store[42].should == false end end #################### null_integerkey_integervalue #################### shared_examples_for 'null_integerkey_integervalue' do it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = 41 store[42] = -12 store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, 41, options).should == 41 end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = 41 store[-10] = -12 store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, 41, options).should == 41 end it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = -12 store[42] = 41 store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, -12, options).should == -12 end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = -12 store[-10] = 41 store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, -12, options).should == -12 end end #################### store_integerkey_integervalue #################### shared_examples_for 'store_integerkey_integervalue' do it 'writes values to keys that like a Hash' do store[-10] = 41 store[-10].should == 41 store.load(-10).should == 41 end it 'returns true from #key? if a key is available' do store[-10] = 41 store.key?(-10).should be_true end it 'stores values with #store' do value = 41 store.store(-10, value).should equal(value) store[-10].should == 41 store.load(-10).should == 41 end it 'stores values after clear' do store[-10] = 41 store[42] = -12 store.clear.should equal(store) store[-10] = 41 store[-10].should == 41 store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = 41 store.delete(-10).should == 41 store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = 41 store[-10].should == 41 store[-10] = -12 store[-10].should == -12 end it 'stores frozen values' do value = 41.freeze (store[-10] = value).should equal(value) store[-10].should == 41 end it 'stores frozen keys' do key = -10.freeze store[key] = 41 store[-10].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store[-10] = 41 store.fetch(-10, -12).should == 41 end it 'does not run the block in fetch if the key is available' do store[-10] = 41 unaltered = 'unaltered' store.fetch(-10) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[42] = 41 store[42].should == 41 store.load(42).should == 41 end it 'returns true from #key? if a key is available' do store[42] = 41 store.key?(42).should be_true end it 'stores values with #store' do value = 41 store.store(42, value).should equal(value) store[42].should == 41 store.load(42).should == 41 end it 'stores values after clear' do store[42] = 41 store[-10] = -12 store.clear.should equal(store) store[42] = 41 store[42].should == 41 store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = 41 store.delete(42).should == 41 store.key?(42).should be_false end it 'overwrites existing values' do store[42] = 41 store[42].should == 41 store[42] = -12 store[42].should == -12 end it 'stores frozen values' do value = 41.freeze (store[42] = value).should equal(value) store[42].should == 41 end it 'stores frozen keys' do key = 42.freeze store[key] = 41 store[42].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store[42] = 41 store.fetch(42, -12).should == 41 end it 'does not run the block in fetch if the key is available' do store[42] = 41 unaltered = 'unaltered' store.fetch(42) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-10] = -12 store[-10].should == -12 store.load(-10).should == -12 end it 'returns true from #key? if a key is available' do store[-10] = -12 store.key?(-10).should be_true end it 'stores values with #store' do value = -12 store.store(-10, value).should equal(value) store[-10].should == -12 store.load(-10).should == -12 end it 'stores values after clear' do store[-10] = -12 store[42] = 41 store.clear.should equal(store) store[-10] = -12 store[-10].should == -12 store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = -12 store.delete(-10).should == -12 store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = -12 store[-10].should == -12 store[-10] = 41 store[-10].should == 41 end it 'stores frozen values' do value = -12.freeze (store[-10] = value).should equal(value) store[-10].should == -12 end it 'stores frozen keys' do key = -10.freeze store[key] = -12 store[-10].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store[-10] = -12 store.fetch(-10, 41).should == -12 end it 'does not run the block in fetch if the key is available' do store[-10] = -12 unaltered = 'unaltered' store.fetch(-10) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[42] = -12 store[42].should == -12 store.load(42).should == -12 end it 'returns true from #key? if a key is available' do store[42] = -12 store.key?(42).should be_true end it 'stores values with #store' do value = -12 store.store(42, value).should equal(value) store[42].should == -12 store.load(42).should == -12 end it 'stores values after clear' do store[42] = -12 store[-10] = 41 store.clear.should equal(store) store[42] = -12 store[42].should == -12 store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = -12 store.delete(42).should == -12 store.key?(42).should be_false end it 'overwrites existing values' do store[42] = -12 store[42].should == -12 store[42] = 41 store[42].should == 41 end it 'stores frozen values' do value = -12.freeze (store[42] = value).should equal(value) store[42].should == -12 end it 'stores frozen keys' do key = 42.freeze store[key] = -12 store[42].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store[42] = -12 store.fetch(42, 41).should == -12 end it 'does not run the block in fetch if the key is available' do store[42] = -12 unaltered = 'unaltered' store.fetch(42) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_integerkey_integervalue #################### shared_examples_for 'persist_integerkey_integervalue' do it 'persists values' do store[-10] = 41 store.close @store = nil store[-10].should == 41 end it 'persists values' do store[42] = 41 store.close @store = nil store[42].should == 41 end it 'persists values' do store[-10] = -12 store.close @store = nil store[-10].should == -12 end it 'persists values' do store[42] = -12 store.close @store = nil store[42].should == -12 end end #################### null_integerkey_numbervalue #################### shared_examples_for 'null_integerkey_numbervalue' do it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = 123.456 store[42] = -98.7 store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = 123.456 store[-10] = -98.7 store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = -98.7 store[42] = 123.456 store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = -98.7 store[-10] = 123.456 store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = 340282366920938463463374607431768211456 store[42] = 33 store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = 340282366920938463463374607431768211456 store[-10] = 33 store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = 33 store[42] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, 33, options).should == 33 end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = 33 store[-10] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, 33, options).should == 33 end end #################### store_integerkey_numbervalue #################### shared_examples_for 'store_integerkey_numbervalue' do it 'writes values to keys that like a Hash' do store[-10] = 123.456 store[-10].should == 123.456 store.load(-10).should == 123.456 end it 'returns true from #key? if a key is available' do store[-10] = 123.456 store.key?(-10).should be_true end it 'stores values with #store' do value = 123.456 store.store(-10, value).should equal(value) store[-10].should == 123.456 store.load(-10).should == 123.456 end it 'stores values after clear' do store[-10] = 123.456 store[42] = -98.7 store.clear.should equal(store) store[-10] = 123.456 store[-10].should == 123.456 store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = 123.456 store.delete(-10).should == 123.456 store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = 123.456 store[-10].should == 123.456 store[-10] = -98.7 store[-10].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store[-10] = value).should equal(value) store[-10].should == 123.456 end it 'stores frozen keys' do key = -10.freeze store[key] = 123.456 store[-10].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store[-10] = 123.456 store.fetch(-10, -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store[-10] = 123.456 unaltered = 'unaltered' store.fetch(-10) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[42] = 123.456 store[42].should == 123.456 store.load(42).should == 123.456 end it 'returns true from #key? if a key is available' do store[42] = 123.456 store.key?(42).should be_true end it 'stores values with #store' do value = 123.456 store.store(42, value).should equal(value) store[42].should == 123.456 store.load(42).should == 123.456 end it 'stores values after clear' do store[42] = 123.456 store[-10] = -98.7 store.clear.should equal(store) store[42] = 123.456 store[42].should == 123.456 store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = 123.456 store.delete(42).should == 123.456 store.key?(42).should be_false end it 'overwrites existing values' do store[42] = 123.456 store[42].should == 123.456 store[42] = -98.7 store[42].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store[42] = value).should equal(value) store[42].should == 123.456 end it 'stores frozen keys' do key = 42.freeze store[key] = 123.456 store[42].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store[42] = 123.456 store.fetch(42, -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store[42] = 123.456 unaltered = 'unaltered' store.fetch(42) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-10] = -98.7 store[-10].should == -98.7 store.load(-10).should == -98.7 end it 'returns true from #key? if a key is available' do store[-10] = -98.7 store.key?(-10).should be_true end it 'stores values with #store' do value = -98.7 store.store(-10, value).should equal(value) store[-10].should == -98.7 store.load(-10).should == -98.7 end it 'stores values after clear' do store[-10] = -98.7 store[42] = 123.456 store.clear.should equal(store) store[-10] = -98.7 store[-10].should == -98.7 store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = -98.7 store.delete(-10).should == -98.7 store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = -98.7 store[-10].should == -98.7 store[-10] = 123.456 store[-10].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store[-10] = value).should equal(value) store[-10].should == -98.7 end it 'stores frozen keys' do key = -10.freeze store[key] = -98.7 store[-10].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store[-10] = -98.7 store.fetch(-10, 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store[-10] = -98.7 unaltered = 'unaltered' store.fetch(-10) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[42] = -98.7 store[42].should == -98.7 store.load(42).should == -98.7 end it 'returns true from #key? if a key is available' do store[42] = -98.7 store.key?(42).should be_true end it 'stores values with #store' do value = -98.7 store.store(42, value).should equal(value) store[42].should == -98.7 store.load(42).should == -98.7 end it 'stores values after clear' do store[42] = -98.7 store[-10] = 123.456 store.clear.should equal(store) store[42] = -98.7 store[42].should == -98.7 store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = -98.7 store.delete(42).should == -98.7 store.key?(42).should be_false end it 'overwrites existing values' do store[42] = -98.7 store[42].should == -98.7 store[42] = 123.456 store[42].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store[42] = value).should equal(value) store[42].should == -98.7 end it 'stores frozen keys' do key = 42.freeze store[key] = -98.7 store[42].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store[42] = -98.7 store.fetch(42, 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store[42] = -98.7 unaltered = 'unaltered' store.fetch(42) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-10] = 340282366920938463463374607431768211456 store[-10].should == 340282366920938463463374607431768211456 store.load(-10).should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store[-10] = 340282366920938463463374607431768211456 store.key?(-10).should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store(-10, value).should equal(value) store[-10].should == 340282366920938463463374607431768211456 store.load(-10).should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store[-10] = 340282366920938463463374607431768211456 store[42] = 33 store.clear.should equal(store) store[-10] = 340282366920938463463374607431768211456 store[-10].should == 340282366920938463463374607431768211456 store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = 340282366920938463463374607431768211456 store.delete(-10).should == 340282366920938463463374607431768211456 store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = 340282366920938463463374607431768211456 store[-10].should == 340282366920938463463374607431768211456 store[-10] = 33 store[-10].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store[-10] = value).should equal(value) store[-10].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = -10.freeze store[key] = 340282366920938463463374607431768211456 store[-10].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store[-10] = 340282366920938463463374607431768211456 store.fetch(-10, 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store[-10] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch(-10) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[42] = 340282366920938463463374607431768211456 store[42].should == 340282366920938463463374607431768211456 store.load(42).should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store[42] = 340282366920938463463374607431768211456 store.key?(42).should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store(42, value).should equal(value) store[42].should == 340282366920938463463374607431768211456 store.load(42).should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store[42] = 340282366920938463463374607431768211456 store[-10] = 33 store.clear.should equal(store) store[42] = 340282366920938463463374607431768211456 store[42].should == 340282366920938463463374607431768211456 store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = 340282366920938463463374607431768211456 store.delete(42).should == 340282366920938463463374607431768211456 store.key?(42).should be_false end it 'overwrites existing values' do store[42] = 340282366920938463463374607431768211456 store[42].should == 340282366920938463463374607431768211456 store[42] = 33 store[42].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store[42] = value).should equal(value) store[42].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = 42.freeze store[key] = 340282366920938463463374607431768211456 store[42].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store[42] = 340282366920938463463374607431768211456 store.fetch(42, 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store[42] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch(42) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-10] = 33 store[-10].should == 33 store.load(-10).should == 33 end it 'returns true from #key? if a key is available' do store[-10] = 33 store.key?(-10).should be_true end it 'stores values with #store' do value = 33 store.store(-10, value).should equal(value) store[-10].should == 33 store.load(-10).should == 33 end it 'stores values after clear' do store[-10] = 33 store[42] = 340282366920938463463374607431768211456 store.clear.should equal(store) store[-10] = 33 store[-10].should == 33 store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = 33 store.delete(-10).should == 33 store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = 33 store[-10].should == 33 store[-10] = 340282366920938463463374607431768211456 store[-10].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store[-10] = value).should equal(value) store[-10].should == 33 end it 'stores frozen keys' do key = -10.freeze store[key] = 33 store[-10].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store[-10] = 33 store.fetch(-10, 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store[-10] = 33 unaltered = 'unaltered' store.fetch(-10) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[42] = 33 store[42].should == 33 store.load(42).should == 33 end it 'returns true from #key? if a key is available' do store[42] = 33 store.key?(42).should be_true end it 'stores values with #store' do value = 33 store.store(42, value).should equal(value) store[42].should == 33 store.load(42).should == 33 end it 'stores values after clear' do store[42] = 33 store[-10] = 340282366920938463463374607431768211456 store.clear.should equal(store) store[42] = 33 store[42].should == 33 store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = 33 store.delete(42).should == 33 store.key?(42).should be_false end it 'overwrites existing values' do store[42] = 33 store[42].should == 33 store[42] = 340282366920938463463374607431768211456 store[42].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store[42] = value).should equal(value) store[42].should == 33 end it 'stores frozen keys' do key = 42.freeze store[key] = 33 store[42].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store[42] = 33 store.fetch(42, 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store[42] = 33 unaltered = 'unaltered' store.fetch(42) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_integerkey_numbervalue #################### shared_examples_for 'persist_integerkey_numbervalue' do it 'persists values' do store[-10] = 123.456 store.close @store = nil store[-10].should == 123.456 end it 'persists values' do store[42] = 123.456 store.close @store = nil store[42].should == 123.456 end it 'persists values' do store[-10] = -98.7 store.close @store = nil store[-10].should == -98.7 end it 'persists values' do store[42] = -98.7 store.close @store = nil store[42].should == -98.7 end it 'persists values' do store[-10] = 340282366920938463463374607431768211456 store.close @store = nil store[-10].should == 340282366920938463463374607431768211456 end it 'persists values' do store[42] = 340282366920938463463374607431768211456 store.close @store = nil store[42].should == 340282366920938463463374607431768211456 end it 'persists values' do store[-10] = 33 store.close @store = nil store[-10].should == 33 end it 'persists values' do store[42] = 33 store.close @store = nil store[42].should == 33 end end #################### null_integerkey_booleanvalue #################### shared_examples_for 'null_integerkey_booleanvalue' do it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = true store[42] = false store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, true, options).should == true end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = true store[-10] = false store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, true, options).should == true end it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = false store[42] = true store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, false, options).should == false end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = false store[-10] = true store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, false, options).should == false end end #################### store_integerkey_booleanvalue #################### shared_examples_for 'store_integerkey_booleanvalue' do it 'writes values to keys that like a Hash' do store[-10] = true store[-10].should == true store.load(-10).should == true end it 'returns true from #key? if a key is available' do store[-10] = true store.key?(-10).should be_true end it 'stores values with #store' do value = true store.store(-10, value).should equal(value) store[-10].should == true store.load(-10).should == true end it 'stores values after clear' do store[-10] = true store[42] = false store.clear.should equal(store) store[-10] = true store[-10].should == true store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = true store.delete(-10).should == true store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = true store[-10].should == true store[-10] = false store[-10].should == false end it 'stores frozen values' do value = true.freeze (store[-10] = value).should equal(value) store[-10].should == true end it 'stores frozen keys' do key = -10.freeze store[key] = true store[-10].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store[-10] = true store.fetch(-10, false).should == true end it 'does not run the block in fetch if the key is available' do store[-10] = true unaltered = 'unaltered' store.fetch(-10) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[42] = true store[42].should == true store.load(42).should == true end it 'returns true from #key? if a key is available' do store[42] = true store.key?(42).should be_true end it 'stores values with #store' do value = true store.store(42, value).should equal(value) store[42].should == true store.load(42).should == true end it 'stores values after clear' do store[42] = true store[-10] = false store.clear.should equal(store) store[42] = true store[42].should == true store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = true store.delete(42).should == true store.key?(42).should be_false end it 'overwrites existing values' do store[42] = true store[42].should == true store[42] = false store[42].should == false end it 'stores frozen values' do value = true.freeze (store[42] = value).should equal(value) store[42].should == true end it 'stores frozen keys' do key = 42.freeze store[key] = true store[42].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store[42] = true store.fetch(42, false).should == true end it 'does not run the block in fetch if the key is available' do store[42] = true unaltered = 'unaltered' store.fetch(42) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-10] = false store[-10].should == false store.load(-10).should == false end it 'returns true from #key? if a key is available' do store[-10] = false store.key?(-10).should be_true end it 'stores values with #store' do value = false store.store(-10, value).should equal(value) store[-10].should == false store.load(-10).should == false end it 'stores values after clear' do store[-10] = false store[42] = true store.clear.should equal(store) store[-10] = false store[-10].should == false store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = false store.delete(-10).should == false store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = false store[-10].should == false store[-10] = true store[-10].should == true end it 'stores frozen values' do value = false.freeze (store[-10] = value).should equal(value) store[-10].should == false end it 'stores frozen keys' do key = -10.freeze store[key] = false store[-10].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store[-10] = false store.fetch(-10, true).should == false end it 'does not run the block in fetch if the key is available' do store[-10] = false unaltered = 'unaltered' store.fetch(-10) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[42] = false store[42].should == false store.load(42).should == false end it 'returns true from #key? if a key is available' do store[42] = false store.key?(42).should be_true end it 'stores values with #store' do value = false store.store(42, value).should equal(value) store[42].should == false store.load(42).should == false end it 'stores values after clear' do store[42] = false store[-10] = true store.clear.should equal(store) store[42] = false store[42].should == false store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = false store.delete(42).should == false store.key?(42).should be_false end it 'overwrites existing values' do store[42] = false store[42].should == false store[42] = true store[42].should == true end it 'stores frozen values' do value = false.freeze (store[42] = value).should equal(value) store[42].should == false end it 'stores frozen keys' do key = 42.freeze store[key] = false store[42].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store[42] = false store.fetch(42, true).should == false end it 'does not run the block in fetch if the key is available' do store[42] = false unaltered = 'unaltered' store.fetch(42) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_integerkey_booleanvalue #################### shared_examples_for 'persist_integerkey_booleanvalue' do it 'persists values' do store[-10] = true store.close @store = nil store[-10].should == true end it 'persists values' do store[42] = true store.close @store = nil store[42].should == true end it 'persists values' do store[-10] = false store.close @store = nil store[-10].should == false end it 'persists values' do store[42] = false store.close @store = nil store[42].should == false end end #################### null_integerkey_stringvalue #################### shared_examples_for 'null_integerkey_stringvalue' do it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = "strval1" store[42] = "strval2" store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = "strval1" store[-10] = "strval2" store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = "strval2" store[42] = "strval1" store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, "strval2", options).should == "strval2" end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = "strval2" store[-10] = "strval1" store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, "strval2", options).should == "strval2" end end #################### store_integerkey_stringvalue #################### shared_examples_for 'store_integerkey_stringvalue' do it 'writes values to keys that like a Hash' do store[-10] = "strval1" store[-10].should == "strval1" store.load(-10).should == "strval1" end it 'returns true from #key? if a key is available' do store[-10] = "strval1" store.key?(-10).should be_true end it 'stores values with #store' do value = "strval1" store.store(-10, value).should equal(value) store[-10].should == "strval1" store.load(-10).should == "strval1" end it 'stores values after clear' do store[-10] = "strval1" store[42] = "strval2" store.clear.should equal(store) store[-10] = "strval1" store[-10].should == "strval1" store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = "strval1" store.delete(-10).should == "strval1" store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = "strval1" store[-10].should == "strval1" store[-10] = "strval2" store[-10].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store[-10] = value).should equal(value) store[-10].should == "strval1" end it 'stores frozen keys' do key = -10.freeze store[key] = "strval1" store[-10].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store[-10] = "strval1" store.fetch(-10, "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store[-10] = "strval1" unaltered = 'unaltered' store.fetch(-10) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[42] = "strval1" store[42].should == "strval1" store.load(42).should == "strval1" end it 'returns true from #key? if a key is available' do store[42] = "strval1" store.key?(42).should be_true end it 'stores values with #store' do value = "strval1" store.store(42, value).should equal(value) store[42].should == "strval1" store.load(42).should == "strval1" end it 'stores values after clear' do store[42] = "strval1" store[-10] = "strval2" store.clear.should equal(store) store[42] = "strval1" store[42].should == "strval1" store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = "strval1" store.delete(42).should == "strval1" store.key?(42).should be_false end it 'overwrites existing values' do store[42] = "strval1" store[42].should == "strval1" store[42] = "strval2" store[42].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store[42] = value).should equal(value) store[42].should == "strval1" end it 'stores frozen keys' do key = 42.freeze store[key] = "strval1" store[42].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store[42] = "strval1" store.fetch(42, "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store[42] = "strval1" unaltered = 'unaltered' store.fetch(42) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-10] = "strval2" store[-10].should == "strval2" store.load(-10).should == "strval2" end it 'returns true from #key? if a key is available' do store[-10] = "strval2" store.key?(-10).should be_true end it 'stores values with #store' do value = "strval2" store.store(-10, value).should equal(value) store[-10].should == "strval2" store.load(-10).should == "strval2" end it 'stores values after clear' do store[-10] = "strval2" store[42] = "strval1" store.clear.should equal(store) store[-10] = "strval2" store[-10].should == "strval2" store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = "strval2" store.delete(-10).should == "strval2" store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = "strval2" store[-10].should == "strval2" store[-10] = "strval1" store[-10].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store[-10] = value).should equal(value) store[-10].should == "strval2" end it 'stores frozen keys' do key = -10.freeze store[key] = "strval2" store[-10].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store[-10] = "strval2" store.fetch(-10, "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store[-10] = "strval2" unaltered = 'unaltered' store.fetch(-10) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[42] = "strval2" store[42].should == "strval2" store.load(42).should == "strval2" end it 'returns true from #key? if a key is available' do store[42] = "strval2" store.key?(42).should be_true end it 'stores values with #store' do value = "strval2" store.store(42, value).should equal(value) store[42].should == "strval2" store.load(42).should == "strval2" end it 'stores values after clear' do store[42] = "strval2" store[-10] = "strval1" store.clear.should equal(store) store[42] = "strval2" store[42].should == "strval2" store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = "strval2" store.delete(42).should == "strval2" store.key?(42).should be_false end it 'overwrites existing values' do store[42] = "strval2" store[42].should == "strval2" store[42] = "strval1" store[42].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store[42] = value).should equal(value) store[42].should == "strval2" end it 'stores frozen keys' do key = 42.freeze store[key] = "strval2" store[42].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store[42] = "strval2" store.fetch(42, "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store[42] = "strval2" unaltered = 'unaltered' store.fetch(42) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_integerkey_stringvalue #################### shared_examples_for 'returndifferent_integerkey_stringvalue' do it 'guarantees that a different value is retrieved' do value = "strval1" store[-10] = value store[-10].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval1" store[42] = value store[42].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store[-10] = value store[-10].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store[42] = value store[42].should_not be_equal(value) end end #################### returnsame_integerkey_stringvalue #################### shared_examples_for 'returnsame_integerkey_stringvalue' do it 'guarantees that the same value is retrieved' do value = "strval1" store[-10] = value store[-10].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval1" store[42] = value store[42].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store[-10] = value store[-10].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store[42] = value store[42].should be_equal(value) end end #################### persist_integerkey_stringvalue #################### shared_examples_for 'persist_integerkey_stringvalue' do it 'persists values' do store[-10] = "strval1" store.close @store = nil store[-10].should == "strval1" end it 'persists values' do store[42] = "strval1" store.close @store = nil store[42].should == "strval1" end it 'persists values' do store[-10] = "strval2" store.close @store = nil store[-10].should == "strval2" end it 'persists values' do store[42] = "strval2" store.close @store = nil store[42].should == "strval2" end end #################### null_integerkey_binaryvalue #################### shared_examples_for 'null_integerkey_binaryvalue' do it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = "über" store[42] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, "über", options).should == "über" end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = "über" store[-10] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, "über", options).should == "über" end it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = "\xAA\xBB\xCC" store[42] = "über" store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = "\xAA\xBB\xCC" store[-10] = "über" store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end end #################### store_integerkey_binaryvalue #################### shared_examples_for 'store_integerkey_binaryvalue' do it 'writes values to keys that like a Hash' do store[-10] = "über" store[-10].should == "über" store.load(-10).should == "über" end it 'returns true from #key? if a key is available' do store[-10] = "über" store.key?(-10).should be_true end it 'stores values with #store' do value = "über" store.store(-10, value).should equal(value) store[-10].should == "über" store.load(-10).should == "über" end it 'stores values after clear' do store[-10] = "über" store[42] = "\xAA\xBB\xCC" store.clear.should equal(store) store[-10] = "über" store[-10].should == "über" store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = "über" store.delete(-10).should == "über" store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = "über" store[-10].should == "über" store[-10] = "\xAA\xBB\xCC" store[-10].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store[-10] = value).should equal(value) store[-10].should == "über" end it 'stores frozen keys' do key = -10.freeze store[key] = "über" store[-10].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store[-10] = "über" store.fetch(-10, "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store[-10] = "über" unaltered = 'unaltered' store.fetch(-10) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[42] = "über" store[42].should == "über" store.load(42).should == "über" end it 'returns true from #key? if a key is available' do store[42] = "über" store.key?(42).should be_true end it 'stores values with #store' do value = "über" store.store(42, value).should equal(value) store[42].should == "über" store.load(42).should == "über" end it 'stores values after clear' do store[42] = "über" store[-10] = "\xAA\xBB\xCC" store.clear.should equal(store) store[42] = "über" store[42].should == "über" store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = "über" store.delete(42).should == "über" store.key?(42).should be_false end it 'overwrites existing values' do store[42] = "über" store[42].should == "über" store[42] = "\xAA\xBB\xCC" store[42].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store[42] = value).should equal(value) store[42].should == "über" end it 'stores frozen keys' do key = 42.freeze store[key] = "über" store[42].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store[42] = "über" store.fetch(42, "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store[42] = "über" unaltered = 'unaltered' store.fetch(42) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-10] = "\xAA\xBB\xCC" store[-10].should == "\xAA\xBB\xCC" store.load(-10).should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store[-10] = "\xAA\xBB\xCC" store.key?(-10).should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store(-10, value).should equal(value) store[-10].should == "\xAA\xBB\xCC" store.load(-10).should == "\xAA\xBB\xCC" end it 'stores values after clear' do store[-10] = "\xAA\xBB\xCC" store[42] = "über" store.clear.should equal(store) store[-10] = "\xAA\xBB\xCC" store[-10].should == "\xAA\xBB\xCC" store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = "\xAA\xBB\xCC" store.delete(-10).should == "\xAA\xBB\xCC" store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = "\xAA\xBB\xCC" store[-10].should == "\xAA\xBB\xCC" store[-10] = "über" store[-10].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store[-10] = value).should equal(value) store[-10].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = -10.freeze store[key] = "\xAA\xBB\xCC" store[-10].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store[-10] = "\xAA\xBB\xCC" store.fetch(-10, "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store[-10] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch(-10) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[42] = "\xAA\xBB\xCC" store[42].should == "\xAA\xBB\xCC" store.load(42).should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store[42] = "\xAA\xBB\xCC" store.key?(42).should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store(42, value).should equal(value) store[42].should == "\xAA\xBB\xCC" store.load(42).should == "\xAA\xBB\xCC" end it 'stores values after clear' do store[42] = "\xAA\xBB\xCC" store[-10] = "über" store.clear.should equal(store) store[42] = "\xAA\xBB\xCC" store[42].should == "\xAA\xBB\xCC" store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = "\xAA\xBB\xCC" store.delete(42).should == "\xAA\xBB\xCC" store.key?(42).should be_false end it 'overwrites existing values' do store[42] = "\xAA\xBB\xCC" store[42].should == "\xAA\xBB\xCC" store[42] = "über" store[42].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store[42] = value).should equal(value) store[42].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = 42.freeze store[key] = "\xAA\xBB\xCC" store[42].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store[42] = "\xAA\xBB\xCC" store.fetch(42, "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store[42] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch(42) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_integerkey_binaryvalue #################### shared_examples_for 'returndifferent_integerkey_binaryvalue' do it 'guarantees that a different value is retrieved' do value = "über" store[-10] = value store[-10].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "über" store[42] = value store[42].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store[-10] = value store[-10].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store[42] = value store[42].should_not be_equal(value) end end #################### returnsame_integerkey_binaryvalue #################### shared_examples_for 'returnsame_integerkey_binaryvalue' do it 'guarantees that the same value is retrieved' do value = "über" store[-10] = value store[-10].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "über" store[42] = value store[42].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store[-10] = value store[-10].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store[42] = value store[42].should be_equal(value) end end #################### persist_integerkey_binaryvalue #################### shared_examples_for 'persist_integerkey_binaryvalue' do it 'persists values' do store[-10] = "über" store.close @store = nil store[-10].should == "über" end it 'persists values' do store[42] = "über" store.close @store = nil store[42].should == "über" end it 'persists values' do store[-10] = "\xAA\xBB\xCC" store.close @store = nil store[-10].should == "\xAA\xBB\xCC" end it 'persists values' do store[42] = "\xAA\xBB\xCC" store.close @store = nil store[42].should == "\xAA\xBB\xCC" end end #################### null_integerkey_hashvalue #################### shared_examples_for 'null_integerkey_hashvalue' do it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = {"hashval1"=>["array1", 1]} store[42] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = {"hashval1"=>["array1", 1]} store[-10] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[42] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-10] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### store_integerkey_hashvalue #################### shared_examples_for 'store_integerkey_hashvalue' do it 'writes values to keys that like a Hash' do store[-10] = {"hashval1"=>["array1", 1]} store[-10].should == {"hashval1"=>["array1", 1]} store.load(-10).should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store[-10] = {"hashval1"=>["array1", 1]} store.key?(-10).should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store(-10, value).should equal(value) store[-10].should == {"hashval1"=>["array1", 1]} store.load(-10).should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store[-10] = {"hashval1"=>["array1", 1]} store[42] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store[-10] = {"hashval1"=>["array1", 1]} store[-10].should == {"hashval1"=>["array1", 1]} store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = {"hashval1"=>["array1", 1]} store.delete(-10).should == {"hashval1"=>["array1", 1]} store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = {"hashval1"=>["array1", 1]} store[-10].should == {"hashval1"=>["array1", 1]} store[-10] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-10].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store[-10] = value).should equal(value) store[-10].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = -10.freeze store[key] = {"hashval1"=>["array1", 1]} store[-10].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store[-10] = {"hashval1"=>["array1", 1]} store.fetch(-10, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store[-10] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch(-10) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[42] = {"hashval1"=>["array1", 1]} store[42].should == {"hashval1"=>["array1", 1]} store.load(42).should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store[42] = {"hashval1"=>["array1", 1]} store.key?(42).should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store(42, value).should equal(value) store[42].should == {"hashval1"=>["array1", 1]} store.load(42).should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store[42] = {"hashval1"=>["array1", 1]} store[-10] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store[42] = {"hashval1"=>["array1", 1]} store[42].should == {"hashval1"=>["array1", 1]} store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = {"hashval1"=>["array1", 1]} store.delete(42).should == {"hashval1"=>["array1", 1]} store.key?(42).should be_false end it 'overwrites existing values' do store[42] = {"hashval1"=>["array1", 1]} store[42].should == {"hashval1"=>["array1", 1]} store[42] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[42].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store[42] = value).should equal(value) store[42].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = 42.freeze store[key] = {"hashval1"=>["array1", 1]} store[42].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store[42] = {"hashval1"=>["array1", 1]} store.fetch(42, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store[42] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch(42) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-10] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-10].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(-10).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store[-10] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(-10).should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store(-10, value).should equal(value) store[-10].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(-10).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store[-10] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[42] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store[-10] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-10].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete(-10).should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-10].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[-10] = {"hashval1"=>["array1", 1]} store[-10].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store[-10] = value).should equal(value) store[-10].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = -10.freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-10].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store[-10] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(-10, {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store[-10] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch(-10) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[42] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[42].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(42).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store[42] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(42).should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store(42, value).should equal(value) store[42].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(42).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store[42] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-10] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store[42] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[42].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete(42).should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(42).should be_false end it 'overwrites existing values' do store[42] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[42].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[42] = {"hashval1"=>["array1", 1]} store[42].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store[42] = value).should equal(value) store[42].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = 42.freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[42].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store[42] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(42, {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store[42] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch(42) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_integerkey_hashvalue #################### shared_examples_for 'returndifferent_integerkey_hashvalue' do it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store[-10] = value store[-10].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store[42] = value store[42].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-10] = value store[-10].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[42] = value store[42].should_not be_equal(value) end end #################### returnsame_integerkey_hashvalue #################### shared_examples_for 'returnsame_integerkey_hashvalue' do it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store[-10] = value store[-10].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store[42] = value store[42].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-10] = value store[-10].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[42] = value store[42].should be_equal(value) end end #################### persist_integerkey_hashvalue #################### shared_examples_for 'persist_integerkey_hashvalue' do it 'persists values' do store[-10] = {"hashval1"=>["array1", 1]} store.close @store = nil store[-10].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store[42] = {"hashval1"=>["array1", 1]} store.close @store = nil store[42].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store[-10] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store[-10].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'persists values' do store[42] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store[42].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### null_integerkey_objectvalue #################### shared_examples_for 'null_integerkey_objectvalue' do it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = Value.new(:objval1) store[42] = Value.new(:objval2) store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = Value.new(:objval1) store[-10] = Value.new(:objval2) store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store[-10].should be_nil store.load(-10).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store[-10] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-10).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-10).should be_nil end it 'removes all keys from the store with clear' do store[-10] = Value.new(:objval2) store[42] = Value.new(:objval1) store.clear.should equal(store) store.key?(-10).should be_false store.key?(42).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-10, Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = -10 value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-10, options).should be_false store.load(-10, options).should be_nil store.fetch(-10, 42, options).should == 42 store.fetch(-10, options) { 42 }.should == 42 store.delete(-10, options).should be_nil store.clear(options).should equal(store) store.store(-10, Value.new(:objval2), options).should == Value.new(:objval2) end it 'reads from keys like a Hash' do store[42].should be_nil store.load(42).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store[42] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(42).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(42).should be_nil end it 'removes all keys from the store with clear' do store[42] = Value.new(:objval2) store[-10] = Value.new(:objval1) store.clear.should equal(store) store.key?(42).should be_false store.key?(-10).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(42, Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = 42 value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(42, options).should be_false store.load(42, options).should be_nil store.fetch(42, 42, options).should == 42 store.fetch(42, options) { 42 }.should == 42 store.delete(42, options).should be_nil store.clear(options).should equal(store) store.store(42, Value.new(:objval2), options).should == Value.new(:objval2) end end #################### store_integerkey_objectvalue #################### shared_examples_for 'store_integerkey_objectvalue' do it 'writes values to keys that like a Hash' do store[-10] = Value.new(:objval1) store[-10].should == Value.new(:objval1) store.load(-10).should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store[-10] = Value.new(:objval1) store.key?(-10).should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store(-10, value).should equal(value) store[-10].should == Value.new(:objval1) store.load(-10).should == Value.new(:objval1) end it 'stores values after clear' do store[-10] = Value.new(:objval1) store[42] = Value.new(:objval2) store.clear.should equal(store) store[-10] = Value.new(:objval1) store[-10].should == Value.new(:objval1) store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = Value.new(:objval1) store.delete(-10).should == Value.new(:objval1) store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = Value.new(:objval1) store[-10].should == Value.new(:objval1) store[-10] = Value.new(:objval2) store[-10].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store[-10] = value).should equal(value) store[-10].should == Value.new(:objval1) end it 'stores frozen keys' do key = -10.freeze store[key] = Value.new(:objval1) store[-10].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store[-10] = Value.new(:objval1) store.fetch(-10, Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store[-10] = Value.new(:objval1) unaltered = 'unaltered' store.fetch(-10) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[42] = Value.new(:objval1) store[42].should == Value.new(:objval1) store.load(42).should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store[42] = Value.new(:objval1) store.key?(42).should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store(42, value).should equal(value) store[42].should == Value.new(:objval1) store.load(42).should == Value.new(:objval1) end it 'stores values after clear' do store[42] = Value.new(:objval1) store[-10] = Value.new(:objval2) store.clear.should equal(store) store[42] = Value.new(:objval1) store[42].should == Value.new(:objval1) store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = Value.new(:objval1) store.delete(42).should == Value.new(:objval1) store.key?(42).should be_false end it 'overwrites existing values' do store[42] = Value.new(:objval1) store[42].should == Value.new(:objval1) store[42] = Value.new(:objval2) store[42].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store[42] = value).should equal(value) store[42].should == Value.new(:objval1) end it 'stores frozen keys' do key = 42.freeze store[key] = Value.new(:objval1) store[42].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store[42] = Value.new(:objval1) store.fetch(42, Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store[42] = Value.new(:objval1) unaltered = 'unaltered' store.fetch(42) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-10] = Value.new(:objval2) store[-10].should == Value.new(:objval2) store.load(-10).should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store[-10] = Value.new(:objval2) store.key?(-10).should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store(-10, value).should equal(value) store[-10].should == Value.new(:objval2) store.load(-10).should == Value.new(:objval2) end it 'stores values after clear' do store[-10] = Value.new(:objval2) store[42] = Value.new(:objval1) store.clear.should equal(store) store[-10] = Value.new(:objval2) store[-10].should == Value.new(:objval2) store[42].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-10] = Value.new(:objval2) store.delete(-10).should == Value.new(:objval2) store.key?(-10).should be_false end it 'overwrites existing values' do store[-10] = Value.new(:objval2) store[-10].should == Value.new(:objval2) store[-10] = Value.new(:objval1) store[-10].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store[-10] = value).should equal(value) store[-10].should == Value.new(:objval2) end it 'stores frozen keys' do key = -10.freeze store[key] = Value.new(:objval2) store[-10].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store[-10] = Value.new(:objval2) store.fetch(-10, Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store[-10] = Value.new(:objval2) unaltered = 'unaltered' store.fetch(-10) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[42] = Value.new(:objval2) store[42].should == Value.new(:objval2) store.load(42).should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store[42] = Value.new(:objval2) store.key?(42).should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store(42, value).should equal(value) store[42].should == Value.new(:objval2) store.load(42).should == Value.new(:objval2) end it 'stores values after clear' do store[42] = Value.new(:objval2) store[-10] = Value.new(:objval1) store.clear.should equal(store) store[42] = Value.new(:objval2) store[42].should == Value.new(:objval2) store[-10].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[42] = Value.new(:objval2) store.delete(42).should == Value.new(:objval2) store.key?(42).should be_false end it 'overwrites existing values' do store[42] = Value.new(:objval2) store[42].should == Value.new(:objval2) store[42] = Value.new(:objval1) store[42].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store[42] = value).should equal(value) store[42].should == Value.new(:objval2) end it 'stores frozen keys' do key = 42.freeze store[key] = Value.new(:objval2) store[42].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store[42] = Value.new(:objval2) store.fetch(42, Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store[42] = Value.new(:objval2) unaltered = 'unaltered' store.fetch(42) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_integerkey_objectvalue #################### shared_examples_for 'returndifferent_integerkey_objectvalue' do it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store[-10] = value store[-10].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store[42] = value store[42].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store[-10] = value store[-10].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store[42] = value store[42].should_not be_equal(value) end end #################### returnsame_integerkey_objectvalue #################### shared_examples_for 'returnsame_integerkey_objectvalue' do it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store[-10] = value store[-10].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store[42] = value store[42].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store[-10] = value store[-10].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store[42] = value store[42].should be_equal(value) end end #################### persist_integerkey_objectvalue #################### shared_examples_for 'persist_integerkey_objectvalue' do it 'persists values' do store[-10] = Value.new(:objval1) store.close @store = nil store[-10].should == Value.new(:objval1) end it 'persists values' do store[42] = Value.new(:objval1) store.close @store = nil store[42].should == Value.new(:objval1) end it 'persists values' do store[-10] = Value.new(:objval2) store.close @store = nil store[-10].should == Value.new(:objval2) end it 'persists values' do store[42] = Value.new(:objval2) store.close @store = nil store[42].should == Value.new(:objval2) end end #################### null_numberkey_nilvalue #################### shared_examples_for 'null_numberkey_nilvalue' do it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = '' store[-0.3] = nil store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, '', options).should == '' end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = '' store[0.5] = nil store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, '', options).should == '' end it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = nil store[-0.3] = '' store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, nil, options).should == nil end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = nil store[0.5] = '' store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, nil, options).should == nil end it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = 0 store[-0.3] = false store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, 0, options).should == 0 end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = 0 store[0.5] = false store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, 0, options).should == 0 end it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = false store[-0.3] = 0 store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, false, options).should == false end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = false store[0.5] = 0 store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, false, options).should == false end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = '' store[99] = nil store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, '', options).should == '' end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = '' store[170141183460469231731687303715884105728] = nil store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, '', options).should == '' end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = nil store[99] = '' store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, nil, options).should == nil end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = nil store[170141183460469231731687303715884105728] = '' store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, nil, options).should == nil end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = 0 store[99] = false store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, 0, options).should == 0 end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = 0 store[170141183460469231731687303715884105728] = false store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, 0, options).should == 0 end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = false store[99] = 0 store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, false, options).should == false end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = false store[170141183460469231731687303715884105728] = 0 store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, false, options).should == false end end #################### store_numberkey_nilvalue #################### shared_examples_for 'store_numberkey_nilvalue' do it 'writes values to keys that like a Hash' do store[0.5] = '' store[0.5].should == '' store.load(0.5).should == '' end it 'returns true from #key? if a key is available' do store[0.5] = '' store.key?(0.5).should be_true end it 'stores values with #store' do value = '' store.store(0.5, value).should equal(value) store[0.5].should == '' store.load(0.5).should == '' end it 'stores values after clear' do store[0.5] = '' store[-0.3] = nil store.clear.should equal(store) store[0.5] = '' store[0.5].should == '' store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = '' store.delete(0.5).should == '' store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = '' store[0.5].should == '' store[0.5] = nil store[0.5].should == nil end it 'stores frozen values' do value = ''.freeze (store[0.5] = value).should equal(value) store[0.5].should == '' end it 'stores frozen keys' do key = 0.5.freeze store[key] = '' store[0.5].should == '' end it 'writes values to keys that like a Hash' do store[-0.3] = '' store[-0.3].should == '' store.load(-0.3).should == '' end it 'returns true from #key? if a key is available' do store[-0.3] = '' store.key?(-0.3).should be_true end it 'stores values with #store' do value = '' store.store(-0.3, value).should equal(value) store[-0.3].should == '' store.load(-0.3).should == '' end it 'stores values after clear' do store[-0.3] = '' store[0.5] = nil store.clear.should equal(store) store[-0.3] = '' store[-0.3].should == '' store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = '' store.delete(-0.3).should == '' store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = '' store[-0.3].should == '' store[-0.3] = nil store[-0.3].should == nil end it 'stores frozen values' do value = ''.freeze (store[-0.3] = value).should equal(value) store[-0.3].should == '' end it 'stores frozen keys' do key = -0.3.freeze store[key] = '' store[-0.3].should == '' end it 'writes values to keys that like a Hash' do store[0.5] = nil store[0.5].should == nil store.load(0.5).should == nil end it 'returns true from #key? if a key is available' do store[0.5] = nil store.key?(0.5).should be_true end it 'stores values with #store' do value = nil store.store(0.5, value).should equal(value) store[0.5].should == nil store.load(0.5).should == nil end it 'stores values after clear' do store[0.5] = nil store[-0.3] = '' store.clear.should equal(store) store[0.5] = nil store[0.5].should == nil store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = nil store.delete(0.5).should == nil store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = nil store[0.5].should == nil store[0.5] = '' store[0.5].should == '' end it 'stores frozen values' do value = nil.freeze (store[0.5] = value).should equal(value) store[0.5].should == nil end it 'stores frozen keys' do key = 0.5.freeze store[key] = nil store[0.5].should == nil end it 'writes values to keys that like a Hash' do store[-0.3] = nil store[-0.3].should == nil store.load(-0.3).should == nil end it 'returns true from #key? if a key is available' do store[-0.3] = nil store.key?(-0.3).should be_true end it 'stores values with #store' do value = nil store.store(-0.3, value).should equal(value) store[-0.3].should == nil store.load(-0.3).should == nil end it 'stores values after clear' do store[-0.3] = nil store[0.5] = '' store.clear.should equal(store) store[-0.3] = nil store[-0.3].should == nil store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = nil store.delete(-0.3).should == nil store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = nil store[-0.3].should == nil store[-0.3] = '' store[-0.3].should == '' end it 'stores frozen values' do value = nil.freeze (store[-0.3] = value).should equal(value) store[-0.3].should == nil end it 'stores frozen keys' do key = -0.3.freeze store[key] = nil store[-0.3].should == nil end it 'writes values to keys that like a Hash' do store[0.5] = 0 store[0.5].should == 0 store.load(0.5).should == 0 end it 'returns true from #key? if a key is available' do store[0.5] = 0 store.key?(0.5).should be_true end it 'stores values with #store' do value = 0 store.store(0.5, value).should equal(value) store[0.5].should == 0 store.load(0.5).should == 0 end it 'stores values after clear' do store[0.5] = 0 store[-0.3] = false store.clear.should equal(store) store[0.5] = 0 store[0.5].should == 0 store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = 0 store.delete(0.5).should == 0 store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = 0 store[0.5].should == 0 store[0.5] = false store[0.5].should == false end it 'stores frozen values' do value = 0.freeze (store[0.5] = value).should equal(value) store[0.5].should == 0 end it 'stores frozen keys' do key = 0.5.freeze store[key] = 0 store[0.5].should == 0 end it 'writes values to keys that like a Hash' do store[-0.3] = 0 store[-0.3].should == 0 store.load(-0.3).should == 0 end it 'returns true from #key? if a key is available' do store[-0.3] = 0 store.key?(-0.3).should be_true end it 'stores values with #store' do value = 0 store.store(-0.3, value).should equal(value) store[-0.3].should == 0 store.load(-0.3).should == 0 end it 'stores values after clear' do store[-0.3] = 0 store[0.5] = false store.clear.should equal(store) store[-0.3] = 0 store[-0.3].should == 0 store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = 0 store.delete(-0.3).should == 0 store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = 0 store[-0.3].should == 0 store[-0.3] = false store[-0.3].should == false end it 'stores frozen values' do value = 0.freeze (store[-0.3] = value).should equal(value) store[-0.3].should == 0 end it 'stores frozen keys' do key = -0.3.freeze store[key] = 0 store[-0.3].should == 0 end it 'writes values to keys that like a Hash' do store[0.5] = false store[0.5].should == false store.load(0.5).should == false end it 'returns true from #key? if a key is available' do store[0.5] = false store.key?(0.5).should be_true end it 'stores values with #store' do value = false store.store(0.5, value).should equal(value) store[0.5].should == false store.load(0.5).should == false end it 'stores values after clear' do store[0.5] = false store[-0.3] = 0 store.clear.should equal(store) store[0.5] = false store[0.5].should == false store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = false store.delete(0.5).should == false store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = false store[0.5].should == false store[0.5] = 0 store[0.5].should == 0 end it 'stores frozen values' do value = false.freeze (store[0.5] = value).should equal(value) store[0.5].should == false end it 'stores frozen keys' do key = 0.5.freeze store[key] = false store[0.5].should == false end it 'writes values to keys that like a Hash' do store[-0.3] = false store[-0.3].should == false store.load(-0.3).should == false end it 'returns true from #key? if a key is available' do store[-0.3] = false store.key?(-0.3).should be_true end it 'stores values with #store' do value = false store.store(-0.3, value).should equal(value) store[-0.3].should == false store.load(-0.3).should == false end it 'stores values after clear' do store[-0.3] = false store[0.5] = 0 store.clear.should equal(store) store[-0.3] = false store[-0.3].should == false store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = false store.delete(-0.3).should == false store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = false store[-0.3].should == false store[-0.3] = 0 store[-0.3].should == 0 end it 'stores frozen values' do value = false.freeze (store[-0.3] = value).should equal(value) store[-0.3].should == false end it 'stores frozen keys' do key = -0.3.freeze store[key] = false store[-0.3].should == false end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = '' store[170141183460469231731687303715884105728].should == '' store.load(170141183460469231731687303715884105728).should == '' end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = '' store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = '' store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == '' store.load(170141183460469231731687303715884105728).should == '' end it 'stores values after clear' do store[170141183460469231731687303715884105728] = '' store[99] = nil store.clear.should equal(store) store[170141183460469231731687303715884105728] = '' store[170141183460469231731687303715884105728].should == '' store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = '' store.delete(170141183460469231731687303715884105728).should == '' store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = '' store[170141183460469231731687303715884105728].should == '' store[170141183460469231731687303715884105728] = nil store[170141183460469231731687303715884105728].should == nil end it 'stores frozen values' do value = ''.freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == '' end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = '' store[170141183460469231731687303715884105728].should == '' end it 'writes values to keys that like a Hash' do store[99] = '' store[99].should == '' store.load(99).should == '' end it 'returns true from #key? if a key is available' do store[99] = '' store.key?(99).should be_true end it 'stores values with #store' do value = '' store.store(99, value).should equal(value) store[99].should == '' store.load(99).should == '' end it 'stores values after clear' do store[99] = '' store[170141183460469231731687303715884105728] = nil store.clear.should equal(store) store[99] = '' store[99].should == '' store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = '' store.delete(99).should == '' store.key?(99).should be_false end it 'overwrites existing values' do store[99] = '' store[99].should == '' store[99] = nil store[99].should == nil end it 'stores frozen values' do value = ''.freeze (store[99] = value).should equal(value) store[99].should == '' end it 'stores frozen keys' do key = 99.freeze store[key] = '' store[99].should == '' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = nil store[170141183460469231731687303715884105728].should == nil store.load(170141183460469231731687303715884105728).should == nil end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = nil store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = nil store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == nil store.load(170141183460469231731687303715884105728).should == nil end it 'stores values after clear' do store[170141183460469231731687303715884105728] = nil store[99] = '' store.clear.should equal(store) store[170141183460469231731687303715884105728] = nil store[170141183460469231731687303715884105728].should == nil store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = nil store.delete(170141183460469231731687303715884105728).should == nil store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = nil store[170141183460469231731687303715884105728].should == nil store[170141183460469231731687303715884105728] = '' store[170141183460469231731687303715884105728].should == '' end it 'stores frozen values' do value = nil.freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == nil end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = nil store[170141183460469231731687303715884105728].should == nil end it 'writes values to keys that like a Hash' do store[99] = nil store[99].should == nil store.load(99).should == nil end it 'returns true from #key? if a key is available' do store[99] = nil store.key?(99).should be_true end it 'stores values with #store' do value = nil store.store(99, value).should equal(value) store[99].should == nil store.load(99).should == nil end it 'stores values after clear' do store[99] = nil store[170141183460469231731687303715884105728] = '' store.clear.should equal(store) store[99] = nil store[99].should == nil store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = nil store.delete(99).should == nil store.key?(99).should be_false end it 'overwrites existing values' do store[99] = nil store[99].should == nil store[99] = '' store[99].should == '' end it 'stores frozen values' do value = nil.freeze (store[99] = value).should equal(value) store[99].should == nil end it 'stores frozen keys' do key = 99.freeze store[key] = nil store[99].should == nil end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = 0 store[170141183460469231731687303715884105728].should == 0 store.load(170141183460469231731687303715884105728).should == 0 end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = 0 store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = 0 store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == 0 store.load(170141183460469231731687303715884105728).should == 0 end it 'stores values after clear' do store[170141183460469231731687303715884105728] = 0 store[99] = false store.clear.should equal(store) store[170141183460469231731687303715884105728] = 0 store[170141183460469231731687303715884105728].should == 0 store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = 0 store.delete(170141183460469231731687303715884105728).should == 0 store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = 0 store[170141183460469231731687303715884105728].should == 0 store[170141183460469231731687303715884105728] = false store[170141183460469231731687303715884105728].should == false end it 'stores frozen values' do value = 0.freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == 0 end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = 0 store[170141183460469231731687303715884105728].should == 0 end it 'writes values to keys that like a Hash' do store[99] = 0 store[99].should == 0 store.load(99).should == 0 end it 'returns true from #key? if a key is available' do store[99] = 0 store.key?(99).should be_true end it 'stores values with #store' do value = 0 store.store(99, value).should equal(value) store[99].should == 0 store.load(99).should == 0 end it 'stores values after clear' do store[99] = 0 store[170141183460469231731687303715884105728] = false store.clear.should equal(store) store[99] = 0 store[99].should == 0 store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = 0 store.delete(99).should == 0 store.key?(99).should be_false end it 'overwrites existing values' do store[99] = 0 store[99].should == 0 store[99] = false store[99].should == false end it 'stores frozen values' do value = 0.freeze (store[99] = value).should equal(value) store[99].should == 0 end it 'stores frozen keys' do key = 99.freeze store[key] = 0 store[99].should == 0 end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = false store[170141183460469231731687303715884105728].should == false store.load(170141183460469231731687303715884105728).should == false end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = false store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = false store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == false store.load(170141183460469231731687303715884105728).should == false end it 'stores values after clear' do store[170141183460469231731687303715884105728] = false store[99] = 0 store.clear.should equal(store) store[170141183460469231731687303715884105728] = false store[170141183460469231731687303715884105728].should == false store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = false store.delete(170141183460469231731687303715884105728).should == false store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = false store[170141183460469231731687303715884105728].should == false store[170141183460469231731687303715884105728] = 0 store[170141183460469231731687303715884105728].should == 0 end it 'stores frozen values' do value = false.freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == false end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = false store[170141183460469231731687303715884105728].should == false end it 'writes values to keys that like a Hash' do store[99] = false store[99].should == false store.load(99).should == false end it 'returns true from #key? if a key is available' do store[99] = false store.key?(99).should be_true end it 'stores values with #store' do value = false store.store(99, value).should equal(value) store[99].should == false store.load(99).should == false end it 'stores values after clear' do store[99] = false store[170141183460469231731687303715884105728] = 0 store.clear.should equal(store) store[99] = false store[99].should == false store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = false store.delete(99).should == false store.key?(99).should be_false end it 'overwrites existing values' do store[99] = false store[99].should == false store[99] = 0 store[99].should == 0 end it 'stores frozen values' do value = false.freeze (store[99] = value).should equal(value) store[99].should == false end it 'stores frozen keys' do key = 99.freeze store[key] = false store[99].should == false end end #################### persist_numberkey_nilvalue #################### shared_examples_for 'persist_numberkey_nilvalue' do it 'persists values' do store[0.5] = '' store.close @store = nil store[0.5].should == '' end it 'persists values' do store[-0.3] = '' store.close @store = nil store[-0.3].should == '' end it 'persists values' do store[0.5] = nil store.close @store = nil store[0.5].should == nil end it 'persists values' do store[-0.3] = nil store.close @store = nil store[-0.3].should == nil end it 'persists values' do store[0.5] = 0 store.close @store = nil store[0.5].should == 0 end it 'persists values' do store[-0.3] = 0 store.close @store = nil store[-0.3].should == 0 end it 'persists values' do store[0.5] = false store.close @store = nil store[0.5].should == false end it 'persists values' do store[-0.3] = false store.close @store = nil store[-0.3].should == false end it 'persists values' do store[170141183460469231731687303715884105728] = '' store.close @store = nil store[170141183460469231731687303715884105728].should == '' end it 'persists values' do store[99] = '' store.close @store = nil store[99].should == '' end it 'persists values' do store[170141183460469231731687303715884105728] = nil store.close @store = nil store[170141183460469231731687303715884105728].should == nil end it 'persists values' do store[99] = nil store.close @store = nil store[99].should == nil end it 'persists values' do store[170141183460469231731687303715884105728] = 0 store.close @store = nil store[170141183460469231731687303715884105728].should == 0 end it 'persists values' do store[99] = 0 store.close @store = nil store[99].should == 0 end it 'persists values' do store[170141183460469231731687303715884105728] = false store.close @store = nil store[170141183460469231731687303715884105728].should == false end it 'persists values' do store[99] = false store.close @store = nil store[99].should == false end end #################### null_numberkey_integervalue #################### shared_examples_for 'null_numberkey_integervalue' do it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = 41 store[-0.3] = -12 store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, 41, options).should == 41 end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = 41 store[0.5] = -12 store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, 41, options).should == 41 end it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = -12 store[-0.3] = 41 store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, -12, options).should == -12 end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = -12 store[0.5] = 41 store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, -12, options).should == -12 end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = 41 store[99] = -12 store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, 41, options).should == 41 end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = 41 store[170141183460469231731687303715884105728] = -12 store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, 41, options).should == 41 end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = -12 store[99] = 41 store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, -12, options).should == -12 end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = -12 store[170141183460469231731687303715884105728] = 41 store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, -12, options).should == -12 end end #################### store_numberkey_integervalue #################### shared_examples_for 'store_numberkey_integervalue' do it 'writes values to keys that like a Hash' do store[0.5] = 41 store[0.5].should == 41 store.load(0.5).should == 41 end it 'returns true from #key? if a key is available' do store[0.5] = 41 store.key?(0.5).should be_true end it 'stores values with #store' do value = 41 store.store(0.5, value).should equal(value) store[0.5].should == 41 store.load(0.5).should == 41 end it 'stores values after clear' do store[0.5] = 41 store[-0.3] = -12 store.clear.should equal(store) store[0.5] = 41 store[0.5].should == 41 store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = 41 store.delete(0.5).should == 41 store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = 41 store[0.5].should == 41 store[0.5] = -12 store[0.5].should == -12 end it 'stores frozen values' do value = 41.freeze (store[0.5] = value).should equal(value) store[0.5].should == 41 end it 'stores frozen keys' do key = 0.5.freeze store[key] = 41 store[0.5].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store[0.5] = 41 store.fetch(0.5, -12).should == 41 end it 'does not run the block in fetch if the key is available' do store[0.5] = 41 unaltered = 'unaltered' store.fetch(0.5) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-0.3] = 41 store[-0.3].should == 41 store.load(-0.3).should == 41 end it 'returns true from #key? if a key is available' do store[-0.3] = 41 store.key?(-0.3).should be_true end it 'stores values with #store' do value = 41 store.store(-0.3, value).should equal(value) store[-0.3].should == 41 store.load(-0.3).should == 41 end it 'stores values after clear' do store[-0.3] = 41 store[0.5] = -12 store.clear.should equal(store) store[-0.3] = 41 store[-0.3].should == 41 store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = 41 store.delete(-0.3).should == 41 store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = 41 store[-0.3].should == 41 store[-0.3] = -12 store[-0.3].should == -12 end it 'stores frozen values' do value = 41.freeze (store[-0.3] = value).should equal(value) store[-0.3].should == 41 end it 'stores frozen keys' do key = -0.3.freeze store[key] = 41 store[-0.3].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store[-0.3] = 41 store.fetch(-0.3, -12).should == 41 end it 'does not run the block in fetch if the key is available' do store[-0.3] = 41 unaltered = 'unaltered' store.fetch(-0.3) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0.5] = -12 store[0.5].should == -12 store.load(0.5).should == -12 end it 'returns true from #key? if a key is available' do store[0.5] = -12 store.key?(0.5).should be_true end it 'stores values with #store' do value = -12 store.store(0.5, value).should equal(value) store[0.5].should == -12 store.load(0.5).should == -12 end it 'stores values after clear' do store[0.5] = -12 store[-0.3] = 41 store.clear.should equal(store) store[0.5] = -12 store[0.5].should == -12 store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = -12 store.delete(0.5).should == -12 store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = -12 store[0.5].should == -12 store[0.5] = 41 store[0.5].should == 41 end it 'stores frozen values' do value = -12.freeze (store[0.5] = value).should equal(value) store[0.5].should == -12 end it 'stores frozen keys' do key = 0.5.freeze store[key] = -12 store[0.5].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store[0.5] = -12 store.fetch(0.5, 41).should == -12 end it 'does not run the block in fetch if the key is available' do store[0.5] = -12 unaltered = 'unaltered' store.fetch(0.5) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-0.3] = -12 store[-0.3].should == -12 store.load(-0.3).should == -12 end it 'returns true from #key? if a key is available' do store[-0.3] = -12 store.key?(-0.3).should be_true end it 'stores values with #store' do value = -12 store.store(-0.3, value).should equal(value) store[-0.3].should == -12 store.load(-0.3).should == -12 end it 'stores values after clear' do store[-0.3] = -12 store[0.5] = 41 store.clear.should equal(store) store[-0.3] = -12 store[-0.3].should == -12 store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = -12 store.delete(-0.3).should == -12 store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = -12 store[-0.3].should == -12 store[-0.3] = 41 store[-0.3].should == 41 end it 'stores frozen values' do value = -12.freeze (store[-0.3] = value).should equal(value) store[-0.3].should == -12 end it 'stores frozen keys' do key = -0.3.freeze store[key] = -12 store[-0.3].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store[-0.3] = -12 store.fetch(-0.3, 41).should == -12 end it 'does not run the block in fetch if the key is available' do store[-0.3] = -12 unaltered = 'unaltered' store.fetch(-0.3) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = 41 store[170141183460469231731687303715884105728].should == 41 store.load(170141183460469231731687303715884105728).should == 41 end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = 41 store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = 41 store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == 41 store.load(170141183460469231731687303715884105728).should == 41 end it 'stores values after clear' do store[170141183460469231731687303715884105728] = 41 store[99] = -12 store.clear.should equal(store) store[170141183460469231731687303715884105728] = 41 store[170141183460469231731687303715884105728].should == 41 store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = 41 store.delete(170141183460469231731687303715884105728).should == 41 store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = 41 store[170141183460469231731687303715884105728].should == 41 store[170141183460469231731687303715884105728] = -12 store[170141183460469231731687303715884105728].should == -12 end it 'stores frozen values' do value = 41.freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == 41 end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = 41 store[170141183460469231731687303715884105728].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store[170141183460469231731687303715884105728] = 41 store.fetch(170141183460469231731687303715884105728, -12).should == 41 end it 'does not run the block in fetch if the key is available' do store[170141183460469231731687303715884105728] = 41 unaltered = 'unaltered' store.fetch(170141183460469231731687303715884105728) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[99] = 41 store[99].should == 41 store.load(99).should == 41 end it 'returns true from #key? if a key is available' do store[99] = 41 store.key?(99).should be_true end it 'stores values with #store' do value = 41 store.store(99, value).should equal(value) store[99].should == 41 store.load(99).should == 41 end it 'stores values after clear' do store[99] = 41 store[170141183460469231731687303715884105728] = -12 store.clear.should equal(store) store[99] = 41 store[99].should == 41 store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = 41 store.delete(99).should == 41 store.key?(99).should be_false end it 'overwrites existing values' do store[99] = 41 store[99].should == 41 store[99] = -12 store[99].should == -12 end it 'stores frozen values' do value = 41.freeze (store[99] = value).should equal(value) store[99].should == 41 end it 'stores frozen keys' do key = 99.freeze store[key] = 41 store[99].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store[99] = 41 store.fetch(99, -12).should == 41 end it 'does not run the block in fetch if the key is available' do store[99] = 41 unaltered = 'unaltered' store.fetch(99) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = -12 store[170141183460469231731687303715884105728].should == -12 store.load(170141183460469231731687303715884105728).should == -12 end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = -12 store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = -12 store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == -12 store.load(170141183460469231731687303715884105728).should == -12 end it 'stores values after clear' do store[170141183460469231731687303715884105728] = -12 store[99] = 41 store.clear.should equal(store) store[170141183460469231731687303715884105728] = -12 store[170141183460469231731687303715884105728].should == -12 store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = -12 store.delete(170141183460469231731687303715884105728).should == -12 store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = -12 store[170141183460469231731687303715884105728].should == -12 store[170141183460469231731687303715884105728] = 41 store[170141183460469231731687303715884105728].should == 41 end it 'stores frozen values' do value = -12.freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == -12 end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = -12 store[170141183460469231731687303715884105728].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store[170141183460469231731687303715884105728] = -12 store.fetch(170141183460469231731687303715884105728, 41).should == -12 end it 'does not run the block in fetch if the key is available' do store[170141183460469231731687303715884105728] = -12 unaltered = 'unaltered' store.fetch(170141183460469231731687303715884105728) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[99] = -12 store[99].should == -12 store.load(99).should == -12 end it 'returns true from #key? if a key is available' do store[99] = -12 store.key?(99).should be_true end it 'stores values with #store' do value = -12 store.store(99, value).should equal(value) store[99].should == -12 store.load(99).should == -12 end it 'stores values after clear' do store[99] = -12 store[170141183460469231731687303715884105728] = 41 store.clear.should equal(store) store[99] = -12 store[99].should == -12 store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = -12 store.delete(99).should == -12 store.key?(99).should be_false end it 'overwrites existing values' do store[99] = -12 store[99].should == -12 store[99] = 41 store[99].should == 41 end it 'stores frozen values' do value = -12.freeze (store[99] = value).should equal(value) store[99].should == -12 end it 'stores frozen keys' do key = 99.freeze store[key] = -12 store[99].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store[99] = -12 store.fetch(99, 41).should == -12 end it 'does not run the block in fetch if the key is available' do store[99] = -12 unaltered = 'unaltered' store.fetch(99) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_numberkey_integervalue #################### shared_examples_for 'persist_numberkey_integervalue' do it 'persists values' do store[0.5] = 41 store.close @store = nil store[0.5].should == 41 end it 'persists values' do store[-0.3] = 41 store.close @store = nil store[-0.3].should == 41 end it 'persists values' do store[0.5] = -12 store.close @store = nil store[0.5].should == -12 end it 'persists values' do store[-0.3] = -12 store.close @store = nil store[-0.3].should == -12 end it 'persists values' do store[170141183460469231731687303715884105728] = 41 store.close @store = nil store[170141183460469231731687303715884105728].should == 41 end it 'persists values' do store[99] = 41 store.close @store = nil store[99].should == 41 end it 'persists values' do store[170141183460469231731687303715884105728] = -12 store.close @store = nil store[170141183460469231731687303715884105728].should == -12 end it 'persists values' do store[99] = -12 store.close @store = nil store[99].should == -12 end end #################### null_numberkey_numbervalue #################### shared_examples_for 'null_numberkey_numbervalue' do it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = 123.456 store[-0.3] = -98.7 store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = 123.456 store[0.5] = -98.7 store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = -98.7 store[-0.3] = 123.456 store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = -98.7 store[0.5] = 123.456 store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = 340282366920938463463374607431768211456 store[-0.3] = 33 store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = 340282366920938463463374607431768211456 store[0.5] = 33 store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = 33 store[-0.3] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, 33, options).should == 33 end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = 33 store[0.5] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, 33, options).should == 33 end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = 123.456 store[99] = -98.7 store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = 123.456 store[170141183460469231731687303715884105728] = -98.7 store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = -98.7 store[99] = 123.456 store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = -98.7 store[170141183460469231731687303715884105728] = 123.456 store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = 340282366920938463463374607431768211456 store[99] = 33 store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = 340282366920938463463374607431768211456 store[170141183460469231731687303715884105728] = 33 store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = 33 store[99] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, 33, options).should == 33 end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = 33 store[170141183460469231731687303715884105728] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, 33, options).should == 33 end end #################### store_numberkey_numbervalue #################### shared_examples_for 'store_numberkey_numbervalue' do it 'writes values to keys that like a Hash' do store[0.5] = 123.456 store[0.5].should == 123.456 store.load(0.5).should == 123.456 end it 'returns true from #key? if a key is available' do store[0.5] = 123.456 store.key?(0.5).should be_true end it 'stores values with #store' do value = 123.456 store.store(0.5, value).should equal(value) store[0.5].should == 123.456 store.load(0.5).should == 123.456 end it 'stores values after clear' do store[0.5] = 123.456 store[-0.3] = -98.7 store.clear.should equal(store) store[0.5] = 123.456 store[0.5].should == 123.456 store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = 123.456 store.delete(0.5).should == 123.456 store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = 123.456 store[0.5].should == 123.456 store[0.5] = -98.7 store[0.5].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store[0.5] = value).should equal(value) store[0.5].should == 123.456 end it 'stores frozen keys' do key = 0.5.freeze store[key] = 123.456 store[0.5].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store[0.5] = 123.456 store.fetch(0.5, -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store[0.5] = 123.456 unaltered = 'unaltered' store.fetch(0.5) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-0.3] = 123.456 store[-0.3].should == 123.456 store.load(-0.3).should == 123.456 end it 'returns true from #key? if a key is available' do store[-0.3] = 123.456 store.key?(-0.3).should be_true end it 'stores values with #store' do value = 123.456 store.store(-0.3, value).should equal(value) store[-0.3].should == 123.456 store.load(-0.3).should == 123.456 end it 'stores values after clear' do store[-0.3] = 123.456 store[0.5] = -98.7 store.clear.should equal(store) store[-0.3] = 123.456 store[-0.3].should == 123.456 store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = 123.456 store.delete(-0.3).should == 123.456 store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = 123.456 store[-0.3].should == 123.456 store[-0.3] = -98.7 store[-0.3].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store[-0.3] = value).should equal(value) store[-0.3].should == 123.456 end it 'stores frozen keys' do key = -0.3.freeze store[key] = 123.456 store[-0.3].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store[-0.3] = 123.456 store.fetch(-0.3, -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store[-0.3] = 123.456 unaltered = 'unaltered' store.fetch(-0.3) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0.5] = -98.7 store[0.5].should == -98.7 store.load(0.5).should == -98.7 end it 'returns true from #key? if a key is available' do store[0.5] = -98.7 store.key?(0.5).should be_true end it 'stores values with #store' do value = -98.7 store.store(0.5, value).should equal(value) store[0.5].should == -98.7 store.load(0.5).should == -98.7 end it 'stores values after clear' do store[0.5] = -98.7 store[-0.3] = 123.456 store.clear.should equal(store) store[0.5] = -98.7 store[0.5].should == -98.7 store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = -98.7 store.delete(0.5).should == -98.7 store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = -98.7 store[0.5].should == -98.7 store[0.5] = 123.456 store[0.5].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store[0.5] = value).should equal(value) store[0.5].should == -98.7 end it 'stores frozen keys' do key = 0.5.freeze store[key] = -98.7 store[0.5].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store[0.5] = -98.7 store.fetch(0.5, 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store[0.5] = -98.7 unaltered = 'unaltered' store.fetch(0.5) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-0.3] = -98.7 store[-0.3].should == -98.7 store.load(-0.3).should == -98.7 end it 'returns true from #key? if a key is available' do store[-0.3] = -98.7 store.key?(-0.3).should be_true end it 'stores values with #store' do value = -98.7 store.store(-0.3, value).should equal(value) store[-0.3].should == -98.7 store.load(-0.3).should == -98.7 end it 'stores values after clear' do store[-0.3] = -98.7 store[0.5] = 123.456 store.clear.should equal(store) store[-0.3] = -98.7 store[-0.3].should == -98.7 store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = -98.7 store.delete(-0.3).should == -98.7 store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = -98.7 store[-0.3].should == -98.7 store[-0.3] = 123.456 store[-0.3].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store[-0.3] = value).should equal(value) store[-0.3].should == -98.7 end it 'stores frozen keys' do key = -0.3.freeze store[key] = -98.7 store[-0.3].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store[-0.3] = -98.7 store.fetch(-0.3, 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store[-0.3] = -98.7 unaltered = 'unaltered' store.fetch(-0.3) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0.5] = 340282366920938463463374607431768211456 store[0.5].should == 340282366920938463463374607431768211456 store.load(0.5).should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store[0.5] = 340282366920938463463374607431768211456 store.key?(0.5).should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store(0.5, value).should equal(value) store[0.5].should == 340282366920938463463374607431768211456 store.load(0.5).should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store[0.5] = 340282366920938463463374607431768211456 store[-0.3] = 33 store.clear.should equal(store) store[0.5] = 340282366920938463463374607431768211456 store[0.5].should == 340282366920938463463374607431768211456 store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = 340282366920938463463374607431768211456 store.delete(0.5).should == 340282366920938463463374607431768211456 store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = 340282366920938463463374607431768211456 store[0.5].should == 340282366920938463463374607431768211456 store[0.5] = 33 store[0.5].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store[0.5] = value).should equal(value) store[0.5].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = 0.5.freeze store[key] = 340282366920938463463374607431768211456 store[0.5].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store[0.5] = 340282366920938463463374607431768211456 store.fetch(0.5, 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store[0.5] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch(0.5) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-0.3] = 340282366920938463463374607431768211456 store[-0.3].should == 340282366920938463463374607431768211456 store.load(-0.3).should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store[-0.3] = 340282366920938463463374607431768211456 store.key?(-0.3).should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store(-0.3, value).should equal(value) store[-0.3].should == 340282366920938463463374607431768211456 store.load(-0.3).should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store[-0.3] = 340282366920938463463374607431768211456 store[0.5] = 33 store.clear.should equal(store) store[-0.3] = 340282366920938463463374607431768211456 store[-0.3].should == 340282366920938463463374607431768211456 store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = 340282366920938463463374607431768211456 store.delete(-0.3).should == 340282366920938463463374607431768211456 store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = 340282366920938463463374607431768211456 store[-0.3].should == 340282366920938463463374607431768211456 store[-0.3] = 33 store[-0.3].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store[-0.3] = value).should equal(value) store[-0.3].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = -0.3.freeze store[key] = 340282366920938463463374607431768211456 store[-0.3].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store[-0.3] = 340282366920938463463374607431768211456 store.fetch(-0.3, 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store[-0.3] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch(-0.3) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0.5] = 33 store[0.5].should == 33 store.load(0.5).should == 33 end it 'returns true from #key? if a key is available' do store[0.5] = 33 store.key?(0.5).should be_true end it 'stores values with #store' do value = 33 store.store(0.5, value).should equal(value) store[0.5].should == 33 store.load(0.5).should == 33 end it 'stores values after clear' do store[0.5] = 33 store[-0.3] = 340282366920938463463374607431768211456 store.clear.should equal(store) store[0.5] = 33 store[0.5].should == 33 store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = 33 store.delete(0.5).should == 33 store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = 33 store[0.5].should == 33 store[0.5] = 340282366920938463463374607431768211456 store[0.5].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store[0.5] = value).should equal(value) store[0.5].should == 33 end it 'stores frozen keys' do key = 0.5.freeze store[key] = 33 store[0.5].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store[0.5] = 33 store.fetch(0.5, 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store[0.5] = 33 unaltered = 'unaltered' store.fetch(0.5) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-0.3] = 33 store[-0.3].should == 33 store.load(-0.3).should == 33 end it 'returns true from #key? if a key is available' do store[-0.3] = 33 store.key?(-0.3).should be_true end it 'stores values with #store' do value = 33 store.store(-0.3, value).should equal(value) store[-0.3].should == 33 store.load(-0.3).should == 33 end it 'stores values after clear' do store[-0.3] = 33 store[0.5] = 340282366920938463463374607431768211456 store.clear.should equal(store) store[-0.3] = 33 store[-0.3].should == 33 store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = 33 store.delete(-0.3).should == 33 store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = 33 store[-0.3].should == 33 store[-0.3] = 340282366920938463463374607431768211456 store[-0.3].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store[-0.3] = value).should equal(value) store[-0.3].should == 33 end it 'stores frozen keys' do key = -0.3.freeze store[key] = 33 store[-0.3].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store[-0.3] = 33 store.fetch(-0.3, 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store[-0.3] = 33 unaltered = 'unaltered' store.fetch(-0.3) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = 123.456 store[170141183460469231731687303715884105728].should == 123.456 store.load(170141183460469231731687303715884105728).should == 123.456 end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = 123.456 store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = 123.456 store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == 123.456 store.load(170141183460469231731687303715884105728).should == 123.456 end it 'stores values after clear' do store[170141183460469231731687303715884105728] = 123.456 store[99] = -98.7 store.clear.should equal(store) store[170141183460469231731687303715884105728] = 123.456 store[170141183460469231731687303715884105728].should == 123.456 store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = 123.456 store.delete(170141183460469231731687303715884105728).should == 123.456 store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = 123.456 store[170141183460469231731687303715884105728].should == 123.456 store[170141183460469231731687303715884105728] = -98.7 store[170141183460469231731687303715884105728].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == 123.456 end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = 123.456 store[170141183460469231731687303715884105728].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store[170141183460469231731687303715884105728] = 123.456 store.fetch(170141183460469231731687303715884105728, -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store[170141183460469231731687303715884105728] = 123.456 unaltered = 'unaltered' store.fetch(170141183460469231731687303715884105728) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[99] = 123.456 store[99].should == 123.456 store.load(99).should == 123.456 end it 'returns true from #key? if a key is available' do store[99] = 123.456 store.key?(99).should be_true end it 'stores values with #store' do value = 123.456 store.store(99, value).should equal(value) store[99].should == 123.456 store.load(99).should == 123.456 end it 'stores values after clear' do store[99] = 123.456 store[170141183460469231731687303715884105728] = -98.7 store.clear.should equal(store) store[99] = 123.456 store[99].should == 123.456 store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = 123.456 store.delete(99).should == 123.456 store.key?(99).should be_false end it 'overwrites existing values' do store[99] = 123.456 store[99].should == 123.456 store[99] = -98.7 store[99].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store[99] = value).should equal(value) store[99].should == 123.456 end it 'stores frozen keys' do key = 99.freeze store[key] = 123.456 store[99].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store[99] = 123.456 store.fetch(99, -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store[99] = 123.456 unaltered = 'unaltered' store.fetch(99) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = -98.7 store[170141183460469231731687303715884105728].should == -98.7 store.load(170141183460469231731687303715884105728).should == -98.7 end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = -98.7 store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = -98.7 store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == -98.7 store.load(170141183460469231731687303715884105728).should == -98.7 end it 'stores values after clear' do store[170141183460469231731687303715884105728] = -98.7 store[99] = 123.456 store.clear.should equal(store) store[170141183460469231731687303715884105728] = -98.7 store[170141183460469231731687303715884105728].should == -98.7 store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = -98.7 store.delete(170141183460469231731687303715884105728).should == -98.7 store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = -98.7 store[170141183460469231731687303715884105728].should == -98.7 store[170141183460469231731687303715884105728] = 123.456 store[170141183460469231731687303715884105728].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == -98.7 end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = -98.7 store[170141183460469231731687303715884105728].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store[170141183460469231731687303715884105728] = -98.7 store.fetch(170141183460469231731687303715884105728, 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store[170141183460469231731687303715884105728] = -98.7 unaltered = 'unaltered' store.fetch(170141183460469231731687303715884105728) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[99] = -98.7 store[99].should == -98.7 store.load(99).should == -98.7 end it 'returns true from #key? if a key is available' do store[99] = -98.7 store.key?(99).should be_true end it 'stores values with #store' do value = -98.7 store.store(99, value).should equal(value) store[99].should == -98.7 store.load(99).should == -98.7 end it 'stores values after clear' do store[99] = -98.7 store[170141183460469231731687303715884105728] = 123.456 store.clear.should equal(store) store[99] = -98.7 store[99].should == -98.7 store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = -98.7 store.delete(99).should == -98.7 store.key?(99).should be_false end it 'overwrites existing values' do store[99] = -98.7 store[99].should == -98.7 store[99] = 123.456 store[99].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store[99] = value).should equal(value) store[99].should == -98.7 end it 'stores frozen keys' do key = 99.freeze store[key] = -98.7 store[99].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store[99] = -98.7 store.fetch(99, 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store[99] = -98.7 unaltered = 'unaltered' store.fetch(99) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = 340282366920938463463374607431768211456 store[170141183460469231731687303715884105728].should == 340282366920938463463374607431768211456 store.load(170141183460469231731687303715884105728).should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = 340282366920938463463374607431768211456 store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == 340282366920938463463374607431768211456 store.load(170141183460469231731687303715884105728).should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store[170141183460469231731687303715884105728] = 340282366920938463463374607431768211456 store[99] = 33 store.clear.should equal(store) store[170141183460469231731687303715884105728] = 340282366920938463463374607431768211456 store[170141183460469231731687303715884105728].should == 340282366920938463463374607431768211456 store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = 340282366920938463463374607431768211456 store.delete(170141183460469231731687303715884105728).should == 340282366920938463463374607431768211456 store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = 340282366920938463463374607431768211456 store[170141183460469231731687303715884105728].should == 340282366920938463463374607431768211456 store[170141183460469231731687303715884105728] = 33 store[170141183460469231731687303715884105728].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = 340282366920938463463374607431768211456 store[170141183460469231731687303715884105728].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store[170141183460469231731687303715884105728] = 340282366920938463463374607431768211456 store.fetch(170141183460469231731687303715884105728, 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store[170141183460469231731687303715884105728] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch(170141183460469231731687303715884105728) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[99] = 340282366920938463463374607431768211456 store[99].should == 340282366920938463463374607431768211456 store.load(99).should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store[99] = 340282366920938463463374607431768211456 store.key?(99).should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store(99, value).should equal(value) store[99].should == 340282366920938463463374607431768211456 store.load(99).should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store[99] = 340282366920938463463374607431768211456 store[170141183460469231731687303715884105728] = 33 store.clear.should equal(store) store[99] = 340282366920938463463374607431768211456 store[99].should == 340282366920938463463374607431768211456 store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = 340282366920938463463374607431768211456 store.delete(99).should == 340282366920938463463374607431768211456 store.key?(99).should be_false end it 'overwrites existing values' do store[99] = 340282366920938463463374607431768211456 store[99].should == 340282366920938463463374607431768211456 store[99] = 33 store[99].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store[99] = value).should equal(value) store[99].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = 99.freeze store[key] = 340282366920938463463374607431768211456 store[99].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store[99] = 340282366920938463463374607431768211456 store.fetch(99, 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store[99] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch(99) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = 33 store[170141183460469231731687303715884105728].should == 33 store.load(170141183460469231731687303715884105728).should == 33 end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = 33 store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = 33 store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == 33 store.load(170141183460469231731687303715884105728).should == 33 end it 'stores values after clear' do store[170141183460469231731687303715884105728] = 33 store[99] = 340282366920938463463374607431768211456 store.clear.should equal(store) store[170141183460469231731687303715884105728] = 33 store[170141183460469231731687303715884105728].should == 33 store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = 33 store.delete(170141183460469231731687303715884105728).should == 33 store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = 33 store[170141183460469231731687303715884105728].should == 33 store[170141183460469231731687303715884105728] = 340282366920938463463374607431768211456 store[170141183460469231731687303715884105728].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == 33 end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = 33 store[170141183460469231731687303715884105728].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store[170141183460469231731687303715884105728] = 33 store.fetch(170141183460469231731687303715884105728, 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store[170141183460469231731687303715884105728] = 33 unaltered = 'unaltered' store.fetch(170141183460469231731687303715884105728) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[99] = 33 store[99].should == 33 store.load(99).should == 33 end it 'returns true from #key? if a key is available' do store[99] = 33 store.key?(99).should be_true end it 'stores values with #store' do value = 33 store.store(99, value).should equal(value) store[99].should == 33 store.load(99).should == 33 end it 'stores values after clear' do store[99] = 33 store[170141183460469231731687303715884105728] = 340282366920938463463374607431768211456 store.clear.should equal(store) store[99] = 33 store[99].should == 33 store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = 33 store.delete(99).should == 33 store.key?(99).should be_false end it 'overwrites existing values' do store[99] = 33 store[99].should == 33 store[99] = 340282366920938463463374607431768211456 store[99].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store[99] = value).should equal(value) store[99].should == 33 end it 'stores frozen keys' do key = 99.freeze store[key] = 33 store[99].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store[99] = 33 store.fetch(99, 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store[99] = 33 unaltered = 'unaltered' store.fetch(99) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_numberkey_numbervalue #################### shared_examples_for 'persist_numberkey_numbervalue' do it 'persists values' do store[0.5] = 123.456 store.close @store = nil store[0.5].should == 123.456 end it 'persists values' do store[-0.3] = 123.456 store.close @store = nil store[-0.3].should == 123.456 end it 'persists values' do store[0.5] = -98.7 store.close @store = nil store[0.5].should == -98.7 end it 'persists values' do store[-0.3] = -98.7 store.close @store = nil store[-0.3].should == -98.7 end it 'persists values' do store[0.5] = 340282366920938463463374607431768211456 store.close @store = nil store[0.5].should == 340282366920938463463374607431768211456 end it 'persists values' do store[-0.3] = 340282366920938463463374607431768211456 store.close @store = nil store[-0.3].should == 340282366920938463463374607431768211456 end it 'persists values' do store[0.5] = 33 store.close @store = nil store[0.5].should == 33 end it 'persists values' do store[-0.3] = 33 store.close @store = nil store[-0.3].should == 33 end it 'persists values' do store[170141183460469231731687303715884105728] = 123.456 store.close @store = nil store[170141183460469231731687303715884105728].should == 123.456 end it 'persists values' do store[99] = 123.456 store.close @store = nil store[99].should == 123.456 end it 'persists values' do store[170141183460469231731687303715884105728] = -98.7 store.close @store = nil store[170141183460469231731687303715884105728].should == -98.7 end it 'persists values' do store[99] = -98.7 store.close @store = nil store[99].should == -98.7 end it 'persists values' do store[170141183460469231731687303715884105728] = 340282366920938463463374607431768211456 store.close @store = nil store[170141183460469231731687303715884105728].should == 340282366920938463463374607431768211456 end it 'persists values' do store[99] = 340282366920938463463374607431768211456 store.close @store = nil store[99].should == 340282366920938463463374607431768211456 end it 'persists values' do store[170141183460469231731687303715884105728] = 33 store.close @store = nil store[170141183460469231731687303715884105728].should == 33 end it 'persists values' do store[99] = 33 store.close @store = nil store[99].should == 33 end end #################### null_numberkey_booleanvalue #################### shared_examples_for 'null_numberkey_booleanvalue' do it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = true store[-0.3] = false store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, true, options).should == true end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = true store[0.5] = false store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, true, options).should == true end it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = false store[-0.3] = true store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, false, options).should == false end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = false store[0.5] = true store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, false, options).should == false end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = true store[99] = false store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, true, options).should == true end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = true store[170141183460469231731687303715884105728] = false store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, true, options).should == true end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = false store[99] = true store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, false, options).should == false end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = false store[170141183460469231731687303715884105728] = true store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, false, options).should == false end end #################### store_numberkey_booleanvalue #################### shared_examples_for 'store_numberkey_booleanvalue' do it 'writes values to keys that like a Hash' do store[0.5] = true store[0.5].should == true store.load(0.5).should == true end it 'returns true from #key? if a key is available' do store[0.5] = true store.key?(0.5).should be_true end it 'stores values with #store' do value = true store.store(0.5, value).should equal(value) store[0.5].should == true store.load(0.5).should == true end it 'stores values after clear' do store[0.5] = true store[-0.3] = false store.clear.should equal(store) store[0.5] = true store[0.5].should == true store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = true store.delete(0.5).should == true store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = true store[0.5].should == true store[0.5] = false store[0.5].should == false end it 'stores frozen values' do value = true.freeze (store[0.5] = value).should equal(value) store[0.5].should == true end it 'stores frozen keys' do key = 0.5.freeze store[key] = true store[0.5].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store[0.5] = true store.fetch(0.5, false).should == true end it 'does not run the block in fetch if the key is available' do store[0.5] = true unaltered = 'unaltered' store.fetch(0.5) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-0.3] = true store[-0.3].should == true store.load(-0.3).should == true end it 'returns true from #key? if a key is available' do store[-0.3] = true store.key?(-0.3).should be_true end it 'stores values with #store' do value = true store.store(-0.3, value).should equal(value) store[-0.3].should == true store.load(-0.3).should == true end it 'stores values after clear' do store[-0.3] = true store[0.5] = false store.clear.should equal(store) store[-0.3] = true store[-0.3].should == true store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = true store.delete(-0.3).should == true store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = true store[-0.3].should == true store[-0.3] = false store[-0.3].should == false end it 'stores frozen values' do value = true.freeze (store[-0.3] = value).should equal(value) store[-0.3].should == true end it 'stores frozen keys' do key = -0.3.freeze store[key] = true store[-0.3].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store[-0.3] = true store.fetch(-0.3, false).should == true end it 'does not run the block in fetch if the key is available' do store[-0.3] = true unaltered = 'unaltered' store.fetch(-0.3) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0.5] = false store[0.5].should == false store.load(0.5).should == false end it 'returns true from #key? if a key is available' do store[0.5] = false store.key?(0.5).should be_true end it 'stores values with #store' do value = false store.store(0.5, value).should equal(value) store[0.5].should == false store.load(0.5).should == false end it 'stores values after clear' do store[0.5] = false store[-0.3] = true store.clear.should equal(store) store[0.5] = false store[0.5].should == false store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = false store.delete(0.5).should == false store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = false store[0.5].should == false store[0.5] = true store[0.5].should == true end it 'stores frozen values' do value = false.freeze (store[0.5] = value).should equal(value) store[0.5].should == false end it 'stores frozen keys' do key = 0.5.freeze store[key] = false store[0.5].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store[0.5] = false store.fetch(0.5, true).should == false end it 'does not run the block in fetch if the key is available' do store[0.5] = false unaltered = 'unaltered' store.fetch(0.5) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-0.3] = false store[-0.3].should == false store.load(-0.3).should == false end it 'returns true from #key? if a key is available' do store[-0.3] = false store.key?(-0.3).should be_true end it 'stores values with #store' do value = false store.store(-0.3, value).should equal(value) store[-0.3].should == false store.load(-0.3).should == false end it 'stores values after clear' do store[-0.3] = false store[0.5] = true store.clear.should equal(store) store[-0.3] = false store[-0.3].should == false store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = false store.delete(-0.3).should == false store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = false store[-0.3].should == false store[-0.3] = true store[-0.3].should == true end it 'stores frozen values' do value = false.freeze (store[-0.3] = value).should equal(value) store[-0.3].should == false end it 'stores frozen keys' do key = -0.3.freeze store[key] = false store[-0.3].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store[-0.3] = false store.fetch(-0.3, true).should == false end it 'does not run the block in fetch if the key is available' do store[-0.3] = false unaltered = 'unaltered' store.fetch(-0.3) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = true store[170141183460469231731687303715884105728].should == true store.load(170141183460469231731687303715884105728).should == true end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = true store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = true store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == true store.load(170141183460469231731687303715884105728).should == true end it 'stores values after clear' do store[170141183460469231731687303715884105728] = true store[99] = false store.clear.should equal(store) store[170141183460469231731687303715884105728] = true store[170141183460469231731687303715884105728].should == true store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = true store.delete(170141183460469231731687303715884105728).should == true store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = true store[170141183460469231731687303715884105728].should == true store[170141183460469231731687303715884105728] = false store[170141183460469231731687303715884105728].should == false end it 'stores frozen values' do value = true.freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == true end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = true store[170141183460469231731687303715884105728].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store[170141183460469231731687303715884105728] = true store.fetch(170141183460469231731687303715884105728, false).should == true end it 'does not run the block in fetch if the key is available' do store[170141183460469231731687303715884105728] = true unaltered = 'unaltered' store.fetch(170141183460469231731687303715884105728) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[99] = true store[99].should == true store.load(99).should == true end it 'returns true from #key? if a key is available' do store[99] = true store.key?(99).should be_true end it 'stores values with #store' do value = true store.store(99, value).should equal(value) store[99].should == true store.load(99).should == true end it 'stores values after clear' do store[99] = true store[170141183460469231731687303715884105728] = false store.clear.should equal(store) store[99] = true store[99].should == true store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = true store.delete(99).should == true store.key?(99).should be_false end it 'overwrites existing values' do store[99] = true store[99].should == true store[99] = false store[99].should == false end it 'stores frozen values' do value = true.freeze (store[99] = value).should equal(value) store[99].should == true end it 'stores frozen keys' do key = 99.freeze store[key] = true store[99].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store[99] = true store.fetch(99, false).should == true end it 'does not run the block in fetch if the key is available' do store[99] = true unaltered = 'unaltered' store.fetch(99) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = false store[170141183460469231731687303715884105728].should == false store.load(170141183460469231731687303715884105728).should == false end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = false store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = false store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == false store.load(170141183460469231731687303715884105728).should == false end it 'stores values after clear' do store[170141183460469231731687303715884105728] = false store[99] = true store.clear.should equal(store) store[170141183460469231731687303715884105728] = false store[170141183460469231731687303715884105728].should == false store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = false store.delete(170141183460469231731687303715884105728).should == false store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = false store[170141183460469231731687303715884105728].should == false store[170141183460469231731687303715884105728] = true store[170141183460469231731687303715884105728].should == true end it 'stores frozen values' do value = false.freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == false end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = false store[170141183460469231731687303715884105728].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store[170141183460469231731687303715884105728] = false store.fetch(170141183460469231731687303715884105728, true).should == false end it 'does not run the block in fetch if the key is available' do store[170141183460469231731687303715884105728] = false unaltered = 'unaltered' store.fetch(170141183460469231731687303715884105728) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[99] = false store[99].should == false store.load(99).should == false end it 'returns true from #key? if a key is available' do store[99] = false store.key?(99).should be_true end it 'stores values with #store' do value = false store.store(99, value).should equal(value) store[99].should == false store.load(99).should == false end it 'stores values after clear' do store[99] = false store[170141183460469231731687303715884105728] = true store.clear.should equal(store) store[99] = false store[99].should == false store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = false store.delete(99).should == false store.key?(99).should be_false end it 'overwrites existing values' do store[99] = false store[99].should == false store[99] = true store[99].should == true end it 'stores frozen values' do value = false.freeze (store[99] = value).should equal(value) store[99].should == false end it 'stores frozen keys' do key = 99.freeze store[key] = false store[99].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store[99] = false store.fetch(99, true).should == false end it 'does not run the block in fetch if the key is available' do store[99] = false unaltered = 'unaltered' store.fetch(99) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_numberkey_booleanvalue #################### shared_examples_for 'persist_numberkey_booleanvalue' do it 'persists values' do store[0.5] = true store.close @store = nil store[0.5].should == true end it 'persists values' do store[-0.3] = true store.close @store = nil store[-0.3].should == true end it 'persists values' do store[0.5] = false store.close @store = nil store[0.5].should == false end it 'persists values' do store[-0.3] = false store.close @store = nil store[-0.3].should == false end it 'persists values' do store[170141183460469231731687303715884105728] = true store.close @store = nil store[170141183460469231731687303715884105728].should == true end it 'persists values' do store[99] = true store.close @store = nil store[99].should == true end it 'persists values' do store[170141183460469231731687303715884105728] = false store.close @store = nil store[170141183460469231731687303715884105728].should == false end it 'persists values' do store[99] = false store.close @store = nil store[99].should == false end end #################### null_numberkey_stringvalue #################### shared_examples_for 'null_numberkey_stringvalue' do it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = "strval1" store[-0.3] = "strval2" store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = "strval1" store[0.5] = "strval2" store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = "strval2" store[-0.3] = "strval1" store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, "strval2", options).should == "strval2" end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = "strval2" store[0.5] = "strval1" store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, "strval2", options).should == "strval2" end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = "strval1" store[99] = "strval2" store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = "strval1" store[170141183460469231731687303715884105728] = "strval2" store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = "strval2" store[99] = "strval1" store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, "strval2", options).should == "strval2" end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = "strval2" store[170141183460469231731687303715884105728] = "strval1" store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, "strval2", options).should == "strval2" end end #################### store_numberkey_stringvalue #################### shared_examples_for 'store_numberkey_stringvalue' do it 'writes values to keys that like a Hash' do store[0.5] = "strval1" store[0.5].should == "strval1" store.load(0.5).should == "strval1" end it 'returns true from #key? if a key is available' do store[0.5] = "strval1" store.key?(0.5).should be_true end it 'stores values with #store' do value = "strval1" store.store(0.5, value).should equal(value) store[0.5].should == "strval1" store.load(0.5).should == "strval1" end it 'stores values after clear' do store[0.5] = "strval1" store[-0.3] = "strval2" store.clear.should equal(store) store[0.5] = "strval1" store[0.5].should == "strval1" store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = "strval1" store.delete(0.5).should == "strval1" store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = "strval1" store[0.5].should == "strval1" store[0.5] = "strval2" store[0.5].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store[0.5] = value).should equal(value) store[0.5].should == "strval1" end it 'stores frozen keys' do key = 0.5.freeze store[key] = "strval1" store[0.5].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store[0.5] = "strval1" store.fetch(0.5, "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store[0.5] = "strval1" unaltered = 'unaltered' store.fetch(0.5) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-0.3] = "strval1" store[-0.3].should == "strval1" store.load(-0.3).should == "strval1" end it 'returns true from #key? if a key is available' do store[-0.3] = "strval1" store.key?(-0.3).should be_true end it 'stores values with #store' do value = "strval1" store.store(-0.3, value).should equal(value) store[-0.3].should == "strval1" store.load(-0.3).should == "strval1" end it 'stores values after clear' do store[-0.3] = "strval1" store[0.5] = "strval2" store.clear.should equal(store) store[-0.3] = "strval1" store[-0.3].should == "strval1" store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = "strval1" store.delete(-0.3).should == "strval1" store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = "strval1" store[-0.3].should == "strval1" store[-0.3] = "strval2" store[-0.3].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store[-0.3] = value).should equal(value) store[-0.3].should == "strval1" end it 'stores frozen keys' do key = -0.3.freeze store[key] = "strval1" store[-0.3].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store[-0.3] = "strval1" store.fetch(-0.3, "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store[-0.3] = "strval1" unaltered = 'unaltered' store.fetch(-0.3) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0.5] = "strval2" store[0.5].should == "strval2" store.load(0.5).should == "strval2" end it 'returns true from #key? if a key is available' do store[0.5] = "strval2" store.key?(0.5).should be_true end it 'stores values with #store' do value = "strval2" store.store(0.5, value).should equal(value) store[0.5].should == "strval2" store.load(0.5).should == "strval2" end it 'stores values after clear' do store[0.5] = "strval2" store[-0.3] = "strval1" store.clear.should equal(store) store[0.5] = "strval2" store[0.5].should == "strval2" store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = "strval2" store.delete(0.5).should == "strval2" store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = "strval2" store[0.5].should == "strval2" store[0.5] = "strval1" store[0.5].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store[0.5] = value).should equal(value) store[0.5].should == "strval2" end it 'stores frozen keys' do key = 0.5.freeze store[key] = "strval2" store[0.5].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store[0.5] = "strval2" store.fetch(0.5, "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store[0.5] = "strval2" unaltered = 'unaltered' store.fetch(0.5) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-0.3] = "strval2" store[-0.3].should == "strval2" store.load(-0.3).should == "strval2" end it 'returns true from #key? if a key is available' do store[-0.3] = "strval2" store.key?(-0.3).should be_true end it 'stores values with #store' do value = "strval2" store.store(-0.3, value).should equal(value) store[-0.3].should == "strval2" store.load(-0.3).should == "strval2" end it 'stores values after clear' do store[-0.3] = "strval2" store[0.5] = "strval1" store.clear.should equal(store) store[-0.3] = "strval2" store[-0.3].should == "strval2" store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = "strval2" store.delete(-0.3).should == "strval2" store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = "strval2" store[-0.3].should == "strval2" store[-0.3] = "strval1" store[-0.3].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store[-0.3] = value).should equal(value) store[-0.3].should == "strval2" end it 'stores frozen keys' do key = -0.3.freeze store[key] = "strval2" store[-0.3].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store[-0.3] = "strval2" store.fetch(-0.3, "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store[-0.3] = "strval2" unaltered = 'unaltered' store.fetch(-0.3) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = "strval1" store[170141183460469231731687303715884105728].should == "strval1" store.load(170141183460469231731687303715884105728).should == "strval1" end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = "strval1" store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = "strval1" store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == "strval1" store.load(170141183460469231731687303715884105728).should == "strval1" end it 'stores values after clear' do store[170141183460469231731687303715884105728] = "strval1" store[99] = "strval2" store.clear.should equal(store) store[170141183460469231731687303715884105728] = "strval1" store[170141183460469231731687303715884105728].should == "strval1" store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = "strval1" store.delete(170141183460469231731687303715884105728).should == "strval1" store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = "strval1" store[170141183460469231731687303715884105728].should == "strval1" store[170141183460469231731687303715884105728] = "strval2" store[170141183460469231731687303715884105728].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == "strval1" end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = "strval1" store[170141183460469231731687303715884105728].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store[170141183460469231731687303715884105728] = "strval1" store.fetch(170141183460469231731687303715884105728, "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store[170141183460469231731687303715884105728] = "strval1" unaltered = 'unaltered' store.fetch(170141183460469231731687303715884105728) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[99] = "strval1" store[99].should == "strval1" store.load(99).should == "strval1" end it 'returns true from #key? if a key is available' do store[99] = "strval1" store.key?(99).should be_true end it 'stores values with #store' do value = "strval1" store.store(99, value).should equal(value) store[99].should == "strval1" store.load(99).should == "strval1" end it 'stores values after clear' do store[99] = "strval1" store[170141183460469231731687303715884105728] = "strval2" store.clear.should equal(store) store[99] = "strval1" store[99].should == "strval1" store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = "strval1" store.delete(99).should == "strval1" store.key?(99).should be_false end it 'overwrites existing values' do store[99] = "strval1" store[99].should == "strval1" store[99] = "strval2" store[99].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store[99] = value).should equal(value) store[99].should == "strval1" end it 'stores frozen keys' do key = 99.freeze store[key] = "strval1" store[99].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store[99] = "strval1" store.fetch(99, "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store[99] = "strval1" unaltered = 'unaltered' store.fetch(99) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = "strval2" store[170141183460469231731687303715884105728].should == "strval2" store.load(170141183460469231731687303715884105728).should == "strval2" end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = "strval2" store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = "strval2" store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == "strval2" store.load(170141183460469231731687303715884105728).should == "strval2" end it 'stores values after clear' do store[170141183460469231731687303715884105728] = "strval2" store[99] = "strval1" store.clear.should equal(store) store[170141183460469231731687303715884105728] = "strval2" store[170141183460469231731687303715884105728].should == "strval2" store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = "strval2" store.delete(170141183460469231731687303715884105728).should == "strval2" store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = "strval2" store[170141183460469231731687303715884105728].should == "strval2" store[170141183460469231731687303715884105728] = "strval1" store[170141183460469231731687303715884105728].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == "strval2" end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = "strval2" store[170141183460469231731687303715884105728].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store[170141183460469231731687303715884105728] = "strval2" store.fetch(170141183460469231731687303715884105728, "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store[170141183460469231731687303715884105728] = "strval2" unaltered = 'unaltered' store.fetch(170141183460469231731687303715884105728) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[99] = "strval2" store[99].should == "strval2" store.load(99).should == "strval2" end it 'returns true from #key? if a key is available' do store[99] = "strval2" store.key?(99).should be_true end it 'stores values with #store' do value = "strval2" store.store(99, value).should equal(value) store[99].should == "strval2" store.load(99).should == "strval2" end it 'stores values after clear' do store[99] = "strval2" store[170141183460469231731687303715884105728] = "strval1" store.clear.should equal(store) store[99] = "strval2" store[99].should == "strval2" store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = "strval2" store.delete(99).should == "strval2" store.key?(99).should be_false end it 'overwrites existing values' do store[99] = "strval2" store[99].should == "strval2" store[99] = "strval1" store[99].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store[99] = value).should equal(value) store[99].should == "strval2" end it 'stores frozen keys' do key = 99.freeze store[key] = "strval2" store[99].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store[99] = "strval2" store.fetch(99, "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store[99] = "strval2" unaltered = 'unaltered' store.fetch(99) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_numberkey_stringvalue #################### shared_examples_for 'returndifferent_numberkey_stringvalue' do it 'guarantees that a different value is retrieved' do value = "strval1" store[0.5] = value store[0.5].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval1" store[-0.3] = value store[-0.3].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store[0.5] = value store[0.5].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store[-0.3] = value store[-0.3].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval1" store[170141183460469231731687303715884105728] = value store[170141183460469231731687303715884105728].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval1" store[99] = value store[99].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store[170141183460469231731687303715884105728] = value store[170141183460469231731687303715884105728].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store[99] = value store[99].should_not be_equal(value) end end #################### returnsame_numberkey_stringvalue #################### shared_examples_for 'returnsame_numberkey_stringvalue' do it 'guarantees that the same value is retrieved' do value = "strval1" store[0.5] = value store[0.5].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval1" store[-0.3] = value store[-0.3].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store[0.5] = value store[0.5].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store[-0.3] = value store[-0.3].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval1" store[170141183460469231731687303715884105728] = value store[170141183460469231731687303715884105728].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval1" store[99] = value store[99].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store[170141183460469231731687303715884105728] = value store[170141183460469231731687303715884105728].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store[99] = value store[99].should be_equal(value) end end #################### persist_numberkey_stringvalue #################### shared_examples_for 'persist_numberkey_stringvalue' do it 'persists values' do store[0.5] = "strval1" store.close @store = nil store[0.5].should == "strval1" end it 'persists values' do store[-0.3] = "strval1" store.close @store = nil store[-0.3].should == "strval1" end it 'persists values' do store[0.5] = "strval2" store.close @store = nil store[0.5].should == "strval2" end it 'persists values' do store[-0.3] = "strval2" store.close @store = nil store[-0.3].should == "strval2" end it 'persists values' do store[170141183460469231731687303715884105728] = "strval1" store.close @store = nil store[170141183460469231731687303715884105728].should == "strval1" end it 'persists values' do store[99] = "strval1" store.close @store = nil store[99].should == "strval1" end it 'persists values' do store[170141183460469231731687303715884105728] = "strval2" store.close @store = nil store[170141183460469231731687303715884105728].should == "strval2" end it 'persists values' do store[99] = "strval2" store.close @store = nil store[99].should == "strval2" end end #################### null_numberkey_binaryvalue #################### shared_examples_for 'null_numberkey_binaryvalue' do it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = "über" store[-0.3] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, "über", options).should == "über" end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = "über" store[0.5] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, "über", options).should == "über" end it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = "\xAA\xBB\xCC" store[-0.3] = "über" store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = "\xAA\xBB\xCC" store[0.5] = "über" store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = "über" store[99] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, "über", options).should == "über" end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = "über" store[170141183460469231731687303715884105728] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, "über", options).should == "über" end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = "\xAA\xBB\xCC" store[99] = "über" store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = "\xAA\xBB\xCC" store[170141183460469231731687303715884105728] = "über" store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end end #################### store_numberkey_binaryvalue #################### shared_examples_for 'store_numberkey_binaryvalue' do it 'writes values to keys that like a Hash' do store[0.5] = "über" store[0.5].should == "über" store.load(0.5).should == "über" end it 'returns true from #key? if a key is available' do store[0.5] = "über" store.key?(0.5).should be_true end it 'stores values with #store' do value = "über" store.store(0.5, value).should equal(value) store[0.5].should == "über" store.load(0.5).should == "über" end it 'stores values after clear' do store[0.5] = "über" store[-0.3] = "\xAA\xBB\xCC" store.clear.should equal(store) store[0.5] = "über" store[0.5].should == "über" store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = "über" store.delete(0.5).should == "über" store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = "über" store[0.5].should == "über" store[0.5] = "\xAA\xBB\xCC" store[0.5].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store[0.5] = value).should equal(value) store[0.5].should == "über" end it 'stores frozen keys' do key = 0.5.freeze store[key] = "über" store[0.5].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store[0.5] = "über" store.fetch(0.5, "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store[0.5] = "über" unaltered = 'unaltered' store.fetch(0.5) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-0.3] = "über" store[-0.3].should == "über" store.load(-0.3).should == "über" end it 'returns true from #key? if a key is available' do store[-0.3] = "über" store.key?(-0.3).should be_true end it 'stores values with #store' do value = "über" store.store(-0.3, value).should equal(value) store[-0.3].should == "über" store.load(-0.3).should == "über" end it 'stores values after clear' do store[-0.3] = "über" store[0.5] = "\xAA\xBB\xCC" store.clear.should equal(store) store[-0.3] = "über" store[-0.3].should == "über" store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = "über" store.delete(-0.3).should == "über" store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = "über" store[-0.3].should == "über" store[-0.3] = "\xAA\xBB\xCC" store[-0.3].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store[-0.3] = value).should equal(value) store[-0.3].should == "über" end it 'stores frozen keys' do key = -0.3.freeze store[key] = "über" store[-0.3].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store[-0.3] = "über" store.fetch(-0.3, "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store[-0.3] = "über" unaltered = 'unaltered' store.fetch(-0.3) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0.5] = "\xAA\xBB\xCC" store[0.5].should == "\xAA\xBB\xCC" store.load(0.5).should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store[0.5] = "\xAA\xBB\xCC" store.key?(0.5).should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store(0.5, value).should equal(value) store[0.5].should == "\xAA\xBB\xCC" store.load(0.5).should == "\xAA\xBB\xCC" end it 'stores values after clear' do store[0.5] = "\xAA\xBB\xCC" store[-0.3] = "über" store.clear.should equal(store) store[0.5] = "\xAA\xBB\xCC" store[0.5].should == "\xAA\xBB\xCC" store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = "\xAA\xBB\xCC" store.delete(0.5).should == "\xAA\xBB\xCC" store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = "\xAA\xBB\xCC" store[0.5].should == "\xAA\xBB\xCC" store[0.5] = "über" store[0.5].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store[0.5] = value).should equal(value) store[0.5].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = 0.5.freeze store[key] = "\xAA\xBB\xCC" store[0.5].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store[0.5] = "\xAA\xBB\xCC" store.fetch(0.5, "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store[0.5] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch(0.5) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-0.3] = "\xAA\xBB\xCC" store[-0.3].should == "\xAA\xBB\xCC" store.load(-0.3).should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store[-0.3] = "\xAA\xBB\xCC" store.key?(-0.3).should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store(-0.3, value).should equal(value) store[-0.3].should == "\xAA\xBB\xCC" store.load(-0.3).should == "\xAA\xBB\xCC" end it 'stores values after clear' do store[-0.3] = "\xAA\xBB\xCC" store[0.5] = "über" store.clear.should equal(store) store[-0.3] = "\xAA\xBB\xCC" store[-0.3].should == "\xAA\xBB\xCC" store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = "\xAA\xBB\xCC" store.delete(-0.3).should == "\xAA\xBB\xCC" store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = "\xAA\xBB\xCC" store[-0.3].should == "\xAA\xBB\xCC" store[-0.3] = "über" store[-0.3].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store[-0.3] = value).should equal(value) store[-0.3].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = -0.3.freeze store[key] = "\xAA\xBB\xCC" store[-0.3].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store[-0.3] = "\xAA\xBB\xCC" store.fetch(-0.3, "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store[-0.3] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch(-0.3) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = "über" store[170141183460469231731687303715884105728].should == "über" store.load(170141183460469231731687303715884105728).should == "über" end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = "über" store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = "über" store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == "über" store.load(170141183460469231731687303715884105728).should == "über" end it 'stores values after clear' do store[170141183460469231731687303715884105728] = "über" store[99] = "\xAA\xBB\xCC" store.clear.should equal(store) store[170141183460469231731687303715884105728] = "über" store[170141183460469231731687303715884105728].should == "über" store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = "über" store.delete(170141183460469231731687303715884105728).should == "über" store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = "über" store[170141183460469231731687303715884105728].should == "über" store[170141183460469231731687303715884105728] = "\xAA\xBB\xCC" store[170141183460469231731687303715884105728].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == "über" end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = "über" store[170141183460469231731687303715884105728].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store[170141183460469231731687303715884105728] = "über" store.fetch(170141183460469231731687303715884105728, "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store[170141183460469231731687303715884105728] = "über" unaltered = 'unaltered' store.fetch(170141183460469231731687303715884105728) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[99] = "über" store[99].should == "über" store.load(99).should == "über" end it 'returns true from #key? if a key is available' do store[99] = "über" store.key?(99).should be_true end it 'stores values with #store' do value = "über" store.store(99, value).should equal(value) store[99].should == "über" store.load(99).should == "über" end it 'stores values after clear' do store[99] = "über" store[170141183460469231731687303715884105728] = "\xAA\xBB\xCC" store.clear.should equal(store) store[99] = "über" store[99].should == "über" store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = "über" store.delete(99).should == "über" store.key?(99).should be_false end it 'overwrites existing values' do store[99] = "über" store[99].should == "über" store[99] = "\xAA\xBB\xCC" store[99].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store[99] = value).should equal(value) store[99].should == "über" end it 'stores frozen keys' do key = 99.freeze store[key] = "über" store[99].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store[99] = "über" store.fetch(99, "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store[99] = "über" unaltered = 'unaltered' store.fetch(99) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = "\xAA\xBB\xCC" store[170141183460469231731687303715884105728].should == "\xAA\xBB\xCC" store.load(170141183460469231731687303715884105728).should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = "\xAA\xBB\xCC" store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == "\xAA\xBB\xCC" store.load(170141183460469231731687303715884105728).should == "\xAA\xBB\xCC" end it 'stores values after clear' do store[170141183460469231731687303715884105728] = "\xAA\xBB\xCC" store[99] = "über" store.clear.should equal(store) store[170141183460469231731687303715884105728] = "\xAA\xBB\xCC" store[170141183460469231731687303715884105728].should == "\xAA\xBB\xCC" store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = "\xAA\xBB\xCC" store.delete(170141183460469231731687303715884105728).should == "\xAA\xBB\xCC" store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = "\xAA\xBB\xCC" store[170141183460469231731687303715884105728].should == "\xAA\xBB\xCC" store[170141183460469231731687303715884105728] = "über" store[170141183460469231731687303715884105728].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = "\xAA\xBB\xCC" store[170141183460469231731687303715884105728].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store[170141183460469231731687303715884105728] = "\xAA\xBB\xCC" store.fetch(170141183460469231731687303715884105728, "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store[170141183460469231731687303715884105728] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch(170141183460469231731687303715884105728) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[99] = "\xAA\xBB\xCC" store[99].should == "\xAA\xBB\xCC" store.load(99).should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store[99] = "\xAA\xBB\xCC" store.key?(99).should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store(99, value).should equal(value) store[99].should == "\xAA\xBB\xCC" store.load(99).should == "\xAA\xBB\xCC" end it 'stores values after clear' do store[99] = "\xAA\xBB\xCC" store[170141183460469231731687303715884105728] = "über" store.clear.should equal(store) store[99] = "\xAA\xBB\xCC" store[99].should == "\xAA\xBB\xCC" store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = "\xAA\xBB\xCC" store.delete(99).should == "\xAA\xBB\xCC" store.key?(99).should be_false end it 'overwrites existing values' do store[99] = "\xAA\xBB\xCC" store[99].should == "\xAA\xBB\xCC" store[99] = "über" store[99].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store[99] = value).should equal(value) store[99].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = 99.freeze store[key] = "\xAA\xBB\xCC" store[99].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store[99] = "\xAA\xBB\xCC" store.fetch(99, "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store[99] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch(99) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_numberkey_binaryvalue #################### shared_examples_for 'returndifferent_numberkey_binaryvalue' do it 'guarantees that a different value is retrieved' do value = "über" store[0.5] = value store[0.5].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "über" store[-0.3] = value store[-0.3].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store[0.5] = value store[0.5].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store[-0.3] = value store[-0.3].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "über" store[170141183460469231731687303715884105728] = value store[170141183460469231731687303715884105728].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "über" store[99] = value store[99].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store[170141183460469231731687303715884105728] = value store[170141183460469231731687303715884105728].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store[99] = value store[99].should_not be_equal(value) end end #################### returnsame_numberkey_binaryvalue #################### shared_examples_for 'returnsame_numberkey_binaryvalue' do it 'guarantees that the same value is retrieved' do value = "über" store[0.5] = value store[0.5].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "über" store[-0.3] = value store[-0.3].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store[0.5] = value store[0.5].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store[-0.3] = value store[-0.3].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "über" store[170141183460469231731687303715884105728] = value store[170141183460469231731687303715884105728].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "über" store[99] = value store[99].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store[170141183460469231731687303715884105728] = value store[170141183460469231731687303715884105728].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store[99] = value store[99].should be_equal(value) end end #################### persist_numberkey_binaryvalue #################### shared_examples_for 'persist_numberkey_binaryvalue' do it 'persists values' do store[0.5] = "über" store.close @store = nil store[0.5].should == "über" end it 'persists values' do store[-0.3] = "über" store.close @store = nil store[-0.3].should == "über" end it 'persists values' do store[0.5] = "\xAA\xBB\xCC" store.close @store = nil store[0.5].should == "\xAA\xBB\xCC" end it 'persists values' do store[-0.3] = "\xAA\xBB\xCC" store.close @store = nil store[-0.3].should == "\xAA\xBB\xCC" end it 'persists values' do store[170141183460469231731687303715884105728] = "über" store.close @store = nil store[170141183460469231731687303715884105728].should == "über" end it 'persists values' do store[99] = "über" store.close @store = nil store[99].should == "über" end it 'persists values' do store[170141183460469231731687303715884105728] = "\xAA\xBB\xCC" store.close @store = nil store[170141183460469231731687303715884105728].should == "\xAA\xBB\xCC" end it 'persists values' do store[99] = "\xAA\xBB\xCC" store.close @store = nil store[99].should == "\xAA\xBB\xCC" end end #################### null_numberkey_hashvalue #################### shared_examples_for 'null_numberkey_hashvalue' do it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = {"hashval1"=>["array1", 1]} store[-0.3] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = {"hashval1"=>["array1", 1]} store[0.5] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-0.3] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0.5] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = {"hashval1"=>["array1", 1]} store[99] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = {"hashval1"=>["array1", 1]} store[170141183460469231731687303715884105728] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[99] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[170141183460469231731687303715884105728] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### store_numberkey_hashvalue #################### shared_examples_for 'store_numberkey_hashvalue' do it 'writes values to keys that like a Hash' do store[0.5] = {"hashval1"=>["array1", 1]} store[0.5].should == {"hashval1"=>["array1", 1]} store.load(0.5).should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store[0.5] = {"hashval1"=>["array1", 1]} store.key?(0.5).should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store(0.5, value).should equal(value) store[0.5].should == {"hashval1"=>["array1", 1]} store.load(0.5).should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store[0.5] = {"hashval1"=>["array1", 1]} store[-0.3] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store[0.5] = {"hashval1"=>["array1", 1]} store[0.5].should == {"hashval1"=>["array1", 1]} store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = {"hashval1"=>["array1", 1]} store.delete(0.5).should == {"hashval1"=>["array1", 1]} store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = {"hashval1"=>["array1", 1]} store[0.5].should == {"hashval1"=>["array1", 1]} store[0.5] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0.5].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store[0.5] = value).should equal(value) store[0.5].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = 0.5.freeze store[key] = {"hashval1"=>["array1", 1]} store[0.5].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store[0.5] = {"hashval1"=>["array1", 1]} store.fetch(0.5, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store[0.5] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch(0.5) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-0.3] = {"hashval1"=>["array1", 1]} store[-0.3].should == {"hashval1"=>["array1", 1]} store.load(-0.3).should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store[-0.3] = {"hashval1"=>["array1", 1]} store.key?(-0.3).should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store(-0.3, value).should equal(value) store[-0.3].should == {"hashval1"=>["array1", 1]} store.load(-0.3).should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store[-0.3] = {"hashval1"=>["array1", 1]} store[0.5] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store[-0.3] = {"hashval1"=>["array1", 1]} store[-0.3].should == {"hashval1"=>["array1", 1]} store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = {"hashval1"=>["array1", 1]} store.delete(-0.3).should == {"hashval1"=>["array1", 1]} store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = {"hashval1"=>["array1", 1]} store[-0.3].should == {"hashval1"=>["array1", 1]} store[-0.3] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-0.3].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store[-0.3] = value).should equal(value) store[-0.3].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = -0.3.freeze store[key] = {"hashval1"=>["array1", 1]} store[-0.3].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store[-0.3] = {"hashval1"=>["array1", 1]} store.fetch(-0.3, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store[-0.3] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch(-0.3) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0.5] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0.5].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(0.5).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store[0.5] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(0.5).should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store(0.5, value).should equal(value) store[0.5].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(0.5).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store[0.5] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-0.3] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store[0.5] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0.5].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete(0.5).should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0.5].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[0.5] = {"hashval1"=>["array1", 1]} store[0.5].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store[0.5] = value).should equal(value) store[0.5].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = 0.5.freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0.5].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store[0.5] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(0.5, {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store[0.5] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch(0.5) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-0.3] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-0.3].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(-0.3).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store[-0.3] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(-0.3).should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store(-0.3, value).should equal(value) store[-0.3].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(-0.3).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store[-0.3] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0.5] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store[-0.3] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-0.3].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete(-0.3).should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-0.3].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[-0.3] = {"hashval1"=>["array1", 1]} store[-0.3].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store[-0.3] = value).should equal(value) store[-0.3].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = -0.3.freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-0.3].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store[-0.3] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(-0.3, {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store[-0.3] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch(-0.3) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = {"hashval1"=>["array1", 1]} store[170141183460469231731687303715884105728].should == {"hashval1"=>["array1", 1]} store.load(170141183460469231731687303715884105728).should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = {"hashval1"=>["array1", 1]} store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == {"hashval1"=>["array1", 1]} store.load(170141183460469231731687303715884105728).should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store[170141183460469231731687303715884105728] = {"hashval1"=>["array1", 1]} store[99] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store[170141183460469231731687303715884105728] = {"hashval1"=>["array1", 1]} store[170141183460469231731687303715884105728].should == {"hashval1"=>["array1", 1]} store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = {"hashval1"=>["array1", 1]} store.delete(170141183460469231731687303715884105728).should == {"hashval1"=>["array1", 1]} store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = {"hashval1"=>["array1", 1]} store[170141183460469231731687303715884105728].should == {"hashval1"=>["array1", 1]} store[170141183460469231731687303715884105728] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[170141183460469231731687303715884105728].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = {"hashval1"=>["array1", 1]} store[170141183460469231731687303715884105728].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store[170141183460469231731687303715884105728] = {"hashval1"=>["array1", 1]} store.fetch(170141183460469231731687303715884105728, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store[170141183460469231731687303715884105728] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch(170141183460469231731687303715884105728) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[99] = {"hashval1"=>["array1", 1]} store[99].should == {"hashval1"=>["array1", 1]} store.load(99).should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store[99] = {"hashval1"=>["array1", 1]} store.key?(99).should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store(99, value).should equal(value) store[99].should == {"hashval1"=>["array1", 1]} store.load(99).should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store[99] = {"hashval1"=>["array1", 1]} store[170141183460469231731687303715884105728] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store[99] = {"hashval1"=>["array1", 1]} store[99].should == {"hashval1"=>["array1", 1]} store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = {"hashval1"=>["array1", 1]} store.delete(99).should == {"hashval1"=>["array1", 1]} store.key?(99).should be_false end it 'overwrites existing values' do store[99] = {"hashval1"=>["array1", 1]} store[99].should == {"hashval1"=>["array1", 1]} store[99] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[99].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store[99] = value).should equal(value) store[99].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = 99.freeze store[key] = {"hashval1"=>["array1", 1]} store[99].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store[99] = {"hashval1"=>["array1", 1]} store.fetch(99, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store[99] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch(99) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[170141183460469231731687303715884105728].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(170141183460469231731687303715884105728).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(170141183460469231731687303715884105728).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store[170141183460469231731687303715884105728] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[99] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store[170141183460469231731687303715884105728] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[170141183460469231731687303715884105728].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete(170141183460469231731687303715884105728).should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[170141183460469231731687303715884105728].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[170141183460469231731687303715884105728] = {"hashval1"=>["array1", 1]} store[170141183460469231731687303715884105728].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[170141183460469231731687303715884105728].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store[170141183460469231731687303715884105728] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(170141183460469231731687303715884105728, {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store[170141183460469231731687303715884105728] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch(170141183460469231731687303715884105728) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[99] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[99].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(99).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store[99] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(99).should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store(99, value).should equal(value) store[99].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(99).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store[99] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[170141183460469231731687303715884105728] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store[99] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[99].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete(99).should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(99).should be_false end it 'overwrites existing values' do store[99] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[99].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[99] = {"hashval1"=>["array1", 1]} store[99].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store[99] = value).should equal(value) store[99].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = 99.freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[99].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store[99] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(99, {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store[99] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch(99) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_numberkey_hashvalue #################### shared_examples_for 'returndifferent_numberkey_hashvalue' do it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store[0.5] = value store[0.5].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store[-0.3] = value store[-0.3].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0.5] = value store[0.5].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-0.3] = value store[-0.3].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store[170141183460469231731687303715884105728] = value store[170141183460469231731687303715884105728].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store[99] = value store[99].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[170141183460469231731687303715884105728] = value store[170141183460469231731687303715884105728].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[99] = value store[99].should_not be_equal(value) end end #################### returnsame_numberkey_hashvalue #################### shared_examples_for 'returnsame_numberkey_hashvalue' do it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store[0.5] = value store[0.5].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store[-0.3] = value store[-0.3].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[0.5] = value store[0.5].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[-0.3] = value store[-0.3].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store[170141183460469231731687303715884105728] = value store[170141183460469231731687303715884105728].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store[99] = value store[99].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[170141183460469231731687303715884105728] = value store[170141183460469231731687303715884105728].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[99] = value store[99].should be_equal(value) end end #################### persist_numberkey_hashvalue #################### shared_examples_for 'persist_numberkey_hashvalue' do it 'persists values' do store[0.5] = {"hashval1"=>["array1", 1]} store.close @store = nil store[0.5].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store[-0.3] = {"hashval1"=>["array1", 1]} store.close @store = nil store[-0.3].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store[0.5] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store[0.5].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'persists values' do store[-0.3] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store[-0.3].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'persists values' do store[170141183460469231731687303715884105728] = {"hashval1"=>["array1", 1]} store.close @store = nil store[170141183460469231731687303715884105728].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store[99] = {"hashval1"=>["array1", 1]} store.close @store = nil store[99].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store[170141183460469231731687303715884105728] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store[170141183460469231731687303715884105728].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'persists values' do store[99] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store[99].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### null_numberkey_objectvalue #################### shared_examples_for 'null_numberkey_objectvalue' do it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = Value.new(:objval1) store[-0.3] = Value.new(:objval2) store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = Value.new(:objval1) store[0.5] = Value.new(:objval2) store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store[0.5].should be_nil store.load(0.5).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store[0.5] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(0.5).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(0.5).should be_nil end it 'removes all keys from the store with clear' do store[0.5] = Value.new(:objval2) store[-0.3] = Value.new(:objval1) store.clear.should equal(store) store.key?(0.5).should be_false store.key?(-0.3).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(0.5, Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = 0.5 value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(0.5, options).should be_false store.load(0.5, options).should be_nil store.fetch(0.5, 42, options).should == 42 store.fetch(0.5, options) { 42 }.should == 42 store.delete(0.5, options).should be_nil store.clear(options).should equal(store) store.store(0.5, Value.new(:objval2), options).should == Value.new(:objval2) end it 'reads from keys like a Hash' do store[-0.3].should be_nil store.load(-0.3).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store[-0.3] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(-0.3).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(-0.3).should be_nil end it 'removes all keys from the store with clear' do store[-0.3] = Value.new(:objval2) store[0.5] = Value.new(:objval1) store.clear.should equal(store) store.key?(-0.3).should be_false store.key?(0.5).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(-0.3, Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = -0.3 value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(-0.3, options).should be_false store.load(-0.3, options).should be_nil store.fetch(-0.3, 42, options).should == 42 store.fetch(-0.3, options) { 42 }.should == 42 store.delete(-0.3, options).should be_nil store.clear(options).should equal(store) store.store(-0.3, Value.new(:objval2), options).should == Value.new(:objval2) end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = Value.new(:objval1) store[99] = Value.new(:objval2) store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = Value.new(:objval1) store[170141183460469231731687303715884105728] = Value.new(:objval2) store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store[170141183460469231731687303715884105728].should be_nil store.load(170141183460469231731687303715884105728).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store[170141183460469231731687303715884105728] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(170141183460469231731687303715884105728).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(170141183460469231731687303715884105728).should be_nil end it 'removes all keys from the store with clear' do store[170141183460469231731687303715884105728] = Value.new(:objval2) store[99] = Value.new(:objval1) store.clear.should equal(store) store.key?(170141183460469231731687303715884105728).should be_false store.key?(99).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(170141183460469231731687303715884105728, Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = 170141183460469231731687303715884105728 value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(170141183460469231731687303715884105728, options).should be_false store.load(170141183460469231731687303715884105728, options).should be_nil store.fetch(170141183460469231731687303715884105728, 42, options).should == 42 store.fetch(170141183460469231731687303715884105728, options) { 42 }.should == 42 store.delete(170141183460469231731687303715884105728, options).should be_nil store.clear(options).should equal(store) store.store(170141183460469231731687303715884105728, Value.new(:objval2), options).should == Value.new(:objval2) end it 'reads from keys like a Hash' do store[99].should be_nil store.load(99).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store[99] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(99).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(99).should be_nil end it 'removes all keys from the store with clear' do store[99] = Value.new(:objval2) store[170141183460469231731687303715884105728] = Value.new(:objval1) store.clear.should equal(store) store.key?(99).should be_false store.key?(170141183460469231731687303715884105728).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(99, Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = 99 value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(99, options).should be_false store.load(99, options).should be_nil store.fetch(99, 42, options).should == 42 store.fetch(99, options) { 42 }.should == 42 store.delete(99, options).should be_nil store.clear(options).should equal(store) store.store(99, Value.new(:objval2), options).should == Value.new(:objval2) end end #################### store_numberkey_objectvalue #################### shared_examples_for 'store_numberkey_objectvalue' do it 'writes values to keys that like a Hash' do store[0.5] = Value.new(:objval1) store[0.5].should == Value.new(:objval1) store.load(0.5).should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store[0.5] = Value.new(:objval1) store.key?(0.5).should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store(0.5, value).should equal(value) store[0.5].should == Value.new(:objval1) store.load(0.5).should == Value.new(:objval1) end it 'stores values after clear' do store[0.5] = Value.new(:objval1) store[-0.3] = Value.new(:objval2) store.clear.should equal(store) store[0.5] = Value.new(:objval1) store[0.5].should == Value.new(:objval1) store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = Value.new(:objval1) store.delete(0.5).should == Value.new(:objval1) store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = Value.new(:objval1) store[0.5].should == Value.new(:objval1) store[0.5] = Value.new(:objval2) store[0.5].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store[0.5] = value).should equal(value) store[0.5].should == Value.new(:objval1) end it 'stores frozen keys' do key = 0.5.freeze store[key] = Value.new(:objval1) store[0.5].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store[0.5] = Value.new(:objval1) store.fetch(0.5, Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store[0.5] = Value.new(:objval1) unaltered = 'unaltered' store.fetch(0.5) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-0.3] = Value.new(:objval1) store[-0.3].should == Value.new(:objval1) store.load(-0.3).should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store[-0.3] = Value.new(:objval1) store.key?(-0.3).should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store(-0.3, value).should equal(value) store[-0.3].should == Value.new(:objval1) store.load(-0.3).should == Value.new(:objval1) end it 'stores values after clear' do store[-0.3] = Value.new(:objval1) store[0.5] = Value.new(:objval2) store.clear.should equal(store) store[-0.3] = Value.new(:objval1) store[-0.3].should == Value.new(:objval1) store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = Value.new(:objval1) store.delete(-0.3).should == Value.new(:objval1) store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = Value.new(:objval1) store[-0.3].should == Value.new(:objval1) store[-0.3] = Value.new(:objval2) store[-0.3].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store[-0.3] = value).should equal(value) store[-0.3].should == Value.new(:objval1) end it 'stores frozen keys' do key = -0.3.freeze store[key] = Value.new(:objval1) store[-0.3].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store[-0.3] = Value.new(:objval1) store.fetch(-0.3, Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store[-0.3] = Value.new(:objval1) unaltered = 'unaltered' store.fetch(-0.3) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[0.5] = Value.new(:objval2) store[0.5].should == Value.new(:objval2) store.load(0.5).should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store[0.5] = Value.new(:objval2) store.key?(0.5).should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store(0.5, value).should equal(value) store[0.5].should == Value.new(:objval2) store.load(0.5).should == Value.new(:objval2) end it 'stores values after clear' do store[0.5] = Value.new(:objval2) store[-0.3] = Value.new(:objval1) store.clear.should equal(store) store[0.5] = Value.new(:objval2) store[0.5].should == Value.new(:objval2) store[-0.3].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[0.5] = Value.new(:objval2) store.delete(0.5).should == Value.new(:objval2) store.key?(0.5).should be_false end it 'overwrites existing values' do store[0.5] = Value.new(:objval2) store[0.5].should == Value.new(:objval2) store[0.5] = Value.new(:objval1) store[0.5].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store[0.5] = value).should equal(value) store[0.5].should == Value.new(:objval2) end it 'stores frozen keys' do key = 0.5.freeze store[key] = Value.new(:objval2) store[0.5].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store[0.5] = Value.new(:objval2) store.fetch(0.5, Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store[0.5] = Value.new(:objval2) unaltered = 'unaltered' store.fetch(0.5) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[-0.3] = Value.new(:objval2) store[-0.3].should == Value.new(:objval2) store.load(-0.3).should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store[-0.3] = Value.new(:objval2) store.key?(-0.3).should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store(-0.3, value).should equal(value) store[-0.3].should == Value.new(:objval2) store.load(-0.3).should == Value.new(:objval2) end it 'stores values after clear' do store[-0.3] = Value.new(:objval2) store[0.5] = Value.new(:objval1) store.clear.should equal(store) store[-0.3] = Value.new(:objval2) store[-0.3].should == Value.new(:objval2) store[0.5].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[-0.3] = Value.new(:objval2) store.delete(-0.3).should == Value.new(:objval2) store.key?(-0.3).should be_false end it 'overwrites existing values' do store[-0.3] = Value.new(:objval2) store[-0.3].should == Value.new(:objval2) store[-0.3] = Value.new(:objval1) store[-0.3].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store[-0.3] = value).should equal(value) store[-0.3].should == Value.new(:objval2) end it 'stores frozen keys' do key = -0.3.freeze store[key] = Value.new(:objval2) store[-0.3].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store[-0.3] = Value.new(:objval2) store.fetch(-0.3, Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store[-0.3] = Value.new(:objval2) unaltered = 'unaltered' store.fetch(-0.3) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = Value.new(:objval1) store[170141183460469231731687303715884105728].should == Value.new(:objval1) store.load(170141183460469231731687303715884105728).should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = Value.new(:objval1) store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == Value.new(:objval1) store.load(170141183460469231731687303715884105728).should == Value.new(:objval1) end it 'stores values after clear' do store[170141183460469231731687303715884105728] = Value.new(:objval1) store[99] = Value.new(:objval2) store.clear.should equal(store) store[170141183460469231731687303715884105728] = Value.new(:objval1) store[170141183460469231731687303715884105728].should == Value.new(:objval1) store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = Value.new(:objval1) store.delete(170141183460469231731687303715884105728).should == Value.new(:objval1) store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = Value.new(:objval1) store[170141183460469231731687303715884105728].should == Value.new(:objval1) store[170141183460469231731687303715884105728] = Value.new(:objval2) store[170141183460469231731687303715884105728].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == Value.new(:objval1) end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = Value.new(:objval1) store[170141183460469231731687303715884105728].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store[170141183460469231731687303715884105728] = Value.new(:objval1) store.fetch(170141183460469231731687303715884105728, Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store[170141183460469231731687303715884105728] = Value.new(:objval1) unaltered = 'unaltered' store.fetch(170141183460469231731687303715884105728) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[99] = Value.new(:objval1) store[99].should == Value.new(:objval1) store.load(99).should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store[99] = Value.new(:objval1) store.key?(99).should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store(99, value).should equal(value) store[99].should == Value.new(:objval1) store.load(99).should == Value.new(:objval1) end it 'stores values after clear' do store[99] = Value.new(:objval1) store[170141183460469231731687303715884105728] = Value.new(:objval2) store.clear.should equal(store) store[99] = Value.new(:objval1) store[99].should == Value.new(:objval1) store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = Value.new(:objval1) store.delete(99).should == Value.new(:objval1) store.key?(99).should be_false end it 'overwrites existing values' do store[99] = Value.new(:objval1) store[99].should == Value.new(:objval1) store[99] = Value.new(:objval2) store[99].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store[99] = value).should equal(value) store[99].should == Value.new(:objval1) end it 'stores frozen keys' do key = 99.freeze store[key] = Value.new(:objval1) store[99].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store[99] = Value.new(:objval1) store.fetch(99, Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store[99] = Value.new(:objval1) unaltered = 'unaltered' store.fetch(99) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[170141183460469231731687303715884105728] = Value.new(:objval2) store[170141183460469231731687303715884105728].should == Value.new(:objval2) store.load(170141183460469231731687303715884105728).should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store[170141183460469231731687303715884105728] = Value.new(:objval2) store.key?(170141183460469231731687303715884105728).should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store(170141183460469231731687303715884105728, value).should equal(value) store[170141183460469231731687303715884105728].should == Value.new(:objval2) store.load(170141183460469231731687303715884105728).should == Value.new(:objval2) end it 'stores values after clear' do store[170141183460469231731687303715884105728] = Value.new(:objval2) store[99] = Value.new(:objval1) store.clear.should equal(store) store[170141183460469231731687303715884105728] = Value.new(:objval2) store[170141183460469231731687303715884105728].should == Value.new(:objval2) store[99].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[170141183460469231731687303715884105728] = Value.new(:objval2) store.delete(170141183460469231731687303715884105728).should == Value.new(:objval2) store.key?(170141183460469231731687303715884105728).should be_false end it 'overwrites existing values' do store[170141183460469231731687303715884105728] = Value.new(:objval2) store[170141183460469231731687303715884105728].should == Value.new(:objval2) store[170141183460469231731687303715884105728] = Value.new(:objval1) store[170141183460469231731687303715884105728].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store[170141183460469231731687303715884105728] = value).should equal(value) store[170141183460469231731687303715884105728].should == Value.new(:objval2) end it 'stores frozen keys' do key = 170141183460469231731687303715884105728.freeze store[key] = Value.new(:objval2) store[170141183460469231731687303715884105728].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store[170141183460469231731687303715884105728] = Value.new(:objval2) store.fetch(170141183460469231731687303715884105728, Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store[170141183460469231731687303715884105728] = Value.new(:objval2) unaltered = 'unaltered' store.fetch(170141183460469231731687303715884105728) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[99] = Value.new(:objval2) store[99].should == Value.new(:objval2) store.load(99).should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store[99] = Value.new(:objval2) store.key?(99).should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store(99, value).should equal(value) store[99].should == Value.new(:objval2) store.load(99).should == Value.new(:objval2) end it 'stores values after clear' do store[99] = Value.new(:objval2) store[170141183460469231731687303715884105728] = Value.new(:objval1) store.clear.should equal(store) store[99] = Value.new(:objval2) store[99].should == Value.new(:objval2) store[170141183460469231731687303715884105728].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[99] = Value.new(:objval2) store.delete(99).should == Value.new(:objval2) store.key?(99).should be_false end it 'overwrites existing values' do store[99] = Value.new(:objval2) store[99].should == Value.new(:objval2) store[99] = Value.new(:objval1) store[99].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store[99] = value).should equal(value) store[99].should == Value.new(:objval2) end it 'stores frozen keys' do key = 99.freeze store[key] = Value.new(:objval2) store[99].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store[99] = Value.new(:objval2) store.fetch(99, Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store[99] = Value.new(:objval2) unaltered = 'unaltered' store.fetch(99) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_numberkey_objectvalue #################### shared_examples_for 'returndifferent_numberkey_objectvalue' do it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store[0.5] = value store[0.5].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store[-0.3] = value store[-0.3].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store[0.5] = value store[0.5].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store[-0.3] = value store[-0.3].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store[170141183460469231731687303715884105728] = value store[170141183460469231731687303715884105728].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store[99] = value store[99].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store[170141183460469231731687303715884105728] = value store[170141183460469231731687303715884105728].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store[99] = value store[99].should_not be_equal(value) end end #################### returnsame_numberkey_objectvalue #################### shared_examples_for 'returnsame_numberkey_objectvalue' do it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store[0.5] = value store[0.5].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store[-0.3] = value store[-0.3].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store[0.5] = value store[0.5].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store[-0.3] = value store[-0.3].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store[170141183460469231731687303715884105728] = value store[170141183460469231731687303715884105728].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store[99] = value store[99].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store[170141183460469231731687303715884105728] = value store[170141183460469231731687303715884105728].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store[99] = value store[99].should be_equal(value) end end #################### persist_numberkey_objectvalue #################### shared_examples_for 'persist_numberkey_objectvalue' do it 'persists values' do store[0.5] = Value.new(:objval1) store.close @store = nil store[0.5].should == Value.new(:objval1) end it 'persists values' do store[-0.3] = Value.new(:objval1) store.close @store = nil store[-0.3].should == Value.new(:objval1) end it 'persists values' do store[0.5] = Value.new(:objval2) store.close @store = nil store[0.5].should == Value.new(:objval2) end it 'persists values' do store[-0.3] = Value.new(:objval2) store.close @store = nil store[-0.3].should == Value.new(:objval2) end it 'persists values' do store[170141183460469231731687303715884105728] = Value.new(:objval1) store.close @store = nil store[170141183460469231731687303715884105728].should == Value.new(:objval1) end it 'persists values' do store[99] = Value.new(:objval1) store.close @store = nil store[99].should == Value.new(:objval1) end it 'persists values' do store[170141183460469231731687303715884105728] = Value.new(:objval2) store.close @store = nil store[170141183460469231731687303715884105728].should == Value.new(:objval2) end it 'persists values' do store[99] = Value.new(:objval2) store.close @store = nil store[99].should == Value.new(:objval2) end end #################### null_booleankey_nilvalue #################### shared_examples_for 'null_booleankey_nilvalue' do it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = '' store[false] = nil store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, '', options).should == '' end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = '' store[true] = nil store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, '', options).should == '' end it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = nil store[false] = '' store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, nil, options).should == nil end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = nil store[true] = '' store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, nil, options).should == nil end it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = 0 store[false] = false store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, 0, options).should == 0 end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = 0 store[true] = false store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, 0, options).should == 0 end it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = false store[false] = 0 store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, false, options).should == false end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = false store[true] = 0 store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, false, options).should == false end end #################### store_booleankey_nilvalue #################### shared_examples_for 'store_booleankey_nilvalue' do it 'writes values to keys that like a Hash' do store[true] = '' store[true].should == '' store.load(true).should == '' end it 'returns true from #key? if a key is available' do store[true] = '' store.key?(true).should be_true end it 'stores values with #store' do value = '' store.store(true, value).should equal(value) store[true].should == '' store.load(true).should == '' end it 'stores values after clear' do store[true] = '' store[false] = nil store.clear.should equal(store) store[true] = '' store[true].should == '' store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = '' store.delete(true).should == '' store.key?(true).should be_false end it 'overwrites existing values' do store[true] = '' store[true].should == '' store[true] = nil store[true].should == nil end it 'stores frozen values' do value = ''.freeze (store[true] = value).should equal(value) store[true].should == '' end it 'stores frozen keys' do key = true.freeze store[key] = '' store[true].should == '' end it 'writes values to keys that like a Hash' do store[false] = '' store[false].should == '' store.load(false).should == '' end it 'returns true from #key? if a key is available' do store[false] = '' store.key?(false).should be_true end it 'stores values with #store' do value = '' store.store(false, value).should equal(value) store[false].should == '' store.load(false).should == '' end it 'stores values after clear' do store[false] = '' store[true] = nil store.clear.should equal(store) store[false] = '' store[false].should == '' store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = '' store.delete(false).should == '' store.key?(false).should be_false end it 'overwrites existing values' do store[false] = '' store[false].should == '' store[false] = nil store[false].should == nil end it 'stores frozen values' do value = ''.freeze (store[false] = value).should equal(value) store[false].should == '' end it 'stores frozen keys' do key = false.freeze store[key] = '' store[false].should == '' end it 'writes values to keys that like a Hash' do store[true] = nil store[true].should == nil store.load(true).should == nil end it 'returns true from #key? if a key is available' do store[true] = nil store.key?(true).should be_true end it 'stores values with #store' do value = nil store.store(true, value).should equal(value) store[true].should == nil store.load(true).should == nil end it 'stores values after clear' do store[true] = nil store[false] = '' store.clear.should equal(store) store[true] = nil store[true].should == nil store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = nil store.delete(true).should == nil store.key?(true).should be_false end it 'overwrites existing values' do store[true] = nil store[true].should == nil store[true] = '' store[true].should == '' end it 'stores frozen values' do value = nil.freeze (store[true] = value).should equal(value) store[true].should == nil end it 'stores frozen keys' do key = true.freeze store[key] = nil store[true].should == nil end it 'writes values to keys that like a Hash' do store[false] = nil store[false].should == nil store.load(false).should == nil end it 'returns true from #key? if a key is available' do store[false] = nil store.key?(false).should be_true end it 'stores values with #store' do value = nil store.store(false, value).should equal(value) store[false].should == nil store.load(false).should == nil end it 'stores values after clear' do store[false] = nil store[true] = '' store.clear.should equal(store) store[false] = nil store[false].should == nil store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = nil store.delete(false).should == nil store.key?(false).should be_false end it 'overwrites existing values' do store[false] = nil store[false].should == nil store[false] = '' store[false].should == '' end it 'stores frozen values' do value = nil.freeze (store[false] = value).should equal(value) store[false].should == nil end it 'stores frozen keys' do key = false.freeze store[key] = nil store[false].should == nil end it 'writes values to keys that like a Hash' do store[true] = 0 store[true].should == 0 store.load(true).should == 0 end it 'returns true from #key? if a key is available' do store[true] = 0 store.key?(true).should be_true end it 'stores values with #store' do value = 0 store.store(true, value).should equal(value) store[true].should == 0 store.load(true).should == 0 end it 'stores values after clear' do store[true] = 0 store[false] = false store.clear.should equal(store) store[true] = 0 store[true].should == 0 store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = 0 store.delete(true).should == 0 store.key?(true).should be_false end it 'overwrites existing values' do store[true] = 0 store[true].should == 0 store[true] = false store[true].should == false end it 'stores frozen values' do value = 0.freeze (store[true] = value).should equal(value) store[true].should == 0 end it 'stores frozen keys' do key = true.freeze store[key] = 0 store[true].should == 0 end it 'writes values to keys that like a Hash' do store[false] = 0 store[false].should == 0 store.load(false).should == 0 end it 'returns true from #key? if a key is available' do store[false] = 0 store.key?(false).should be_true end it 'stores values with #store' do value = 0 store.store(false, value).should equal(value) store[false].should == 0 store.load(false).should == 0 end it 'stores values after clear' do store[false] = 0 store[true] = false store.clear.should equal(store) store[false] = 0 store[false].should == 0 store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = 0 store.delete(false).should == 0 store.key?(false).should be_false end it 'overwrites existing values' do store[false] = 0 store[false].should == 0 store[false] = false store[false].should == false end it 'stores frozen values' do value = 0.freeze (store[false] = value).should equal(value) store[false].should == 0 end it 'stores frozen keys' do key = false.freeze store[key] = 0 store[false].should == 0 end it 'writes values to keys that like a Hash' do store[true] = false store[true].should == false store.load(true).should == false end it 'returns true from #key? if a key is available' do store[true] = false store.key?(true).should be_true end it 'stores values with #store' do value = false store.store(true, value).should equal(value) store[true].should == false store.load(true).should == false end it 'stores values after clear' do store[true] = false store[false] = 0 store.clear.should equal(store) store[true] = false store[true].should == false store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = false store.delete(true).should == false store.key?(true).should be_false end it 'overwrites existing values' do store[true] = false store[true].should == false store[true] = 0 store[true].should == 0 end it 'stores frozen values' do value = false.freeze (store[true] = value).should equal(value) store[true].should == false end it 'stores frozen keys' do key = true.freeze store[key] = false store[true].should == false end it 'writes values to keys that like a Hash' do store[false] = false store[false].should == false store.load(false).should == false end it 'returns true from #key? if a key is available' do store[false] = false store.key?(false).should be_true end it 'stores values with #store' do value = false store.store(false, value).should equal(value) store[false].should == false store.load(false).should == false end it 'stores values after clear' do store[false] = false store[true] = 0 store.clear.should equal(store) store[false] = false store[false].should == false store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = false store.delete(false).should == false store.key?(false).should be_false end it 'overwrites existing values' do store[false] = false store[false].should == false store[false] = 0 store[false].should == 0 end it 'stores frozen values' do value = false.freeze (store[false] = value).should equal(value) store[false].should == false end it 'stores frozen keys' do key = false.freeze store[key] = false store[false].should == false end end #################### persist_booleankey_nilvalue #################### shared_examples_for 'persist_booleankey_nilvalue' do it 'persists values' do store[true] = '' store.close @store = nil store[true].should == '' end it 'persists values' do store[false] = '' store.close @store = nil store[false].should == '' end it 'persists values' do store[true] = nil store.close @store = nil store[true].should == nil end it 'persists values' do store[false] = nil store.close @store = nil store[false].should == nil end it 'persists values' do store[true] = 0 store.close @store = nil store[true].should == 0 end it 'persists values' do store[false] = 0 store.close @store = nil store[false].should == 0 end it 'persists values' do store[true] = false store.close @store = nil store[true].should == false end it 'persists values' do store[false] = false store.close @store = nil store[false].should == false end end #################### null_booleankey_integervalue #################### shared_examples_for 'null_booleankey_integervalue' do it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = 41 store[false] = -12 store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, 41, options).should == 41 end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = 41 store[true] = -12 store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, 41, options).should == 41 end it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = -12 store[false] = 41 store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, -12, options).should == -12 end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = -12 store[true] = 41 store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, -12, options).should == -12 end end #################### store_booleankey_integervalue #################### shared_examples_for 'store_booleankey_integervalue' do it 'writes values to keys that like a Hash' do store[true] = 41 store[true].should == 41 store.load(true).should == 41 end it 'returns true from #key? if a key is available' do store[true] = 41 store.key?(true).should be_true end it 'stores values with #store' do value = 41 store.store(true, value).should equal(value) store[true].should == 41 store.load(true).should == 41 end it 'stores values after clear' do store[true] = 41 store[false] = -12 store.clear.should equal(store) store[true] = 41 store[true].should == 41 store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = 41 store.delete(true).should == 41 store.key?(true).should be_false end it 'overwrites existing values' do store[true] = 41 store[true].should == 41 store[true] = -12 store[true].should == -12 end it 'stores frozen values' do value = 41.freeze (store[true] = value).should equal(value) store[true].should == 41 end it 'stores frozen keys' do key = true.freeze store[key] = 41 store[true].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store[true] = 41 store.fetch(true, -12).should == 41 end it 'does not run the block in fetch if the key is available' do store[true] = 41 unaltered = 'unaltered' store.fetch(true) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[false] = 41 store[false].should == 41 store.load(false).should == 41 end it 'returns true from #key? if a key is available' do store[false] = 41 store.key?(false).should be_true end it 'stores values with #store' do value = 41 store.store(false, value).should equal(value) store[false].should == 41 store.load(false).should == 41 end it 'stores values after clear' do store[false] = 41 store[true] = -12 store.clear.should equal(store) store[false] = 41 store[false].should == 41 store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = 41 store.delete(false).should == 41 store.key?(false).should be_false end it 'overwrites existing values' do store[false] = 41 store[false].should == 41 store[false] = -12 store[false].should == -12 end it 'stores frozen values' do value = 41.freeze (store[false] = value).should equal(value) store[false].should == 41 end it 'stores frozen keys' do key = false.freeze store[key] = 41 store[false].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store[false] = 41 store.fetch(false, -12).should == 41 end it 'does not run the block in fetch if the key is available' do store[false] = 41 unaltered = 'unaltered' store.fetch(false) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[true] = -12 store[true].should == -12 store.load(true).should == -12 end it 'returns true from #key? if a key is available' do store[true] = -12 store.key?(true).should be_true end it 'stores values with #store' do value = -12 store.store(true, value).should equal(value) store[true].should == -12 store.load(true).should == -12 end it 'stores values after clear' do store[true] = -12 store[false] = 41 store.clear.should equal(store) store[true] = -12 store[true].should == -12 store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = -12 store.delete(true).should == -12 store.key?(true).should be_false end it 'overwrites existing values' do store[true] = -12 store[true].should == -12 store[true] = 41 store[true].should == 41 end it 'stores frozen values' do value = -12.freeze (store[true] = value).should equal(value) store[true].should == -12 end it 'stores frozen keys' do key = true.freeze store[key] = -12 store[true].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store[true] = -12 store.fetch(true, 41).should == -12 end it 'does not run the block in fetch if the key is available' do store[true] = -12 unaltered = 'unaltered' store.fetch(true) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[false] = -12 store[false].should == -12 store.load(false).should == -12 end it 'returns true from #key? if a key is available' do store[false] = -12 store.key?(false).should be_true end it 'stores values with #store' do value = -12 store.store(false, value).should equal(value) store[false].should == -12 store.load(false).should == -12 end it 'stores values after clear' do store[false] = -12 store[true] = 41 store.clear.should equal(store) store[false] = -12 store[false].should == -12 store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = -12 store.delete(false).should == -12 store.key?(false).should be_false end it 'overwrites existing values' do store[false] = -12 store[false].should == -12 store[false] = 41 store[false].should == 41 end it 'stores frozen values' do value = -12.freeze (store[false] = value).should equal(value) store[false].should == -12 end it 'stores frozen keys' do key = false.freeze store[key] = -12 store[false].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store[false] = -12 store.fetch(false, 41).should == -12 end it 'does not run the block in fetch if the key is available' do store[false] = -12 unaltered = 'unaltered' store.fetch(false) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_booleankey_integervalue #################### shared_examples_for 'persist_booleankey_integervalue' do it 'persists values' do store[true] = 41 store.close @store = nil store[true].should == 41 end it 'persists values' do store[false] = 41 store.close @store = nil store[false].should == 41 end it 'persists values' do store[true] = -12 store.close @store = nil store[true].should == -12 end it 'persists values' do store[false] = -12 store.close @store = nil store[false].should == -12 end end #################### null_booleankey_numbervalue #################### shared_examples_for 'null_booleankey_numbervalue' do it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = 123.456 store[false] = -98.7 store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = 123.456 store[true] = -98.7 store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = -98.7 store[false] = 123.456 store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = -98.7 store[true] = 123.456 store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = 340282366920938463463374607431768211456 store[false] = 33 store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = 340282366920938463463374607431768211456 store[true] = 33 store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = 33 store[false] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, 33, options).should == 33 end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = 33 store[true] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, 33, options).should == 33 end end #################### store_booleankey_numbervalue #################### shared_examples_for 'store_booleankey_numbervalue' do it 'writes values to keys that like a Hash' do store[true] = 123.456 store[true].should == 123.456 store.load(true).should == 123.456 end it 'returns true from #key? if a key is available' do store[true] = 123.456 store.key?(true).should be_true end it 'stores values with #store' do value = 123.456 store.store(true, value).should equal(value) store[true].should == 123.456 store.load(true).should == 123.456 end it 'stores values after clear' do store[true] = 123.456 store[false] = -98.7 store.clear.should equal(store) store[true] = 123.456 store[true].should == 123.456 store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = 123.456 store.delete(true).should == 123.456 store.key?(true).should be_false end it 'overwrites existing values' do store[true] = 123.456 store[true].should == 123.456 store[true] = -98.7 store[true].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store[true] = value).should equal(value) store[true].should == 123.456 end it 'stores frozen keys' do key = true.freeze store[key] = 123.456 store[true].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store[true] = 123.456 store.fetch(true, -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store[true] = 123.456 unaltered = 'unaltered' store.fetch(true) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[false] = 123.456 store[false].should == 123.456 store.load(false).should == 123.456 end it 'returns true from #key? if a key is available' do store[false] = 123.456 store.key?(false).should be_true end it 'stores values with #store' do value = 123.456 store.store(false, value).should equal(value) store[false].should == 123.456 store.load(false).should == 123.456 end it 'stores values after clear' do store[false] = 123.456 store[true] = -98.7 store.clear.should equal(store) store[false] = 123.456 store[false].should == 123.456 store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = 123.456 store.delete(false).should == 123.456 store.key?(false).should be_false end it 'overwrites existing values' do store[false] = 123.456 store[false].should == 123.456 store[false] = -98.7 store[false].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store[false] = value).should equal(value) store[false].should == 123.456 end it 'stores frozen keys' do key = false.freeze store[key] = 123.456 store[false].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store[false] = 123.456 store.fetch(false, -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store[false] = 123.456 unaltered = 'unaltered' store.fetch(false) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[true] = -98.7 store[true].should == -98.7 store.load(true).should == -98.7 end it 'returns true from #key? if a key is available' do store[true] = -98.7 store.key?(true).should be_true end it 'stores values with #store' do value = -98.7 store.store(true, value).should equal(value) store[true].should == -98.7 store.load(true).should == -98.7 end it 'stores values after clear' do store[true] = -98.7 store[false] = 123.456 store.clear.should equal(store) store[true] = -98.7 store[true].should == -98.7 store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = -98.7 store.delete(true).should == -98.7 store.key?(true).should be_false end it 'overwrites existing values' do store[true] = -98.7 store[true].should == -98.7 store[true] = 123.456 store[true].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store[true] = value).should equal(value) store[true].should == -98.7 end it 'stores frozen keys' do key = true.freeze store[key] = -98.7 store[true].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store[true] = -98.7 store.fetch(true, 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store[true] = -98.7 unaltered = 'unaltered' store.fetch(true) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[false] = -98.7 store[false].should == -98.7 store.load(false).should == -98.7 end it 'returns true from #key? if a key is available' do store[false] = -98.7 store.key?(false).should be_true end it 'stores values with #store' do value = -98.7 store.store(false, value).should equal(value) store[false].should == -98.7 store.load(false).should == -98.7 end it 'stores values after clear' do store[false] = -98.7 store[true] = 123.456 store.clear.should equal(store) store[false] = -98.7 store[false].should == -98.7 store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = -98.7 store.delete(false).should == -98.7 store.key?(false).should be_false end it 'overwrites existing values' do store[false] = -98.7 store[false].should == -98.7 store[false] = 123.456 store[false].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store[false] = value).should equal(value) store[false].should == -98.7 end it 'stores frozen keys' do key = false.freeze store[key] = -98.7 store[false].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store[false] = -98.7 store.fetch(false, 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store[false] = -98.7 unaltered = 'unaltered' store.fetch(false) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[true] = 340282366920938463463374607431768211456 store[true].should == 340282366920938463463374607431768211456 store.load(true).should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store[true] = 340282366920938463463374607431768211456 store.key?(true).should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store(true, value).should equal(value) store[true].should == 340282366920938463463374607431768211456 store.load(true).should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store[true] = 340282366920938463463374607431768211456 store[false] = 33 store.clear.should equal(store) store[true] = 340282366920938463463374607431768211456 store[true].should == 340282366920938463463374607431768211456 store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = 340282366920938463463374607431768211456 store.delete(true).should == 340282366920938463463374607431768211456 store.key?(true).should be_false end it 'overwrites existing values' do store[true] = 340282366920938463463374607431768211456 store[true].should == 340282366920938463463374607431768211456 store[true] = 33 store[true].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store[true] = value).should equal(value) store[true].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = true.freeze store[key] = 340282366920938463463374607431768211456 store[true].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store[true] = 340282366920938463463374607431768211456 store.fetch(true, 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store[true] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch(true) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[false] = 340282366920938463463374607431768211456 store[false].should == 340282366920938463463374607431768211456 store.load(false).should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store[false] = 340282366920938463463374607431768211456 store.key?(false).should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store(false, value).should equal(value) store[false].should == 340282366920938463463374607431768211456 store.load(false).should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store[false] = 340282366920938463463374607431768211456 store[true] = 33 store.clear.should equal(store) store[false] = 340282366920938463463374607431768211456 store[false].should == 340282366920938463463374607431768211456 store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = 340282366920938463463374607431768211456 store.delete(false).should == 340282366920938463463374607431768211456 store.key?(false).should be_false end it 'overwrites existing values' do store[false] = 340282366920938463463374607431768211456 store[false].should == 340282366920938463463374607431768211456 store[false] = 33 store[false].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store[false] = value).should equal(value) store[false].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = false.freeze store[key] = 340282366920938463463374607431768211456 store[false].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store[false] = 340282366920938463463374607431768211456 store.fetch(false, 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store[false] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch(false) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[true] = 33 store[true].should == 33 store.load(true).should == 33 end it 'returns true from #key? if a key is available' do store[true] = 33 store.key?(true).should be_true end it 'stores values with #store' do value = 33 store.store(true, value).should equal(value) store[true].should == 33 store.load(true).should == 33 end it 'stores values after clear' do store[true] = 33 store[false] = 340282366920938463463374607431768211456 store.clear.should equal(store) store[true] = 33 store[true].should == 33 store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = 33 store.delete(true).should == 33 store.key?(true).should be_false end it 'overwrites existing values' do store[true] = 33 store[true].should == 33 store[true] = 340282366920938463463374607431768211456 store[true].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store[true] = value).should equal(value) store[true].should == 33 end it 'stores frozen keys' do key = true.freeze store[key] = 33 store[true].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store[true] = 33 store.fetch(true, 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store[true] = 33 unaltered = 'unaltered' store.fetch(true) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[false] = 33 store[false].should == 33 store.load(false).should == 33 end it 'returns true from #key? if a key is available' do store[false] = 33 store.key?(false).should be_true end it 'stores values with #store' do value = 33 store.store(false, value).should equal(value) store[false].should == 33 store.load(false).should == 33 end it 'stores values after clear' do store[false] = 33 store[true] = 340282366920938463463374607431768211456 store.clear.should equal(store) store[false] = 33 store[false].should == 33 store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = 33 store.delete(false).should == 33 store.key?(false).should be_false end it 'overwrites existing values' do store[false] = 33 store[false].should == 33 store[false] = 340282366920938463463374607431768211456 store[false].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store[false] = value).should equal(value) store[false].should == 33 end it 'stores frozen keys' do key = false.freeze store[key] = 33 store[false].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store[false] = 33 store.fetch(false, 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store[false] = 33 unaltered = 'unaltered' store.fetch(false) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_booleankey_numbervalue #################### shared_examples_for 'persist_booleankey_numbervalue' do it 'persists values' do store[true] = 123.456 store.close @store = nil store[true].should == 123.456 end it 'persists values' do store[false] = 123.456 store.close @store = nil store[false].should == 123.456 end it 'persists values' do store[true] = -98.7 store.close @store = nil store[true].should == -98.7 end it 'persists values' do store[false] = -98.7 store.close @store = nil store[false].should == -98.7 end it 'persists values' do store[true] = 340282366920938463463374607431768211456 store.close @store = nil store[true].should == 340282366920938463463374607431768211456 end it 'persists values' do store[false] = 340282366920938463463374607431768211456 store.close @store = nil store[false].should == 340282366920938463463374607431768211456 end it 'persists values' do store[true] = 33 store.close @store = nil store[true].should == 33 end it 'persists values' do store[false] = 33 store.close @store = nil store[false].should == 33 end end #################### null_booleankey_booleanvalue #################### shared_examples_for 'null_booleankey_booleanvalue' do it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = true store[false] = false store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, true, options).should == true end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = true store[true] = false store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, true, options).should == true end it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = false store[false] = true store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, false, options).should == false end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = false store[true] = true store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, false, options).should == false end end #################### store_booleankey_booleanvalue #################### shared_examples_for 'store_booleankey_booleanvalue' do it 'writes values to keys that like a Hash' do store[true] = true store[true].should == true store.load(true).should == true end it 'returns true from #key? if a key is available' do store[true] = true store.key?(true).should be_true end it 'stores values with #store' do value = true store.store(true, value).should equal(value) store[true].should == true store.load(true).should == true end it 'stores values after clear' do store[true] = true store[false] = false store.clear.should equal(store) store[true] = true store[true].should == true store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = true store.delete(true).should == true store.key?(true).should be_false end it 'overwrites existing values' do store[true] = true store[true].should == true store[true] = false store[true].should == false end it 'stores frozen values' do value = true.freeze (store[true] = value).should equal(value) store[true].should == true end it 'stores frozen keys' do key = true.freeze store[key] = true store[true].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store[true] = true store.fetch(true, false).should == true end it 'does not run the block in fetch if the key is available' do store[true] = true unaltered = 'unaltered' store.fetch(true) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[false] = true store[false].should == true store.load(false).should == true end it 'returns true from #key? if a key is available' do store[false] = true store.key?(false).should be_true end it 'stores values with #store' do value = true store.store(false, value).should equal(value) store[false].should == true store.load(false).should == true end it 'stores values after clear' do store[false] = true store[true] = false store.clear.should equal(store) store[false] = true store[false].should == true store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = true store.delete(false).should == true store.key?(false).should be_false end it 'overwrites existing values' do store[false] = true store[false].should == true store[false] = false store[false].should == false end it 'stores frozen values' do value = true.freeze (store[false] = value).should equal(value) store[false].should == true end it 'stores frozen keys' do key = false.freeze store[key] = true store[false].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store[false] = true store.fetch(false, false).should == true end it 'does not run the block in fetch if the key is available' do store[false] = true unaltered = 'unaltered' store.fetch(false) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[true] = false store[true].should == false store.load(true).should == false end it 'returns true from #key? if a key is available' do store[true] = false store.key?(true).should be_true end it 'stores values with #store' do value = false store.store(true, value).should equal(value) store[true].should == false store.load(true).should == false end it 'stores values after clear' do store[true] = false store[false] = true store.clear.should equal(store) store[true] = false store[true].should == false store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = false store.delete(true).should == false store.key?(true).should be_false end it 'overwrites existing values' do store[true] = false store[true].should == false store[true] = true store[true].should == true end it 'stores frozen values' do value = false.freeze (store[true] = value).should equal(value) store[true].should == false end it 'stores frozen keys' do key = true.freeze store[key] = false store[true].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store[true] = false store.fetch(true, true).should == false end it 'does not run the block in fetch if the key is available' do store[true] = false unaltered = 'unaltered' store.fetch(true) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[false] = false store[false].should == false store.load(false).should == false end it 'returns true from #key? if a key is available' do store[false] = false store.key?(false).should be_true end it 'stores values with #store' do value = false store.store(false, value).should equal(value) store[false].should == false store.load(false).should == false end it 'stores values after clear' do store[false] = false store[true] = true store.clear.should equal(store) store[false] = false store[false].should == false store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = false store.delete(false).should == false store.key?(false).should be_false end it 'overwrites existing values' do store[false] = false store[false].should == false store[false] = true store[false].should == true end it 'stores frozen values' do value = false.freeze (store[false] = value).should equal(value) store[false].should == false end it 'stores frozen keys' do key = false.freeze store[key] = false store[false].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store[false] = false store.fetch(false, true).should == false end it 'does not run the block in fetch if the key is available' do store[false] = false unaltered = 'unaltered' store.fetch(false) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_booleankey_booleanvalue #################### shared_examples_for 'persist_booleankey_booleanvalue' do it 'persists values' do store[true] = true store.close @store = nil store[true].should == true end it 'persists values' do store[false] = true store.close @store = nil store[false].should == true end it 'persists values' do store[true] = false store.close @store = nil store[true].should == false end it 'persists values' do store[false] = false store.close @store = nil store[false].should == false end end #################### null_booleankey_stringvalue #################### shared_examples_for 'null_booleankey_stringvalue' do it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = "strval1" store[false] = "strval2" store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = "strval1" store[true] = "strval2" store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = "strval2" store[false] = "strval1" store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, "strval2", options).should == "strval2" end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = "strval2" store[true] = "strval1" store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, "strval2", options).should == "strval2" end end #################### store_booleankey_stringvalue #################### shared_examples_for 'store_booleankey_stringvalue' do it 'writes values to keys that like a Hash' do store[true] = "strval1" store[true].should == "strval1" store.load(true).should == "strval1" end it 'returns true from #key? if a key is available' do store[true] = "strval1" store.key?(true).should be_true end it 'stores values with #store' do value = "strval1" store.store(true, value).should equal(value) store[true].should == "strval1" store.load(true).should == "strval1" end it 'stores values after clear' do store[true] = "strval1" store[false] = "strval2" store.clear.should equal(store) store[true] = "strval1" store[true].should == "strval1" store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = "strval1" store.delete(true).should == "strval1" store.key?(true).should be_false end it 'overwrites existing values' do store[true] = "strval1" store[true].should == "strval1" store[true] = "strval2" store[true].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store[true] = value).should equal(value) store[true].should == "strval1" end it 'stores frozen keys' do key = true.freeze store[key] = "strval1" store[true].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store[true] = "strval1" store.fetch(true, "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store[true] = "strval1" unaltered = 'unaltered' store.fetch(true) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[false] = "strval1" store[false].should == "strval1" store.load(false).should == "strval1" end it 'returns true from #key? if a key is available' do store[false] = "strval1" store.key?(false).should be_true end it 'stores values with #store' do value = "strval1" store.store(false, value).should equal(value) store[false].should == "strval1" store.load(false).should == "strval1" end it 'stores values after clear' do store[false] = "strval1" store[true] = "strval2" store.clear.should equal(store) store[false] = "strval1" store[false].should == "strval1" store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = "strval1" store.delete(false).should == "strval1" store.key?(false).should be_false end it 'overwrites existing values' do store[false] = "strval1" store[false].should == "strval1" store[false] = "strval2" store[false].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store[false] = value).should equal(value) store[false].should == "strval1" end it 'stores frozen keys' do key = false.freeze store[key] = "strval1" store[false].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store[false] = "strval1" store.fetch(false, "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store[false] = "strval1" unaltered = 'unaltered' store.fetch(false) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[true] = "strval2" store[true].should == "strval2" store.load(true).should == "strval2" end it 'returns true from #key? if a key is available' do store[true] = "strval2" store.key?(true).should be_true end it 'stores values with #store' do value = "strval2" store.store(true, value).should equal(value) store[true].should == "strval2" store.load(true).should == "strval2" end it 'stores values after clear' do store[true] = "strval2" store[false] = "strval1" store.clear.should equal(store) store[true] = "strval2" store[true].should == "strval2" store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = "strval2" store.delete(true).should == "strval2" store.key?(true).should be_false end it 'overwrites existing values' do store[true] = "strval2" store[true].should == "strval2" store[true] = "strval1" store[true].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store[true] = value).should equal(value) store[true].should == "strval2" end it 'stores frozen keys' do key = true.freeze store[key] = "strval2" store[true].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store[true] = "strval2" store.fetch(true, "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store[true] = "strval2" unaltered = 'unaltered' store.fetch(true) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[false] = "strval2" store[false].should == "strval2" store.load(false).should == "strval2" end it 'returns true from #key? if a key is available' do store[false] = "strval2" store.key?(false).should be_true end it 'stores values with #store' do value = "strval2" store.store(false, value).should equal(value) store[false].should == "strval2" store.load(false).should == "strval2" end it 'stores values after clear' do store[false] = "strval2" store[true] = "strval1" store.clear.should equal(store) store[false] = "strval2" store[false].should == "strval2" store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = "strval2" store.delete(false).should == "strval2" store.key?(false).should be_false end it 'overwrites existing values' do store[false] = "strval2" store[false].should == "strval2" store[false] = "strval1" store[false].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store[false] = value).should equal(value) store[false].should == "strval2" end it 'stores frozen keys' do key = false.freeze store[key] = "strval2" store[false].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store[false] = "strval2" store.fetch(false, "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store[false] = "strval2" unaltered = 'unaltered' store.fetch(false) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_booleankey_stringvalue #################### shared_examples_for 'returndifferent_booleankey_stringvalue' do it 'guarantees that a different value is retrieved' do value = "strval1" store[true] = value store[true].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval1" store[false] = value store[false].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store[true] = value store[true].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store[false] = value store[false].should_not be_equal(value) end end #################### returnsame_booleankey_stringvalue #################### shared_examples_for 'returnsame_booleankey_stringvalue' do it 'guarantees that the same value is retrieved' do value = "strval1" store[true] = value store[true].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval1" store[false] = value store[false].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store[true] = value store[true].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store[false] = value store[false].should be_equal(value) end end #################### persist_booleankey_stringvalue #################### shared_examples_for 'persist_booleankey_stringvalue' do it 'persists values' do store[true] = "strval1" store.close @store = nil store[true].should == "strval1" end it 'persists values' do store[false] = "strval1" store.close @store = nil store[false].should == "strval1" end it 'persists values' do store[true] = "strval2" store.close @store = nil store[true].should == "strval2" end it 'persists values' do store[false] = "strval2" store.close @store = nil store[false].should == "strval2" end end #################### null_booleankey_binaryvalue #################### shared_examples_for 'null_booleankey_binaryvalue' do it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = "über" store[false] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, "über", options).should == "über" end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = "über" store[true] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, "über", options).should == "über" end it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = "\xAA\xBB\xCC" store[false] = "über" store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = "\xAA\xBB\xCC" store[true] = "über" store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end end #################### store_booleankey_binaryvalue #################### shared_examples_for 'store_booleankey_binaryvalue' do it 'writes values to keys that like a Hash' do store[true] = "über" store[true].should == "über" store.load(true).should == "über" end it 'returns true from #key? if a key is available' do store[true] = "über" store.key?(true).should be_true end it 'stores values with #store' do value = "über" store.store(true, value).should equal(value) store[true].should == "über" store.load(true).should == "über" end it 'stores values after clear' do store[true] = "über" store[false] = "\xAA\xBB\xCC" store.clear.should equal(store) store[true] = "über" store[true].should == "über" store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = "über" store.delete(true).should == "über" store.key?(true).should be_false end it 'overwrites existing values' do store[true] = "über" store[true].should == "über" store[true] = "\xAA\xBB\xCC" store[true].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store[true] = value).should equal(value) store[true].should == "über" end it 'stores frozen keys' do key = true.freeze store[key] = "über" store[true].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store[true] = "über" store.fetch(true, "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store[true] = "über" unaltered = 'unaltered' store.fetch(true) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[false] = "über" store[false].should == "über" store.load(false).should == "über" end it 'returns true from #key? if a key is available' do store[false] = "über" store.key?(false).should be_true end it 'stores values with #store' do value = "über" store.store(false, value).should equal(value) store[false].should == "über" store.load(false).should == "über" end it 'stores values after clear' do store[false] = "über" store[true] = "\xAA\xBB\xCC" store.clear.should equal(store) store[false] = "über" store[false].should == "über" store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = "über" store.delete(false).should == "über" store.key?(false).should be_false end it 'overwrites existing values' do store[false] = "über" store[false].should == "über" store[false] = "\xAA\xBB\xCC" store[false].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store[false] = value).should equal(value) store[false].should == "über" end it 'stores frozen keys' do key = false.freeze store[key] = "über" store[false].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store[false] = "über" store.fetch(false, "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store[false] = "über" unaltered = 'unaltered' store.fetch(false) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[true] = "\xAA\xBB\xCC" store[true].should == "\xAA\xBB\xCC" store.load(true).should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store[true] = "\xAA\xBB\xCC" store.key?(true).should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store(true, value).should equal(value) store[true].should == "\xAA\xBB\xCC" store.load(true).should == "\xAA\xBB\xCC" end it 'stores values after clear' do store[true] = "\xAA\xBB\xCC" store[false] = "über" store.clear.should equal(store) store[true] = "\xAA\xBB\xCC" store[true].should == "\xAA\xBB\xCC" store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = "\xAA\xBB\xCC" store.delete(true).should == "\xAA\xBB\xCC" store.key?(true).should be_false end it 'overwrites existing values' do store[true] = "\xAA\xBB\xCC" store[true].should == "\xAA\xBB\xCC" store[true] = "über" store[true].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store[true] = value).should equal(value) store[true].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = true.freeze store[key] = "\xAA\xBB\xCC" store[true].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store[true] = "\xAA\xBB\xCC" store.fetch(true, "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store[true] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch(true) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[false] = "\xAA\xBB\xCC" store[false].should == "\xAA\xBB\xCC" store.load(false).should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store[false] = "\xAA\xBB\xCC" store.key?(false).should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store(false, value).should equal(value) store[false].should == "\xAA\xBB\xCC" store.load(false).should == "\xAA\xBB\xCC" end it 'stores values after clear' do store[false] = "\xAA\xBB\xCC" store[true] = "über" store.clear.should equal(store) store[false] = "\xAA\xBB\xCC" store[false].should == "\xAA\xBB\xCC" store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = "\xAA\xBB\xCC" store.delete(false).should == "\xAA\xBB\xCC" store.key?(false).should be_false end it 'overwrites existing values' do store[false] = "\xAA\xBB\xCC" store[false].should == "\xAA\xBB\xCC" store[false] = "über" store[false].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store[false] = value).should equal(value) store[false].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = false.freeze store[key] = "\xAA\xBB\xCC" store[false].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store[false] = "\xAA\xBB\xCC" store.fetch(false, "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store[false] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch(false) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_booleankey_binaryvalue #################### shared_examples_for 'returndifferent_booleankey_binaryvalue' do it 'guarantees that a different value is retrieved' do value = "über" store[true] = value store[true].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "über" store[false] = value store[false].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store[true] = value store[true].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store[false] = value store[false].should_not be_equal(value) end end #################### returnsame_booleankey_binaryvalue #################### shared_examples_for 'returnsame_booleankey_binaryvalue' do it 'guarantees that the same value is retrieved' do value = "über" store[true] = value store[true].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "über" store[false] = value store[false].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store[true] = value store[true].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store[false] = value store[false].should be_equal(value) end end #################### persist_booleankey_binaryvalue #################### shared_examples_for 'persist_booleankey_binaryvalue' do it 'persists values' do store[true] = "über" store.close @store = nil store[true].should == "über" end it 'persists values' do store[false] = "über" store.close @store = nil store[false].should == "über" end it 'persists values' do store[true] = "\xAA\xBB\xCC" store.close @store = nil store[true].should == "\xAA\xBB\xCC" end it 'persists values' do store[false] = "\xAA\xBB\xCC" store.close @store = nil store[false].should == "\xAA\xBB\xCC" end end #################### null_booleankey_hashvalue #################### shared_examples_for 'null_booleankey_hashvalue' do it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = {"hashval1"=>["array1", 1]} store[false] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = {"hashval1"=>["array1", 1]} store[true] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[false] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[true] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### store_booleankey_hashvalue #################### shared_examples_for 'store_booleankey_hashvalue' do it 'writes values to keys that like a Hash' do store[true] = {"hashval1"=>["array1", 1]} store[true].should == {"hashval1"=>["array1", 1]} store.load(true).should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store[true] = {"hashval1"=>["array1", 1]} store.key?(true).should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store(true, value).should equal(value) store[true].should == {"hashval1"=>["array1", 1]} store.load(true).should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store[true] = {"hashval1"=>["array1", 1]} store[false] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store[true] = {"hashval1"=>["array1", 1]} store[true].should == {"hashval1"=>["array1", 1]} store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = {"hashval1"=>["array1", 1]} store.delete(true).should == {"hashval1"=>["array1", 1]} store.key?(true).should be_false end it 'overwrites existing values' do store[true] = {"hashval1"=>["array1", 1]} store[true].should == {"hashval1"=>["array1", 1]} store[true] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[true].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store[true] = value).should equal(value) store[true].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = true.freeze store[key] = {"hashval1"=>["array1", 1]} store[true].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store[true] = {"hashval1"=>["array1", 1]} store.fetch(true, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store[true] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch(true) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[false] = {"hashval1"=>["array1", 1]} store[false].should == {"hashval1"=>["array1", 1]} store.load(false).should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store[false] = {"hashval1"=>["array1", 1]} store.key?(false).should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store(false, value).should equal(value) store[false].should == {"hashval1"=>["array1", 1]} store.load(false).should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store[false] = {"hashval1"=>["array1", 1]} store[true] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store[false] = {"hashval1"=>["array1", 1]} store[false].should == {"hashval1"=>["array1", 1]} store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = {"hashval1"=>["array1", 1]} store.delete(false).should == {"hashval1"=>["array1", 1]} store.key?(false).should be_false end it 'overwrites existing values' do store[false] = {"hashval1"=>["array1", 1]} store[false].should == {"hashval1"=>["array1", 1]} store[false] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[false].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store[false] = value).should equal(value) store[false].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = false.freeze store[key] = {"hashval1"=>["array1", 1]} store[false].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store[false] = {"hashval1"=>["array1", 1]} store.fetch(false, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store[false] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch(false) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[true] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[true].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(true).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store[true] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(true).should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store(true, value).should equal(value) store[true].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(true).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store[true] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[false] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store[true] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[true].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete(true).should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(true).should be_false end it 'overwrites existing values' do store[true] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[true].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[true] = {"hashval1"=>["array1", 1]} store[true].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store[true] = value).should equal(value) store[true].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = true.freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[true].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store[true] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(true, {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store[true] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch(true) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[false] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[false].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(false).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store[false] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(false).should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store(false, value).should equal(value) store[false].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(false).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store[false] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[true] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store[false] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[false].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete(false).should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(false).should be_false end it 'overwrites existing values' do store[false] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[false].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[false] = {"hashval1"=>["array1", 1]} store[false].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store[false] = value).should equal(value) store[false].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = false.freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[false].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store[false] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(false, {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store[false] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch(false) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_booleankey_hashvalue #################### shared_examples_for 'returndifferent_booleankey_hashvalue' do it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store[true] = value store[true].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store[false] = value store[false].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[true] = value store[true].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[false] = value store[false].should_not be_equal(value) end end #################### returnsame_booleankey_hashvalue #################### shared_examples_for 'returnsame_booleankey_hashvalue' do it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store[true] = value store[true].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store[false] = value store[false].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[true] = value store[true].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[false] = value store[false].should be_equal(value) end end #################### persist_booleankey_hashvalue #################### shared_examples_for 'persist_booleankey_hashvalue' do it 'persists values' do store[true] = {"hashval1"=>["array1", 1]} store.close @store = nil store[true].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store[false] = {"hashval1"=>["array1", 1]} store.close @store = nil store[false].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store[true] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store[true].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'persists values' do store[false] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store[false].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### null_booleankey_objectvalue #################### shared_examples_for 'null_booleankey_objectvalue' do it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = Value.new(:objval1) store[false] = Value.new(:objval2) store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = Value.new(:objval1) store[true] = Value.new(:objval2) store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store[true].should be_nil store.load(true).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store[true] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(true).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(true).should be_nil end it 'removes all keys from the store with clear' do store[true] = Value.new(:objval2) store[false] = Value.new(:objval1) store.clear.should equal(store) store.key?(true).should be_false store.key?(false).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(true, Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = true value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(true, options).should be_false store.load(true, options).should be_nil store.fetch(true, 42, options).should == 42 store.fetch(true, options) { 42 }.should == 42 store.delete(true, options).should be_nil store.clear(options).should equal(store) store.store(true, Value.new(:objval2), options).should == Value.new(:objval2) end it 'reads from keys like a Hash' do store[false].should be_nil store.load(false).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store[false] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(false).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(false).should be_nil end it 'removes all keys from the store with clear' do store[false] = Value.new(:objval2) store[true] = Value.new(:objval1) store.clear.should equal(store) store.key?(false).should be_false store.key?(true).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(false, Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = false value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(false, options).should be_false store.load(false, options).should be_nil store.fetch(false, 42, options).should == 42 store.fetch(false, options) { 42 }.should == 42 store.delete(false, options).should be_nil store.clear(options).should equal(store) store.store(false, Value.new(:objval2), options).should == Value.new(:objval2) end end #################### store_booleankey_objectvalue #################### shared_examples_for 'store_booleankey_objectvalue' do it 'writes values to keys that like a Hash' do store[true] = Value.new(:objval1) store[true].should == Value.new(:objval1) store.load(true).should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store[true] = Value.new(:objval1) store.key?(true).should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store(true, value).should equal(value) store[true].should == Value.new(:objval1) store.load(true).should == Value.new(:objval1) end it 'stores values after clear' do store[true] = Value.new(:objval1) store[false] = Value.new(:objval2) store.clear.should equal(store) store[true] = Value.new(:objval1) store[true].should == Value.new(:objval1) store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = Value.new(:objval1) store.delete(true).should == Value.new(:objval1) store.key?(true).should be_false end it 'overwrites existing values' do store[true] = Value.new(:objval1) store[true].should == Value.new(:objval1) store[true] = Value.new(:objval2) store[true].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store[true] = value).should equal(value) store[true].should == Value.new(:objval1) end it 'stores frozen keys' do key = true.freeze store[key] = Value.new(:objval1) store[true].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store[true] = Value.new(:objval1) store.fetch(true, Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store[true] = Value.new(:objval1) unaltered = 'unaltered' store.fetch(true) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[false] = Value.new(:objval1) store[false].should == Value.new(:objval1) store.load(false).should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store[false] = Value.new(:objval1) store.key?(false).should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store(false, value).should equal(value) store[false].should == Value.new(:objval1) store.load(false).should == Value.new(:objval1) end it 'stores values after clear' do store[false] = Value.new(:objval1) store[true] = Value.new(:objval2) store.clear.should equal(store) store[false] = Value.new(:objval1) store[false].should == Value.new(:objval1) store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = Value.new(:objval1) store.delete(false).should == Value.new(:objval1) store.key?(false).should be_false end it 'overwrites existing values' do store[false] = Value.new(:objval1) store[false].should == Value.new(:objval1) store[false] = Value.new(:objval2) store[false].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store[false] = value).should equal(value) store[false].should == Value.new(:objval1) end it 'stores frozen keys' do key = false.freeze store[key] = Value.new(:objval1) store[false].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store[false] = Value.new(:objval1) store.fetch(false, Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store[false] = Value.new(:objval1) unaltered = 'unaltered' store.fetch(false) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[true] = Value.new(:objval2) store[true].should == Value.new(:objval2) store.load(true).should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store[true] = Value.new(:objval2) store.key?(true).should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store(true, value).should equal(value) store[true].should == Value.new(:objval2) store.load(true).should == Value.new(:objval2) end it 'stores values after clear' do store[true] = Value.new(:objval2) store[false] = Value.new(:objval1) store.clear.should equal(store) store[true] = Value.new(:objval2) store[true].should == Value.new(:objval2) store[false].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[true] = Value.new(:objval2) store.delete(true).should == Value.new(:objval2) store.key?(true).should be_false end it 'overwrites existing values' do store[true] = Value.new(:objval2) store[true].should == Value.new(:objval2) store[true] = Value.new(:objval1) store[true].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store[true] = value).should equal(value) store[true].should == Value.new(:objval2) end it 'stores frozen keys' do key = true.freeze store[key] = Value.new(:objval2) store[true].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store[true] = Value.new(:objval2) store.fetch(true, Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store[true] = Value.new(:objval2) unaltered = 'unaltered' store.fetch(true) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[false] = Value.new(:objval2) store[false].should == Value.new(:objval2) store.load(false).should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store[false] = Value.new(:objval2) store.key?(false).should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store(false, value).should equal(value) store[false].should == Value.new(:objval2) store.load(false).should == Value.new(:objval2) end it 'stores values after clear' do store[false] = Value.new(:objval2) store[true] = Value.new(:objval1) store.clear.should equal(store) store[false] = Value.new(:objval2) store[false].should == Value.new(:objval2) store[true].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[false] = Value.new(:objval2) store.delete(false).should == Value.new(:objval2) store.key?(false).should be_false end it 'overwrites existing values' do store[false] = Value.new(:objval2) store[false].should == Value.new(:objval2) store[false] = Value.new(:objval1) store[false].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store[false] = value).should equal(value) store[false].should == Value.new(:objval2) end it 'stores frozen keys' do key = false.freeze store[key] = Value.new(:objval2) store[false].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store[false] = Value.new(:objval2) store.fetch(false, Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store[false] = Value.new(:objval2) unaltered = 'unaltered' store.fetch(false) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_booleankey_objectvalue #################### shared_examples_for 'returndifferent_booleankey_objectvalue' do it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store[true] = value store[true].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store[false] = value store[false].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store[true] = value store[true].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store[false] = value store[false].should_not be_equal(value) end end #################### returnsame_booleankey_objectvalue #################### shared_examples_for 'returnsame_booleankey_objectvalue' do it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store[true] = value store[true].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store[false] = value store[false].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store[true] = value store[true].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store[false] = value store[false].should be_equal(value) end end #################### persist_booleankey_objectvalue #################### shared_examples_for 'persist_booleankey_objectvalue' do it 'persists values' do store[true] = Value.new(:objval1) store.close @store = nil store[true].should == Value.new(:objval1) end it 'persists values' do store[false] = Value.new(:objval1) store.close @store = nil store[false].should == Value.new(:objval1) end it 'persists values' do store[true] = Value.new(:objval2) store.close @store = nil store[true].should == Value.new(:objval2) end it 'persists values' do store[false] = Value.new(:objval2) store.close @store = nil store[false].should == Value.new(:objval2) end end #################### null_stringkey_nilvalue #################### shared_examples_for 'null_stringkey_nilvalue' do it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = '' store["strkey2"] = nil store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", '', options).should == '' end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = '' store["strkey1"] = nil store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", '', options).should == '' end it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = nil store["strkey2"] = '' store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", nil, options).should == nil end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = nil store["strkey1"] = '' store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", nil, options).should == nil end it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = 0 store["strkey2"] = false store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", 0, options).should == 0 end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = 0 store["strkey1"] = false store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", 0, options).should == 0 end it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = false store["strkey2"] = 0 store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", false, options).should == false end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = false store["strkey1"] = 0 store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", false, options).should == false end end #################### store_stringkey_nilvalue #################### shared_examples_for 'store_stringkey_nilvalue' do it 'writes values to keys that like a Hash' do store["strkey1"] = '' store["strkey1"].should == '' store.load("strkey1").should == '' end it 'returns true from #key? if a key is available' do store["strkey1"] = '' store.key?("strkey1").should be_true end it 'stores values with #store' do value = '' store.store("strkey1", value).should equal(value) store["strkey1"].should == '' store.load("strkey1").should == '' end it 'stores values after clear' do store["strkey1"] = '' store["strkey2"] = nil store.clear.should equal(store) store["strkey1"] = '' store["strkey1"].should == '' store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = '' store.delete("strkey1").should == '' store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = '' store["strkey1"].should == '' store["strkey1"] = nil store["strkey1"].should == nil end it 'stores frozen values' do value = ''.freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == '' end it 'stores frozen keys' do key = "strkey1".freeze store[key] = '' store["strkey1"].should == '' end it 'writes values to keys that like a Hash' do store["strkey2"] = '' store["strkey2"].should == '' store.load("strkey2").should == '' end it 'returns true from #key? if a key is available' do store["strkey2"] = '' store.key?("strkey2").should be_true end it 'stores values with #store' do value = '' store.store("strkey2", value).should equal(value) store["strkey2"].should == '' store.load("strkey2").should == '' end it 'stores values after clear' do store["strkey2"] = '' store["strkey1"] = nil store.clear.should equal(store) store["strkey2"] = '' store["strkey2"].should == '' store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = '' store.delete("strkey2").should == '' store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = '' store["strkey2"].should == '' store["strkey2"] = nil store["strkey2"].should == nil end it 'stores frozen values' do value = ''.freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == '' end it 'stores frozen keys' do key = "strkey2".freeze store[key] = '' store["strkey2"].should == '' end it 'writes values to keys that like a Hash' do store["strkey1"] = nil store["strkey1"].should == nil store.load("strkey1").should == nil end it 'returns true from #key? if a key is available' do store["strkey1"] = nil store.key?("strkey1").should be_true end it 'stores values with #store' do value = nil store.store("strkey1", value).should equal(value) store["strkey1"].should == nil store.load("strkey1").should == nil end it 'stores values after clear' do store["strkey1"] = nil store["strkey2"] = '' store.clear.should equal(store) store["strkey1"] = nil store["strkey1"].should == nil store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = nil store.delete("strkey1").should == nil store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = nil store["strkey1"].should == nil store["strkey1"] = '' store["strkey1"].should == '' end it 'stores frozen values' do value = nil.freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == nil end it 'stores frozen keys' do key = "strkey1".freeze store[key] = nil store["strkey1"].should == nil end it 'writes values to keys that like a Hash' do store["strkey2"] = nil store["strkey2"].should == nil store.load("strkey2").should == nil end it 'returns true from #key? if a key is available' do store["strkey2"] = nil store.key?("strkey2").should be_true end it 'stores values with #store' do value = nil store.store("strkey2", value).should equal(value) store["strkey2"].should == nil store.load("strkey2").should == nil end it 'stores values after clear' do store["strkey2"] = nil store["strkey1"] = '' store.clear.should equal(store) store["strkey2"] = nil store["strkey2"].should == nil store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = nil store.delete("strkey2").should == nil store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = nil store["strkey2"].should == nil store["strkey2"] = '' store["strkey2"].should == '' end it 'stores frozen values' do value = nil.freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == nil end it 'stores frozen keys' do key = "strkey2".freeze store[key] = nil store["strkey2"].should == nil end it 'writes values to keys that like a Hash' do store["strkey1"] = 0 store["strkey1"].should == 0 store.load("strkey1").should == 0 end it 'returns true from #key? if a key is available' do store["strkey1"] = 0 store.key?("strkey1").should be_true end it 'stores values with #store' do value = 0 store.store("strkey1", value).should equal(value) store["strkey1"].should == 0 store.load("strkey1").should == 0 end it 'stores values after clear' do store["strkey1"] = 0 store["strkey2"] = false store.clear.should equal(store) store["strkey1"] = 0 store["strkey1"].should == 0 store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = 0 store.delete("strkey1").should == 0 store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = 0 store["strkey1"].should == 0 store["strkey1"] = false store["strkey1"].should == false end it 'stores frozen values' do value = 0.freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == 0 end it 'stores frozen keys' do key = "strkey1".freeze store[key] = 0 store["strkey1"].should == 0 end it 'writes values to keys that like a Hash' do store["strkey2"] = 0 store["strkey2"].should == 0 store.load("strkey2").should == 0 end it 'returns true from #key? if a key is available' do store["strkey2"] = 0 store.key?("strkey2").should be_true end it 'stores values with #store' do value = 0 store.store("strkey2", value).should equal(value) store["strkey2"].should == 0 store.load("strkey2").should == 0 end it 'stores values after clear' do store["strkey2"] = 0 store["strkey1"] = false store.clear.should equal(store) store["strkey2"] = 0 store["strkey2"].should == 0 store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = 0 store.delete("strkey2").should == 0 store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = 0 store["strkey2"].should == 0 store["strkey2"] = false store["strkey2"].should == false end it 'stores frozen values' do value = 0.freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == 0 end it 'stores frozen keys' do key = "strkey2".freeze store[key] = 0 store["strkey2"].should == 0 end it 'writes values to keys that like a Hash' do store["strkey1"] = false store["strkey1"].should == false store.load("strkey1").should == false end it 'returns true from #key? if a key is available' do store["strkey1"] = false store.key?("strkey1").should be_true end it 'stores values with #store' do value = false store.store("strkey1", value).should equal(value) store["strkey1"].should == false store.load("strkey1").should == false end it 'stores values after clear' do store["strkey1"] = false store["strkey2"] = 0 store.clear.should equal(store) store["strkey1"] = false store["strkey1"].should == false store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = false store.delete("strkey1").should == false store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = false store["strkey1"].should == false store["strkey1"] = 0 store["strkey1"].should == 0 end it 'stores frozen values' do value = false.freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == false end it 'stores frozen keys' do key = "strkey1".freeze store[key] = false store["strkey1"].should == false end it 'writes values to keys that like a Hash' do store["strkey2"] = false store["strkey2"].should == false store.load("strkey2").should == false end it 'returns true from #key? if a key is available' do store["strkey2"] = false store.key?("strkey2").should be_true end it 'stores values with #store' do value = false store.store("strkey2", value).should equal(value) store["strkey2"].should == false store.load("strkey2").should == false end it 'stores values after clear' do store["strkey2"] = false store["strkey1"] = 0 store.clear.should equal(store) store["strkey2"] = false store["strkey2"].should == false store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = false store.delete("strkey2").should == false store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = false store["strkey2"].should == false store["strkey2"] = 0 store["strkey2"].should == 0 end it 'stores frozen values' do value = false.freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == false end it 'stores frozen keys' do key = "strkey2".freeze store[key] = false store["strkey2"].should == false end end #################### persist_stringkey_nilvalue #################### shared_examples_for 'persist_stringkey_nilvalue' do it 'persists values' do store["strkey1"] = '' store.close @store = nil store["strkey1"].should == '' end it 'persists values' do store["strkey2"] = '' store.close @store = nil store["strkey2"].should == '' end it 'persists values' do store["strkey1"] = nil store.close @store = nil store["strkey1"].should == nil end it 'persists values' do store["strkey2"] = nil store.close @store = nil store["strkey2"].should == nil end it 'persists values' do store["strkey1"] = 0 store.close @store = nil store["strkey1"].should == 0 end it 'persists values' do store["strkey2"] = 0 store.close @store = nil store["strkey2"].should == 0 end it 'persists values' do store["strkey1"] = false store.close @store = nil store["strkey1"].should == false end it 'persists values' do store["strkey2"] = false store.close @store = nil store["strkey2"].should == false end end #################### null_stringkey_integervalue #################### shared_examples_for 'null_stringkey_integervalue' do it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = 41 store["strkey2"] = -12 store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", 41, options).should == 41 end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = 41 store["strkey1"] = -12 store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", 41, options).should == 41 end it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = -12 store["strkey2"] = 41 store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", -12, options).should == -12 end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = -12 store["strkey1"] = 41 store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", -12, options).should == -12 end end #################### store_stringkey_integervalue #################### shared_examples_for 'store_stringkey_integervalue' do it 'writes values to keys that like a Hash' do store["strkey1"] = 41 store["strkey1"].should == 41 store.load("strkey1").should == 41 end it 'returns true from #key? if a key is available' do store["strkey1"] = 41 store.key?("strkey1").should be_true end it 'stores values with #store' do value = 41 store.store("strkey1", value).should equal(value) store["strkey1"].should == 41 store.load("strkey1").should == 41 end it 'stores values after clear' do store["strkey1"] = 41 store["strkey2"] = -12 store.clear.should equal(store) store["strkey1"] = 41 store["strkey1"].should == 41 store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = 41 store.delete("strkey1").should == 41 store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = 41 store["strkey1"].should == 41 store["strkey1"] = -12 store["strkey1"].should == -12 end it 'stores frozen values' do value = 41.freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == 41 end it 'stores frozen keys' do key = "strkey1".freeze store[key] = 41 store["strkey1"].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey1"] = 41 store.fetch("strkey1", -12).should == 41 end it 'does not run the block in fetch if the key is available' do store["strkey1"] = 41 unaltered = 'unaltered' store.fetch("strkey1") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey2"] = 41 store["strkey2"].should == 41 store.load("strkey2").should == 41 end it 'returns true from #key? if a key is available' do store["strkey2"] = 41 store.key?("strkey2").should be_true end it 'stores values with #store' do value = 41 store.store("strkey2", value).should equal(value) store["strkey2"].should == 41 store.load("strkey2").should == 41 end it 'stores values after clear' do store["strkey2"] = 41 store["strkey1"] = -12 store.clear.should equal(store) store["strkey2"] = 41 store["strkey2"].should == 41 store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = 41 store.delete("strkey2").should == 41 store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = 41 store["strkey2"].should == 41 store["strkey2"] = -12 store["strkey2"].should == -12 end it 'stores frozen values' do value = 41.freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == 41 end it 'stores frozen keys' do key = "strkey2".freeze store[key] = 41 store["strkey2"].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey2"] = 41 store.fetch("strkey2", -12).should == 41 end it 'does not run the block in fetch if the key is available' do store["strkey2"] = 41 unaltered = 'unaltered' store.fetch("strkey2") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey1"] = -12 store["strkey1"].should == -12 store.load("strkey1").should == -12 end it 'returns true from #key? if a key is available' do store["strkey1"] = -12 store.key?("strkey1").should be_true end it 'stores values with #store' do value = -12 store.store("strkey1", value).should equal(value) store["strkey1"].should == -12 store.load("strkey1").should == -12 end it 'stores values after clear' do store["strkey1"] = -12 store["strkey2"] = 41 store.clear.should equal(store) store["strkey1"] = -12 store["strkey1"].should == -12 store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = -12 store.delete("strkey1").should == -12 store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = -12 store["strkey1"].should == -12 store["strkey1"] = 41 store["strkey1"].should == 41 end it 'stores frozen values' do value = -12.freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == -12 end it 'stores frozen keys' do key = "strkey1".freeze store[key] = -12 store["strkey1"].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey1"] = -12 store.fetch("strkey1", 41).should == -12 end it 'does not run the block in fetch if the key is available' do store["strkey1"] = -12 unaltered = 'unaltered' store.fetch("strkey1") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey2"] = -12 store["strkey2"].should == -12 store.load("strkey2").should == -12 end it 'returns true from #key? if a key is available' do store["strkey2"] = -12 store.key?("strkey2").should be_true end it 'stores values with #store' do value = -12 store.store("strkey2", value).should equal(value) store["strkey2"].should == -12 store.load("strkey2").should == -12 end it 'stores values after clear' do store["strkey2"] = -12 store["strkey1"] = 41 store.clear.should equal(store) store["strkey2"] = -12 store["strkey2"].should == -12 store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = -12 store.delete("strkey2").should == -12 store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = -12 store["strkey2"].should == -12 store["strkey2"] = 41 store["strkey2"].should == 41 end it 'stores frozen values' do value = -12.freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == -12 end it 'stores frozen keys' do key = "strkey2".freeze store[key] = -12 store["strkey2"].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey2"] = -12 store.fetch("strkey2", 41).should == -12 end it 'does not run the block in fetch if the key is available' do store["strkey2"] = -12 unaltered = 'unaltered' store.fetch("strkey2") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_stringkey_integervalue #################### shared_examples_for 'persist_stringkey_integervalue' do it 'persists values' do store["strkey1"] = 41 store.close @store = nil store["strkey1"].should == 41 end it 'persists values' do store["strkey2"] = 41 store.close @store = nil store["strkey2"].should == 41 end it 'persists values' do store["strkey1"] = -12 store.close @store = nil store["strkey1"].should == -12 end it 'persists values' do store["strkey2"] = -12 store.close @store = nil store["strkey2"].should == -12 end end #################### null_stringkey_numbervalue #################### shared_examples_for 'null_stringkey_numbervalue' do it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = 123.456 store["strkey2"] = -98.7 store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = 123.456 store["strkey1"] = -98.7 store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = -98.7 store["strkey2"] = 123.456 store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = -98.7 store["strkey1"] = 123.456 store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = 340282366920938463463374607431768211456 store["strkey2"] = 33 store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = 340282366920938463463374607431768211456 store["strkey1"] = 33 store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = 33 store["strkey2"] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", 33, options).should == 33 end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = 33 store["strkey1"] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", 33, options).should == 33 end end #################### store_stringkey_numbervalue #################### shared_examples_for 'store_stringkey_numbervalue' do it 'writes values to keys that like a Hash' do store["strkey1"] = 123.456 store["strkey1"].should == 123.456 store.load("strkey1").should == 123.456 end it 'returns true from #key? if a key is available' do store["strkey1"] = 123.456 store.key?("strkey1").should be_true end it 'stores values with #store' do value = 123.456 store.store("strkey1", value).should equal(value) store["strkey1"].should == 123.456 store.load("strkey1").should == 123.456 end it 'stores values after clear' do store["strkey1"] = 123.456 store["strkey2"] = -98.7 store.clear.should equal(store) store["strkey1"] = 123.456 store["strkey1"].should == 123.456 store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = 123.456 store.delete("strkey1").should == 123.456 store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = 123.456 store["strkey1"].should == 123.456 store["strkey1"] = -98.7 store["strkey1"].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == 123.456 end it 'stores frozen keys' do key = "strkey1".freeze store[key] = 123.456 store["strkey1"].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey1"] = 123.456 store.fetch("strkey1", -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store["strkey1"] = 123.456 unaltered = 'unaltered' store.fetch("strkey1") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey2"] = 123.456 store["strkey2"].should == 123.456 store.load("strkey2").should == 123.456 end it 'returns true from #key? if a key is available' do store["strkey2"] = 123.456 store.key?("strkey2").should be_true end it 'stores values with #store' do value = 123.456 store.store("strkey2", value).should equal(value) store["strkey2"].should == 123.456 store.load("strkey2").should == 123.456 end it 'stores values after clear' do store["strkey2"] = 123.456 store["strkey1"] = -98.7 store.clear.should equal(store) store["strkey2"] = 123.456 store["strkey2"].should == 123.456 store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = 123.456 store.delete("strkey2").should == 123.456 store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = 123.456 store["strkey2"].should == 123.456 store["strkey2"] = -98.7 store["strkey2"].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == 123.456 end it 'stores frozen keys' do key = "strkey2".freeze store[key] = 123.456 store["strkey2"].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey2"] = 123.456 store.fetch("strkey2", -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store["strkey2"] = 123.456 unaltered = 'unaltered' store.fetch("strkey2") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey1"] = -98.7 store["strkey1"].should == -98.7 store.load("strkey1").should == -98.7 end it 'returns true from #key? if a key is available' do store["strkey1"] = -98.7 store.key?("strkey1").should be_true end it 'stores values with #store' do value = -98.7 store.store("strkey1", value).should equal(value) store["strkey1"].should == -98.7 store.load("strkey1").should == -98.7 end it 'stores values after clear' do store["strkey1"] = -98.7 store["strkey2"] = 123.456 store.clear.should equal(store) store["strkey1"] = -98.7 store["strkey1"].should == -98.7 store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = -98.7 store.delete("strkey1").should == -98.7 store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = -98.7 store["strkey1"].should == -98.7 store["strkey1"] = 123.456 store["strkey1"].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == -98.7 end it 'stores frozen keys' do key = "strkey1".freeze store[key] = -98.7 store["strkey1"].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey1"] = -98.7 store.fetch("strkey1", 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store["strkey1"] = -98.7 unaltered = 'unaltered' store.fetch("strkey1") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey2"] = -98.7 store["strkey2"].should == -98.7 store.load("strkey2").should == -98.7 end it 'returns true from #key? if a key is available' do store["strkey2"] = -98.7 store.key?("strkey2").should be_true end it 'stores values with #store' do value = -98.7 store.store("strkey2", value).should equal(value) store["strkey2"].should == -98.7 store.load("strkey2").should == -98.7 end it 'stores values after clear' do store["strkey2"] = -98.7 store["strkey1"] = 123.456 store.clear.should equal(store) store["strkey2"] = -98.7 store["strkey2"].should == -98.7 store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = -98.7 store.delete("strkey2").should == -98.7 store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = -98.7 store["strkey2"].should == -98.7 store["strkey2"] = 123.456 store["strkey2"].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == -98.7 end it 'stores frozen keys' do key = "strkey2".freeze store[key] = -98.7 store["strkey2"].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey2"] = -98.7 store.fetch("strkey2", 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store["strkey2"] = -98.7 unaltered = 'unaltered' store.fetch("strkey2") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey1"] = 340282366920938463463374607431768211456 store["strkey1"].should == 340282366920938463463374607431768211456 store.load("strkey1").should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store["strkey1"] = 340282366920938463463374607431768211456 store.key?("strkey1").should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store("strkey1", value).should equal(value) store["strkey1"].should == 340282366920938463463374607431768211456 store.load("strkey1").should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store["strkey1"] = 340282366920938463463374607431768211456 store["strkey2"] = 33 store.clear.should equal(store) store["strkey1"] = 340282366920938463463374607431768211456 store["strkey1"].should == 340282366920938463463374607431768211456 store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = 340282366920938463463374607431768211456 store.delete("strkey1").should == 340282366920938463463374607431768211456 store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = 340282366920938463463374607431768211456 store["strkey1"].should == 340282366920938463463374607431768211456 store["strkey1"] = 33 store["strkey1"].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = "strkey1".freeze store[key] = 340282366920938463463374607431768211456 store["strkey1"].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey1"] = 340282366920938463463374607431768211456 store.fetch("strkey1", 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store["strkey1"] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch("strkey1") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey2"] = 340282366920938463463374607431768211456 store["strkey2"].should == 340282366920938463463374607431768211456 store.load("strkey2").should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store["strkey2"] = 340282366920938463463374607431768211456 store.key?("strkey2").should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store("strkey2", value).should equal(value) store["strkey2"].should == 340282366920938463463374607431768211456 store.load("strkey2").should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store["strkey2"] = 340282366920938463463374607431768211456 store["strkey1"] = 33 store.clear.should equal(store) store["strkey2"] = 340282366920938463463374607431768211456 store["strkey2"].should == 340282366920938463463374607431768211456 store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = 340282366920938463463374607431768211456 store.delete("strkey2").should == 340282366920938463463374607431768211456 store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = 340282366920938463463374607431768211456 store["strkey2"].should == 340282366920938463463374607431768211456 store["strkey2"] = 33 store["strkey2"].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = "strkey2".freeze store[key] = 340282366920938463463374607431768211456 store["strkey2"].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey2"] = 340282366920938463463374607431768211456 store.fetch("strkey2", 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store["strkey2"] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch("strkey2") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey1"] = 33 store["strkey1"].should == 33 store.load("strkey1").should == 33 end it 'returns true from #key? if a key is available' do store["strkey1"] = 33 store.key?("strkey1").should be_true end it 'stores values with #store' do value = 33 store.store("strkey1", value).should equal(value) store["strkey1"].should == 33 store.load("strkey1").should == 33 end it 'stores values after clear' do store["strkey1"] = 33 store["strkey2"] = 340282366920938463463374607431768211456 store.clear.should equal(store) store["strkey1"] = 33 store["strkey1"].should == 33 store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = 33 store.delete("strkey1").should == 33 store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = 33 store["strkey1"].should == 33 store["strkey1"] = 340282366920938463463374607431768211456 store["strkey1"].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == 33 end it 'stores frozen keys' do key = "strkey1".freeze store[key] = 33 store["strkey1"].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey1"] = 33 store.fetch("strkey1", 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store["strkey1"] = 33 unaltered = 'unaltered' store.fetch("strkey1") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey2"] = 33 store["strkey2"].should == 33 store.load("strkey2").should == 33 end it 'returns true from #key? if a key is available' do store["strkey2"] = 33 store.key?("strkey2").should be_true end it 'stores values with #store' do value = 33 store.store("strkey2", value).should equal(value) store["strkey2"].should == 33 store.load("strkey2").should == 33 end it 'stores values after clear' do store["strkey2"] = 33 store["strkey1"] = 340282366920938463463374607431768211456 store.clear.should equal(store) store["strkey2"] = 33 store["strkey2"].should == 33 store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = 33 store.delete("strkey2").should == 33 store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = 33 store["strkey2"].should == 33 store["strkey2"] = 340282366920938463463374607431768211456 store["strkey2"].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == 33 end it 'stores frozen keys' do key = "strkey2".freeze store[key] = 33 store["strkey2"].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey2"] = 33 store.fetch("strkey2", 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store["strkey2"] = 33 unaltered = 'unaltered' store.fetch("strkey2") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_stringkey_numbervalue #################### shared_examples_for 'persist_stringkey_numbervalue' do it 'persists values' do store["strkey1"] = 123.456 store.close @store = nil store["strkey1"].should == 123.456 end it 'persists values' do store["strkey2"] = 123.456 store.close @store = nil store["strkey2"].should == 123.456 end it 'persists values' do store["strkey1"] = -98.7 store.close @store = nil store["strkey1"].should == -98.7 end it 'persists values' do store["strkey2"] = -98.7 store.close @store = nil store["strkey2"].should == -98.7 end it 'persists values' do store["strkey1"] = 340282366920938463463374607431768211456 store.close @store = nil store["strkey1"].should == 340282366920938463463374607431768211456 end it 'persists values' do store["strkey2"] = 340282366920938463463374607431768211456 store.close @store = nil store["strkey2"].should == 340282366920938463463374607431768211456 end it 'persists values' do store["strkey1"] = 33 store.close @store = nil store["strkey1"].should == 33 end it 'persists values' do store["strkey2"] = 33 store.close @store = nil store["strkey2"].should == 33 end end #################### null_stringkey_booleanvalue #################### shared_examples_for 'null_stringkey_booleanvalue' do it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = true store["strkey2"] = false store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", true, options).should == true end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = true store["strkey1"] = false store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", true, options).should == true end it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = false store["strkey2"] = true store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", false, options).should == false end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = false store["strkey1"] = true store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", false, options).should == false end end #################### store_stringkey_booleanvalue #################### shared_examples_for 'store_stringkey_booleanvalue' do it 'writes values to keys that like a Hash' do store["strkey1"] = true store["strkey1"].should == true store.load("strkey1").should == true end it 'returns true from #key? if a key is available' do store["strkey1"] = true store.key?("strkey1").should be_true end it 'stores values with #store' do value = true store.store("strkey1", value).should equal(value) store["strkey1"].should == true store.load("strkey1").should == true end it 'stores values after clear' do store["strkey1"] = true store["strkey2"] = false store.clear.should equal(store) store["strkey1"] = true store["strkey1"].should == true store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = true store.delete("strkey1").should == true store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = true store["strkey1"].should == true store["strkey1"] = false store["strkey1"].should == false end it 'stores frozen values' do value = true.freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == true end it 'stores frozen keys' do key = "strkey1".freeze store[key] = true store["strkey1"].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey1"] = true store.fetch("strkey1", false).should == true end it 'does not run the block in fetch if the key is available' do store["strkey1"] = true unaltered = 'unaltered' store.fetch("strkey1") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey2"] = true store["strkey2"].should == true store.load("strkey2").should == true end it 'returns true from #key? if a key is available' do store["strkey2"] = true store.key?("strkey2").should be_true end it 'stores values with #store' do value = true store.store("strkey2", value).should equal(value) store["strkey2"].should == true store.load("strkey2").should == true end it 'stores values after clear' do store["strkey2"] = true store["strkey1"] = false store.clear.should equal(store) store["strkey2"] = true store["strkey2"].should == true store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = true store.delete("strkey2").should == true store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = true store["strkey2"].should == true store["strkey2"] = false store["strkey2"].should == false end it 'stores frozen values' do value = true.freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == true end it 'stores frozen keys' do key = "strkey2".freeze store[key] = true store["strkey2"].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey2"] = true store.fetch("strkey2", false).should == true end it 'does not run the block in fetch if the key is available' do store["strkey2"] = true unaltered = 'unaltered' store.fetch("strkey2") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey1"] = false store["strkey1"].should == false store.load("strkey1").should == false end it 'returns true from #key? if a key is available' do store["strkey1"] = false store.key?("strkey1").should be_true end it 'stores values with #store' do value = false store.store("strkey1", value).should equal(value) store["strkey1"].should == false store.load("strkey1").should == false end it 'stores values after clear' do store["strkey1"] = false store["strkey2"] = true store.clear.should equal(store) store["strkey1"] = false store["strkey1"].should == false store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = false store.delete("strkey1").should == false store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = false store["strkey1"].should == false store["strkey1"] = true store["strkey1"].should == true end it 'stores frozen values' do value = false.freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == false end it 'stores frozen keys' do key = "strkey1".freeze store[key] = false store["strkey1"].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey1"] = false store.fetch("strkey1", true).should == false end it 'does not run the block in fetch if the key is available' do store["strkey1"] = false unaltered = 'unaltered' store.fetch("strkey1") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey2"] = false store["strkey2"].should == false store.load("strkey2").should == false end it 'returns true from #key? if a key is available' do store["strkey2"] = false store.key?("strkey2").should be_true end it 'stores values with #store' do value = false store.store("strkey2", value).should equal(value) store["strkey2"].should == false store.load("strkey2").should == false end it 'stores values after clear' do store["strkey2"] = false store["strkey1"] = true store.clear.should equal(store) store["strkey2"] = false store["strkey2"].should == false store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = false store.delete("strkey2").should == false store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = false store["strkey2"].should == false store["strkey2"] = true store["strkey2"].should == true end it 'stores frozen values' do value = false.freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == false end it 'stores frozen keys' do key = "strkey2".freeze store[key] = false store["strkey2"].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey2"] = false store.fetch("strkey2", true).should == false end it 'does not run the block in fetch if the key is available' do store["strkey2"] = false unaltered = 'unaltered' store.fetch("strkey2") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_stringkey_booleanvalue #################### shared_examples_for 'persist_stringkey_booleanvalue' do it 'persists values' do store["strkey1"] = true store.close @store = nil store["strkey1"].should == true end it 'persists values' do store["strkey2"] = true store.close @store = nil store["strkey2"].should == true end it 'persists values' do store["strkey1"] = false store.close @store = nil store["strkey1"].should == false end it 'persists values' do store["strkey2"] = false store.close @store = nil store["strkey2"].should == false end end #################### null_stringkey_stringvalue #################### shared_examples_for 'null_stringkey_stringvalue' do it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = "strval1" store["strkey2"] = "strval2" store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = "strval1" store["strkey1"] = "strval2" store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = "strval2" store["strkey2"] = "strval1" store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", "strval2", options).should == "strval2" end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = "strval2" store["strkey1"] = "strval1" store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", "strval2", options).should == "strval2" end end #################### store_stringkey_stringvalue #################### shared_examples_for 'store_stringkey_stringvalue' do it 'writes values to keys that like a Hash' do store["strkey1"] = "strval1" store["strkey1"].should == "strval1" store.load("strkey1").should == "strval1" end it 'returns true from #key? if a key is available' do store["strkey1"] = "strval1" store.key?("strkey1").should be_true end it 'stores values with #store' do value = "strval1" store.store("strkey1", value).should equal(value) store["strkey1"].should == "strval1" store.load("strkey1").should == "strval1" end it 'stores values after clear' do store["strkey1"] = "strval1" store["strkey2"] = "strval2" store.clear.should equal(store) store["strkey1"] = "strval1" store["strkey1"].should == "strval1" store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = "strval1" store.delete("strkey1").should == "strval1" store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = "strval1" store["strkey1"].should == "strval1" store["strkey1"] = "strval2" store["strkey1"].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == "strval1" end it 'stores frozen keys' do key = "strkey1".freeze store[key] = "strval1" store["strkey1"].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey1"] = "strval1" store.fetch("strkey1", "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store["strkey1"] = "strval1" unaltered = 'unaltered' store.fetch("strkey1") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey2"] = "strval1" store["strkey2"].should == "strval1" store.load("strkey2").should == "strval1" end it 'returns true from #key? if a key is available' do store["strkey2"] = "strval1" store.key?("strkey2").should be_true end it 'stores values with #store' do value = "strval1" store.store("strkey2", value).should equal(value) store["strkey2"].should == "strval1" store.load("strkey2").should == "strval1" end it 'stores values after clear' do store["strkey2"] = "strval1" store["strkey1"] = "strval2" store.clear.should equal(store) store["strkey2"] = "strval1" store["strkey2"].should == "strval1" store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = "strval1" store.delete("strkey2").should == "strval1" store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = "strval1" store["strkey2"].should == "strval1" store["strkey2"] = "strval2" store["strkey2"].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == "strval1" end it 'stores frozen keys' do key = "strkey2".freeze store[key] = "strval1" store["strkey2"].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey2"] = "strval1" store.fetch("strkey2", "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store["strkey2"] = "strval1" unaltered = 'unaltered' store.fetch("strkey2") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey1"] = "strval2" store["strkey1"].should == "strval2" store.load("strkey1").should == "strval2" end it 'returns true from #key? if a key is available' do store["strkey1"] = "strval2" store.key?("strkey1").should be_true end it 'stores values with #store' do value = "strval2" store.store("strkey1", value).should equal(value) store["strkey1"].should == "strval2" store.load("strkey1").should == "strval2" end it 'stores values after clear' do store["strkey1"] = "strval2" store["strkey2"] = "strval1" store.clear.should equal(store) store["strkey1"] = "strval2" store["strkey1"].should == "strval2" store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = "strval2" store.delete("strkey1").should == "strval2" store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = "strval2" store["strkey1"].should == "strval2" store["strkey1"] = "strval1" store["strkey1"].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == "strval2" end it 'stores frozen keys' do key = "strkey1".freeze store[key] = "strval2" store["strkey1"].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey1"] = "strval2" store.fetch("strkey1", "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store["strkey1"] = "strval2" unaltered = 'unaltered' store.fetch("strkey1") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey2"] = "strval2" store["strkey2"].should == "strval2" store.load("strkey2").should == "strval2" end it 'returns true from #key? if a key is available' do store["strkey2"] = "strval2" store.key?("strkey2").should be_true end it 'stores values with #store' do value = "strval2" store.store("strkey2", value).should equal(value) store["strkey2"].should == "strval2" store.load("strkey2").should == "strval2" end it 'stores values after clear' do store["strkey2"] = "strval2" store["strkey1"] = "strval1" store.clear.should equal(store) store["strkey2"] = "strval2" store["strkey2"].should == "strval2" store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = "strval2" store.delete("strkey2").should == "strval2" store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = "strval2" store["strkey2"].should == "strval2" store["strkey2"] = "strval1" store["strkey2"].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == "strval2" end it 'stores frozen keys' do key = "strkey2".freeze store[key] = "strval2" store["strkey2"].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey2"] = "strval2" store.fetch("strkey2", "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store["strkey2"] = "strval2" unaltered = 'unaltered' store.fetch("strkey2") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_stringkey_stringvalue #################### shared_examples_for 'returndifferent_stringkey_stringvalue' do it 'guarantees that a different value is retrieved' do value = "strval1" store["strkey1"] = value store["strkey1"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval1" store["strkey2"] = value store["strkey2"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store["strkey1"] = value store["strkey1"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store["strkey2"] = value store["strkey2"].should_not be_equal(value) end end #################### returnsame_stringkey_stringvalue #################### shared_examples_for 'returnsame_stringkey_stringvalue' do it 'guarantees that the same value is retrieved' do value = "strval1" store["strkey1"] = value store["strkey1"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval1" store["strkey2"] = value store["strkey2"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store["strkey1"] = value store["strkey1"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store["strkey2"] = value store["strkey2"].should be_equal(value) end end #################### persist_stringkey_stringvalue #################### shared_examples_for 'persist_stringkey_stringvalue' do it 'persists values' do store["strkey1"] = "strval1" store.close @store = nil store["strkey1"].should == "strval1" end it 'persists values' do store["strkey2"] = "strval1" store.close @store = nil store["strkey2"].should == "strval1" end it 'persists values' do store["strkey1"] = "strval2" store.close @store = nil store["strkey1"].should == "strval2" end it 'persists values' do store["strkey2"] = "strval2" store.close @store = nil store["strkey2"].should == "strval2" end end #################### null_stringkey_binaryvalue #################### shared_examples_for 'null_stringkey_binaryvalue' do it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = "über" store["strkey2"] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", "über", options).should == "über" end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = "über" store["strkey1"] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", "über", options).should == "über" end it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = "\xAA\xBB\xCC" store["strkey2"] = "über" store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = "\xAA\xBB\xCC" store["strkey1"] = "über" store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end end #################### store_stringkey_binaryvalue #################### shared_examples_for 'store_stringkey_binaryvalue' do it 'writes values to keys that like a Hash' do store["strkey1"] = "über" store["strkey1"].should == "über" store.load("strkey1").should == "über" end it 'returns true from #key? if a key is available' do store["strkey1"] = "über" store.key?("strkey1").should be_true end it 'stores values with #store' do value = "über" store.store("strkey1", value).should equal(value) store["strkey1"].should == "über" store.load("strkey1").should == "über" end it 'stores values after clear' do store["strkey1"] = "über" store["strkey2"] = "\xAA\xBB\xCC" store.clear.should equal(store) store["strkey1"] = "über" store["strkey1"].should == "über" store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = "über" store.delete("strkey1").should == "über" store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = "über" store["strkey1"].should == "über" store["strkey1"] = "\xAA\xBB\xCC" store["strkey1"].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == "über" end it 'stores frozen keys' do key = "strkey1".freeze store[key] = "über" store["strkey1"].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey1"] = "über" store.fetch("strkey1", "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store["strkey1"] = "über" unaltered = 'unaltered' store.fetch("strkey1") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey2"] = "über" store["strkey2"].should == "über" store.load("strkey2").should == "über" end it 'returns true from #key? if a key is available' do store["strkey2"] = "über" store.key?("strkey2").should be_true end it 'stores values with #store' do value = "über" store.store("strkey2", value).should equal(value) store["strkey2"].should == "über" store.load("strkey2").should == "über" end it 'stores values after clear' do store["strkey2"] = "über" store["strkey1"] = "\xAA\xBB\xCC" store.clear.should equal(store) store["strkey2"] = "über" store["strkey2"].should == "über" store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = "über" store.delete("strkey2").should == "über" store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = "über" store["strkey2"].should == "über" store["strkey2"] = "\xAA\xBB\xCC" store["strkey2"].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == "über" end it 'stores frozen keys' do key = "strkey2".freeze store[key] = "über" store["strkey2"].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey2"] = "über" store.fetch("strkey2", "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store["strkey2"] = "über" unaltered = 'unaltered' store.fetch("strkey2") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey1"] = "\xAA\xBB\xCC" store["strkey1"].should == "\xAA\xBB\xCC" store.load("strkey1").should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store["strkey1"] = "\xAA\xBB\xCC" store.key?("strkey1").should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store("strkey1", value).should equal(value) store["strkey1"].should == "\xAA\xBB\xCC" store.load("strkey1").should == "\xAA\xBB\xCC" end it 'stores values after clear' do store["strkey1"] = "\xAA\xBB\xCC" store["strkey2"] = "über" store.clear.should equal(store) store["strkey1"] = "\xAA\xBB\xCC" store["strkey1"].should == "\xAA\xBB\xCC" store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = "\xAA\xBB\xCC" store.delete("strkey1").should == "\xAA\xBB\xCC" store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = "\xAA\xBB\xCC" store["strkey1"].should == "\xAA\xBB\xCC" store["strkey1"] = "über" store["strkey1"].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = "strkey1".freeze store[key] = "\xAA\xBB\xCC" store["strkey1"].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey1"] = "\xAA\xBB\xCC" store.fetch("strkey1", "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store["strkey1"] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch("strkey1") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey2"] = "\xAA\xBB\xCC" store["strkey2"].should == "\xAA\xBB\xCC" store.load("strkey2").should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store["strkey2"] = "\xAA\xBB\xCC" store.key?("strkey2").should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store("strkey2", value).should equal(value) store["strkey2"].should == "\xAA\xBB\xCC" store.load("strkey2").should == "\xAA\xBB\xCC" end it 'stores values after clear' do store["strkey2"] = "\xAA\xBB\xCC" store["strkey1"] = "über" store.clear.should equal(store) store["strkey2"] = "\xAA\xBB\xCC" store["strkey2"].should == "\xAA\xBB\xCC" store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = "\xAA\xBB\xCC" store.delete("strkey2").should == "\xAA\xBB\xCC" store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = "\xAA\xBB\xCC" store["strkey2"].should == "\xAA\xBB\xCC" store["strkey2"] = "über" store["strkey2"].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = "strkey2".freeze store[key] = "\xAA\xBB\xCC" store["strkey2"].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey2"] = "\xAA\xBB\xCC" store.fetch("strkey2", "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store["strkey2"] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch("strkey2") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_stringkey_binaryvalue #################### shared_examples_for 'returndifferent_stringkey_binaryvalue' do it 'guarantees that a different value is retrieved' do value = "über" store["strkey1"] = value store["strkey1"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "über" store["strkey2"] = value store["strkey2"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store["strkey1"] = value store["strkey1"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store["strkey2"] = value store["strkey2"].should_not be_equal(value) end end #################### returnsame_stringkey_binaryvalue #################### shared_examples_for 'returnsame_stringkey_binaryvalue' do it 'guarantees that the same value is retrieved' do value = "über" store["strkey1"] = value store["strkey1"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "über" store["strkey2"] = value store["strkey2"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store["strkey1"] = value store["strkey1"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store["strkey2"] = value store["strkey2"].should be_equal(value) end end #################### persist_stringkey_binaryvalue #################### shared_examples_for 'persist_stringkey_binaryvalue' do it 'persists values' do store["strkey1"] = "über" store.close @store = nil store["strkey1"].should == "über" end it 'persists values' do store["strkey2"] = "über" store.close @store = nil store["strkey2"].should == "über" end it 'persists values' do store["strkey1"] = "\xAA\xBB\xCC" store.close @store = nil store["strkey1"].should == "\xAA\xBB\xCC" end it 'persists values' do store["strkey2"] = "\xAA\xBB\xCC" store.close @store = nil store["strkey2"].should == "\xAA\xBB\xCC" end end #################### null_stringkey_hashvalue #################### shared_examples_for 'null_stringkey_hashvalue' do it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = {"hashval1"=>["array1", 1]} store["strkey2"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = {"hashval1"=>["array1", 1]} store["strkey1"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey2"] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey1"] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### store_stringkey_hashvalue #################### shared_examples_for 'store_stringkey_hashvalue' do it 'writes values to keys that like a Hash' do store["strkey1"] = {"hashval1"=>["array1", 1]} store["strkey1"].should == {"hashval1"=>["array1", 1]} store.load("strkey1").should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store["strkey1"] = {"hashval1"=>["array1", 1]} store.key?("strkey1").should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store("strkey1", value).should equal(value) store["strkey1"].should == {"hashval1"=>["array1", 1]} store.load("strkey1").should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store["strkey1"] = {"hashval1"=>["array1", 1]} store["strkey2"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store["strkey1"] = {"hashval1"=>["array1", 1]} store["strkey1"].should == {"hashval1"=>["array1", 1]} store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = {"hashval1"=>["array1", 1]} store.delete("strkey1").should == {"hashval1"=>["array1", 1]} store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = {"hashval1"=>["array1", 1]} store["strkey1"].should == {"hashval1"=>["array1", 1]} store["strkey1"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey1"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = "strkey1".freeze store[key] = {"hashval1"=>["array1", 1]} store["strkey1"].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey1"] = {"hashval1"=>["array1", 1]} store.fetch("strkey1", {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store["strkey1"] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch("strkey1") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey2"] = {"hashval1"=>["array1", 1]} store["strkey2"].should == {"hashval1"=>["array1", 1]} store.load("strkey2").should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store["strkey2"] = {"hashval1"=>["array1", 1]} store.key?("strkey2").should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store("strkey2", value).should equal(value) store["strkey2"].should == {"hashval1"=>["array1", 1]} store.load("strkey2").should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store["strkey2"] = {"hashval1"=>["array1", 1]} store["strkey1"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store["strkey2"] = {"hashval1"=>["array1", 1]} store["strkey2"].should == {"hashval1"=>["array1", 1]} store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = {"hashval1"=>["array1", 1]} store.delete("strkey2").should == {"hashval1"=>["array1", 1]} store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = {"hashval1"=>["array1", 1]} store["strkey2"].should == {"hashval1"=>["array1", 1]} store["strkey2"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey2"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = "strkey2".freeze store[key] = {"hashval1"=>["array1", 1]} store["strkey2"].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey2"] = {"hashval1"=>["array1", 1]} store.fetch("strkey2", {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store["strkey2"] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch("strkey2") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey1"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey1"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load("strkey1").should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store["strkey1"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?("strkey1").should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store("strkey1", value).should equal(value) store["strkey1"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load("strkey1").should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store["strkey1"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey2"] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store["strkey1"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey1"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete("strkey1").should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey1"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey1"] = {"hashval1"=>["array1", 1]} store["strkey1"].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = "strkey1".freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey1"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey1"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch("strkey1", {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store["strkey1"] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch("strkey1") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey2"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey2"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load("strkey2").should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store["strkey2"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?("strkey2").should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store("strkey2", value).should equal(value) store["strkey2"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load("strkey2").should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store["strkey2"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey1"] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store["strkey2"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey2"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete("strkey2").should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey2"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey2"] = {"hashval1"=>["array1", 1]} store["strkey2"].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = "strkey2".freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey2"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey2"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch("strkey2", {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store["strkey2"] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch("strkey2") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_stringkey_hashvalue #################### shared_examples_for 'returndifferent_stringkey_hashvalue' do it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store["strkey1"] = value store["strkey1"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store["strkey2"] = value store["strkey2"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey1"] = value store["strkey1"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey2"] = value store["strkey2"].should_not be_equal(value) end end #################### returnsame_stringkey_hashvalue #################### shared_examples_for 'returnsame_stringkey_hashvalue' do it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store["strkey1"] = value store["strkey1"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store["strkey2"] = value store["strkey2"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey1"] = value store["strkey1"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store["strkey2"] = value store["strkey2"].should be_equal(value) end end #################### persist_stringkey_hashvalue #################### shared_examples_for 'persist_stringkey_hashvalue' do it 'persists values' do store["strkey1"] = {"hashval1"=>["array1", 1]} store.close @store = nil store["strkey1"].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store["strkey2"] = {"hashval1"=>["array1", 1]} store.close @store = nil store["strkey2"].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store["strkey1"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store["strkey1"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'persists values' do store["strkey2"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store["strkey2"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### null_stringkey_objectvalue #################### shared_examples_for 'null_stringkey_objectvalue' do it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = Value.new(:objval1) store["strkey2"] = Value.new(:objval2) store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = Value.new(:objval1) store["strkey1"] = Value.new(:objval2) store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store["strkey1"].should be_nil store.load("strkey1").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store["strkey1"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey1").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey1").should be_nil end it 'removes all keys from the store with clear' do store["strkey1"] = Value.new(:objval2) store["strkey2"] = Value.new(:objval1) store.clear.should equal(store) store.key?("strkey1").should be_false store.key?("strkey2").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey1", Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey1" value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey1", options).should be_false store.load("strkey1", options).should be_nil store.fetch("strkey1", 42, options).should == 42 store.fetch("strkey1", options) { 42 }.should == 42 store.delete("strkey1", options).should be_nil store.clear(options).should equal(store) store.store("strkey1", Value.new(:objval2), options).should == Value.new(:objval2) end it 'reads from keys like a Hash' do store["strkey2"].should be_nil store.load("strkey2").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store["strkey2"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("strkey2").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("strkey2").should be_nil end it 'removes all keys from the store with clear' do store["strkey2"] = Value.new(:objval2) store["strkey1"] = Value.new(:objval1) store.clear.should equal(store) store.key?("strkey2").should be_false store.key?("strkey1").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("strkey2", Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = "strkey2" value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("strkey2", options).should be_false store.load("strkey2", options).should be_nil store.fetch("strkey2", 42, options).should == 42 store.fetch("strkey2", options) { 42 }.should == 42 store.delete("strkey2", options).should be_nil store.clear(options).should equal(store) store.store("strkey2", Value.new(:objval2), options).should == Value.new(:objval2) end end #################### store_stringkey_objectvalue #################### shared_examples_for 'store_stringkey_objectvalue' do it 'writes values to keys that like a Hash' do store["strkey1"] = Value.new(:objval1) store["strkey1"].should == Value.new(:objval1) store.load("strkey1").should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store["strkey1"] = Value.new(:objval1) store.key?("strkey1").should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store("strkey1", value).should equal(value) store["strkey1"].should == Value.new(:objval1) store.load("strkey1").should == Value.new(:objval1) end it 'stores values after clear' do store["strkey1"] = Value.new(:objval1) store["strkey2"] = Value.new(:objval2) store.clear.should equal(store) store["strkey1"] = Value.new(:objval1) store["strkey1"].should == Value.new(:objval1) store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = Value.new(:objval1) store.delete("strkey1").should == Value.new(:objval1) store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = Value.new(:objval1) store["strkey1"].should == Value.new(:objval1) store["strkey1"] = Value.new(:objval2) store["strkey1"].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == Value.new(:objval1) end it 'stores frozen keys' do key = "strkey1".freeze store[key] = Value.new(:objval1) store["strkey1"].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey1"] = Value.new(:objval1) store.fetch("strkey1", Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store["strkey1"] = Value.new(:objval1) unaltered = 'unaltered' store.fetch("strkey1") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey2"] = Value.new(:objval1) store["strkey2"].should == Value.new(:objval1) store.load("strkey2").should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store["strkey2"] = Value.new(:objval1) store.key?("strkey2").should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store("strkey2", value).should equal(value) store["strkey2"].should == Value.new(:objval1) store.load("strkey2").should == Value.new(:objval1) end it 'stores values after clear' do store["strkey2"] = Value.new(:objval1) store["strkey1"] = Value.new(:objval2) store.clear.should equal(store) store["strkey2"] = Value.new(:objval1) store["strkey2"].should == Value.new(:objval1) store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = Value.new(:objval1) store.delete("strkey2").should == Value.new(:objval1) store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = Value.new(:objval1) store["strkey2"].should == Value.new(:objval1) store["strkey2"] = Value.new(:objval2) store["strkey2"].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == Value.new(:objval1) end it 'stores frozen keys' do key = "strkey2".freeze store[key] = Value.new(:objval1) store["strkey2"].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey2"] = Value.new(:objval1) store.fetch("strkey2", Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store["strkey2"] = Value.new(:objval1) unaltered = 'unaltered' store.fetch("strkey2") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey1"] = Value.new(:objval2) store["strkey1"].should == Value.new(:objval2) store.load("strkey1").should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store["strkey1"] = Value.new(:objval2) store.key?("strkey1").should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store("strkey1", value).should equal(value) store["strkey1"].should == Value.new(:objval2) store.load("strkey1").should == Value.new(:objval2) end it 'stores values after clear' do store["strkey1"] = Value.new(:objval2) store["strkey2"] = Value.new(:objval1) store.clear.should equal(store) store["strkey1"] = Value.new(:objval2) store["strkey1"].should == Value.new(:objval2) store["strkey2"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey1"] = Value.new(:objval2) store.delete("strkey1").should == Value.new(:objval2) store.key?("strkey1").should be_false end it 'overwrites existing values' do store["strkey1"] = Value.new(:objval2) store["strkey1"].should == Value.new(:objval2) store["strkey1"] = Value.new(:objval1) store["strkey1"].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store["strkey1"] = value).should equal(value) store["strkey1"].should == Value.new(:objval2) end it 'stores frozen keys' do key = "strkey1".freeze store[key] = Value.new(:objval2) store["strkey1"].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey1"] = Value.new(:objval2) store.fetch("strkey1", Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store["strkey1"] = Value.new(:objval2) unaltered = 'unaltered' store.fetch("strkey1") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["strkey2"] = Value.new(:objval2) store["strkey2"].should == Value.new(:objval2) store.load("strkey2").should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store["strkey2"] = Value.new(:objval2) store.key?("strkey2").should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store("strkey2", value).should equal(value) store["strkey2"].should == Value.new(:objval2) store.load("strkey2").should == Value.new(:objval2) end it 'stores values after clear' do store["strkey2"] = Value.new(:objval2) store["strkey1"] = Value.new(:objval1) store.clear.should equal(store) store["strkey2"] = Value.new(:objval2) store["strkey2"].should == Value.new(:objval2) store["strkey1"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["strkey2"] = Value.new(:objval2) store.delete("strkey2").should == Value.new(:objval2) store.key?("strkey2").should be_false end it 'overwrites existing values' do store["strkey2"] = Value.new(:objval2) store["strkey2"].should == Value.new(:objval2) store["strkey2"] = Value.new(:objval1) store["strkey2"].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store["strkey2"] = value).should equal(value) store["strkey2"].should == Value.new(:objval2) end it 'stores frozen keys' do key = "strkey2".freeze store[key] = Value.new(:objval2) store["strkey2"].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store["strkey2"] = Value.new(:objval2) store.fetch("strkey2", Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store["strkey2"] = Value.new(:objval2) unaltered = 'unaltered' store.fetch("strkey2") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_stringkey_objectvalue #################### shared_examples_for 'returndifferent_stringkey_objectvalue' do it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store["strkey1"] = value store["strkey1"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store["strkey2"] = value store["strkey2"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store["strkey1"] = value store["strkey1"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store["strkey2"] = value store["strkey2"].should_not be_equal(value) end end #################### returnsame_stringkey_objectvalue #################### shared_examples_for 'returnsame_stringkey_objectvalue' do it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store["strkey1"] = value store["strkey1"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store["strkey2"] = value store["strkey2"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store["strkey1"] = value store["strkey1"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store["strkey2"] = value store["strkey2"].should be_equal(value) end end #################### persist_stringkey_objectvalue #################### shared_examples_for 'persist_stringkey_objectvalue' do it 'persists values' do store["strkey1"] = Value.new(:objval1) store.close @store = nil store["strkey1"].should == Value.new(:objval1) end it 'persists values' do store["strkey2"] = Value.new(:objval1) store.close @store = nil store["strkey2"].should == Value.new(:objval1) end it 'persists values' do store["strkey1"] = Value.new(:objval2) store.close @store = nil store["strkey1"].should == Value.new(:objval2) end it 'persists values' do store["strkey2"] = Value.new(:objval2) store.close @store = nil store["strkey2"].should == Value.new(:objval2) end end #################### null_pathkey_nilvalue #################### shared_examples_for 'null_pathkey_nilvalue' do it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = '' store["foo/bar"] = nil store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", '', options).should == '' end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = '' store["bar/foo/baz"] = nil store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", '', options).should == '' end it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = nil store["foo/bar"] = '' store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", nil, options).should == nil end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = nil store["bar/foo/baz"] = '' store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", nil, options).should == nil end it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = 0 store["foo/bar"] = false store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", 0, options).should == 0 end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = 0 store["bar/foo/baz"] = false store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", 0, options).should == 0 end it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = false store["foo/bar"] = 0 store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", false, options).should == false end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = false store["bar/foo/baz"] = 0 store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", false, options).should == false end end #################### store_pathkey_nilvalue #################### shared_examples_for 'store_pathkey_nilvalue' do it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = '' store["bar/foo/baz"].should == '' store.load("bar/foo/baz").should == '' end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = '' store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = '' store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == '' store.load("bar/foo/baz").should == '' end it 'stores values after clear' do store["bar/foo/baz"] = '' store["foo/bar"] = nil store.clear.should equal(store) store["bar/foo/baz"] = '' store["bar/foo/baz"].should == '' store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = '' store.delete("bar/foo/baz").should == '' store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = '' store["bar/foo/baz"].should == '' store["bar/foo/baz"] = nil store["bar/foo/baz"].should == nil end it 'stores frozen values' do value = ''.freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == '' end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = '' store["bar/foo/baz"].should == '' end it 'writes values to keys that like a Hash' do store["foo/bar"] = '' store["foo/bar"].should == '' store.load("foo/bar").should == '' end it 'returns true from #key? if a key is available' do store["foo/bar"] = '' store.key?("foo/bar").should be_true end it 'stores values with #store' do value = '' store.store("foo/bar", value).should equal(value) store["foo/bar"].should == '' store.load("foo/bar").should == '' end it 'stores values after clear' do store["foo/bar"] = '' store["bar/foo/baz"] = nil store.clear.should equal(store) store["foo/bar"] = '' store["foo/bar"].should == '' store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = '' store.delete("foo/bar").should == '' store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = '' store["foo/bar"].should == '' store["foo/bar"] = nil store["foo/bar"].should == nil end it 'stores frozen values' do value = ''.freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == '' end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = '' store["foo/bar"].should == '' end it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = nil store["bar/foo/baz"].should == nil store.load("bar/foo/baz").should == nil end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = nil store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = nil store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == nil store.load("bar/foo/baz").should == nil end it 'stores values after clear' do store["bar/foo/baz"] = nil store["foo/bar"] = '' store.clear.should equal(store) store["bar/foo/baz"] = nil store["bar/foo/baz"].should == nil store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = nil store.delete("bar/foo/baz").should == nil store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = nil store["bar/foo/baz"].should == nil store["bar/foo/baz"] = '' store["bar/foo/baz"].should == '' end it 'stores frozen values' do value = nil.freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == nil end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = nil store["bar/foo/baz"].should == nil end it 'writes values to keys that like a Hash' do store["foo/bar"] = nil store["foo/bar"].should == nil store.load("foo/bar").should == nil end it 'returns true from #key? if a key is available' do store["foo/bar"] = nil store.key?("foo/bar").should be_true end it 'stores values with #store' do value = nil store.store("foo/bar", value).should equal(value) store["foo/bar"].should == nil store.load("foo/bar").should == nil end it 'stores values after clear' do store["foo/bar"] = nil store["bar/foo/baz"] = '' store.clear.should equal(store) store["foo/bar"] = nil store["foo/bar"].should == nil store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = nil store.delete("foo/bar").should == nil store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = nil store["foo/bar"].should == nil store["foo/bar"] = '' store["foo/bar"].should == '' end it 'stores frozen values' do value = nil.freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == nil end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = nil store["foo/bar"].should == nil end it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = 0 store["bar/foo/baz"].should == 0 store.load("bar/foo/baz").should == 0 end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = 0 store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = 0 store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == 0 store.load("bar/foo/baz").should == 0 end it 'stores values after clear' do store["bar/foo/baz"] = 0 store["foo/bar"] = false store.clear.should equal(store) store["bar/foo/baz"] = 0 store["bar/foo/baz"].should == 0 store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = 0 store.delete("bar/foo/baz").should == 0 store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = 0 store["bar/foo/baz"].should == 0 store["bar/foo/baz"] = false store["bar/foo/baz"].should == false end it 'stores frozen values' do value = 0.freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == 0 end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = 0 store["bar/foo/baz"].should == 0 end it 'writes values to keys that like a Hash' do store["foo/bar"] = 0 store["foo/bar"].should == 0 store.load("foo/bar").should == 0 end it 'returns true from #key? if a key is available' do store["foo/bar"] = 0 store.key?("foo/bar").should be_true end it 'stores values with #store' do value = 0 store.store("foo/bar", value).should equal(value) store["foo/bar"].should == 0 store.load("foo/bar").should == 0 end it 'stores values after clear' do store["foo/bar"] = 0 store["bar/foo/baz"] = false store.clear.should equal(store) store["foo/bar"] = 0 store["foo/bar"].should == 0 store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = 0 store.delete("foo/bar").should == 0 store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = 0 store["foo/bar"].should == 0 store["foo/bar"] = false store["foo/bar"].should == false end it 'stores frozen values' do value = 0.freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == 0 end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = 0 store["foo/bar"].should == 0 end it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = false store["bar/foo/baz"].should == false store.load("bar/foo/baz").should == false end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = false store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = false store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == false store.load("bar/foo/baz").should == false end it 'stores values after clear' do store["bar/foo/baz"] = false store["foo/bar"] = 0 store.clear.should equal(store) store["bar/foo/baz"] = false store["bar/foo/baz"].should == false store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = false store.delete("bar/foo/baz").should == false store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = false store["bar/foo/baz"].should == false store["bar/foo/baz"] = 0 store["bar/foo/baz"].should == 0 end it 'stores frozen values' do value = false.freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == false end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = false store["bar/foo/baz"].should == false end it 'writes values to keys that like a Hash' do store["foo/bar"] = false store["foo/bar"].should == false store.load("foo/bar").should == false end it 'returns true from #key? if a key is available' do store["foo/bar"] = false store.key?("foo/bar").should be_true end it 'stores values with #store' do value = false store.store("foo/bar", value).should equal(value) store["foo/bar"].should == false store.load("foo/bar").should == false end it 'stores values after clear' do store["foo/bar"] = false store["bar/foo/baz"] = 0 store.clear.should equal(store) store["foo/bar"] = false store["foo/bar"].should == false store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = false store.delete("foo/bar").should == false store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = false store["foo/bar"].should == false store["foo/bar"] = 0 store["foo/bar"].should == 0 end it 'stores frozen values' do value = false.freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == false end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = false store["foo/bar"].should == false end end #################### persist_pathkey_nilvalue #################### shared_examples_for 'persist_pathkey_nilvalue' do it 'persists values' do store["bar/foo/baz"] = '' store.close @store = nil store["bar/foo/baz"].should == '' end it 'persists values' do store["foo/bar"] = '' store.close @store = nil store["foo/bar"].should == '' end it 'persists values' do store["bar/foo/baz"] = nil store.close @store = nil store["bar/foo/baz"].should == nil end it 'persists values' do store["foo/bar"] = nil store.close @store = nil store["foo/bar"].should == nil end it 'persists values' do store["bar/foo/baz"] = 0 store.close @store = nil store["bar/foo/baz"].should == 0 end it 'persists values' do store["foo/bar"] = 0 store.close @store = nil store["foo/bar"].should == 0 end it 'persists values' do store["bar/foo/baz"] = false store.close @store = nil store["bar/foo/baz"].should == false end it 'persists values' do store["foo/bar"] = false store.close @store = nil store["foo/bar"].should == false end end #################### null_pathkey_integervalue #################### shared_examples_for 'null_pathkey_integervalue' do it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = 41 store["foo/bar"] = -12 store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", 41, options).should == 41 end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = 41 store["bar/foo/baz"] = -12 store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", 41, options).should == 41 end it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = -12 store["foo/bar"] = 41 store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", -12, options).should == -12 end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = -12 store["bar/foo/baz"] = 41 store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", -12, options).should == -12 end end #################### store_pathkey_integervalue #################### shared_examples_for 'store_pathkey_integervalue' do it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = 41 store["bar/foo/baz"].should == 41 store.load("bar/foo/baz").should == 41 end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = 41 store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = 41 store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == 41 store.load("bar/foo/baz").should == 41 end it 'stores values after clear' do store["bar/foo/baz"] = 41 store["foo/bar"] = -12 store.clear.should equal(store) store["bar/foo/baz"] = 41 store["bar/foo/baz"].should == 41 store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = 41 store.delete("bar/foo/baz").should == 41 store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = 41 store["bar/foo/baz"].should == 41 store["bar/foo/baz"] = -12 store["bar/foo/baz"].should == -12 end it 'stores frozen values' do value = 41.freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == 41 end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = 41 store["bar/foo/baz"].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store["bar/foo/baz"] = 41 store.fetch("bar/foo/baz", -12).should == 41 end it 'does not run the block in fetch if the key is available' do store["bar/foo/baz"] = 41 unaltered = 'unaltered' store.fetch("bar/foo/baz") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["foo/bar"] = 41 store["foo/bar"].should == 41 store.load("foo/bar").should == 41 end it 'returns true from #key? if a key is available' do store["foo/bar"] = 41 store.key?("foo/bar").should be_true end it 'stores values with #store' do value = 41 store.store("foo/bar", value).should equal(value) store["foo/bar"].should == 41 store.load("foo/bar").should == 41 end it 'stores values after clear' do store["foo/bar"] = 41 store["bar/foo/baz"] = -12 store.clear.should equal(store) store["foo/bar"] = 41 store["foo/bar"].should == 41 store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = 41 store.delete("foo/bar").should == 41 store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = 41 store["foo/bar"].should == 41 store["foo/bar"] = -12 store["foo/bar"].should == -12 end it 'stores frozen values' do value = 41.freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == 41 end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = 41 store["foo/bar"].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store["foo/bar"] = 41 store.fetch("foo/bar", -12).should == 41 end it 'does not run the block in fetch if the key is available' do store["foo/bar"] = 41 unaltered = 'unaltered' store.fetch("foo/bar") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = -12 store["bar/foo/baz"].should == -12 store.load("bar/foo/baz").should == -12 end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = -12 store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = -12 store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == -12 store.load("bar/foo/baz").should == -12 end it 'stores values after clear' do store["bar/foo/baz"] = -12 store["foo/bar"] = 41 store.clear.should equal(store) store["bar/foo/baz"] = -12 store["bar/foo/baz"].should == -12 store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = -12 store.delete("bar/foo/baz").should == -12 store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = -12 store["bar/foo/baz"].should == -12 store["bar/foo/baz"] = 41 store["bar/foo/baz"].should == 41 end it 'stores frozen values' do value = -12.freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == -12 end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = -12 store["bar/foo/baz"].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store["bar/foo/baz"] = -12 store.fetch("bar/foo/baz", 41).should == -12 end it 'does not run the block in fetch if the key is available' do store["bar/foo/baz"] = -12 unaltered = 'unaltered' store.fetch("bar/foo/baz") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["foo/bar"] = -12 store["foo/bar"].should == -12 store.load("foo/bar").should == -12 end it 'returns true from #key? if a key is available' do store["foo/bar"] = -12 store.key?("foo/bar").should be_true end it 'stores values with #store' do value = -12 store.store("foo/bar", value).should equal(value) store["foo/bar"].should == -12 store.load("foo/bar").should == -12 end it 'stores values after clear' do store["foo/bar"] = -12 store["bar/foo/baz"] = 41 store.clear.should equal(store) store["foo/bar"] = -12 store["foo/bar"].should == -12 store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = -12 store.delete("foo/bar").should == -12 store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = -12 store["foo/bar"].should == -12 store["foo/bar"] = 41 store["foo/bar"].should == 41 end it 'stores frozen values' do value = -12.freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == -12 end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = -12 store["foo/bar"].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store["foo/bar"] = -12 store.fetch("foo/bar", 41).should == -12 end it 'does not run the block in fetch if the key is available' do store["foo/bar"] = -12 unaltered = 'unaltered' store.fetch("foo/bar") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_pathkey_integervalue #################### shared_examples_for 'persist_pathkey_integervalue' do it 'persists values' do store["bar/foo/baz"] = 41 store.close @store = nil store["bar/foo/baz"].should == 41 end it 'persists values' do store["foo/bar"] = 41 store.close @store = nil store["foo/bar"].should == 41 end it 'persists values' do store["bar/foo/baz"] = -12 store.close @store = nil store["bar/foo/baz"].should == -12 end it 'persists values' do store["foo/bar"] = -12 store.close @store = nil store["foo/bar"].should == -12 end end #################### null_pathkey_numbervalue #################### shared_examples_for 'null_pathkey_numbervalue' do it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = 123.456 store["foo/bar"] = -98.7 store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = 123.456 store["bar/foo/baz"] = -98.7 store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = -98.7 store["foo/bar"] = 123.456 store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = -98.7 store["bar/foo/baz"] = 123.456 store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = 340282366920938463463374607431768211456 store["foo/bar"] = 33 store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = 340282366920938463463374607431768211456 store["bar/foo/baz"] = 33 store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = 33 store["foo/bar"] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", 33, options).should == 33 end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = 33 store["bar/foo/baz"] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", 33, options).should == 33 end end #################### store_pathkey_numbervalue #################### shared_examples_for 'store_pathkey_numbervalue' do it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = 123.456 store["bar/foo/baz"].should == 123.456 store.load("bar/foo/baz").should == 123.456 end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = 123.456 store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = 123.456 store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == 123.456 store.load("bar/foo/baz").should == 123.456 end it 'stores values after clear' do store["bar/foo/baz"] = 123.456 store["foo/bar"] = -98.7 store.clear.should equal(store) store["bar/foo/baz"] = 123.456 store["bar/foo/baz"].should == 123.456 store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = 123.456 store.delete("bar/foo/baz").should == 123.456 store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = 123.456 store["bar/foo/baz"].should == 123.456 store["bar/foo/baz"] = -98.7 store["bar/foo/baz"].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == 123.456 end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = 123.456 store["bar/foo/baz"].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store["bar/foo/baz"] = 123.456 store.fetch("bar/foo/baz", -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store["bar/foo/baz"] = 123.456 unaltered = 'unaltered' store.fetch("bar/foo/baz") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["foo/bar"] = 123.456 store["foo/bar"].should == 123.456 store.load("foo/bar").should == 123.456 end it 'returns true from #key? if a key is available' do store["foo/bar"] = 123.456 store.key?("foo/bar").should be_true end it 'stores values with #store' do value = 123.456 store.store("foo/bar", value).should equal(value) store["foo/bar"].should == 123.456 store.load("foo/bar").should == 123.456 end it 'stores values after clear' do store["foo/bar"] = 123.456 store["bar/foo/baz"] = -98.7 store.clear.should equal(store) store["foo/bar"] = 123.456 store["foo/bar"].should == 123.456 store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = 123.456 store.delete("foo/bar").should == 123.456 store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = 123.456 store["foo/bar"].should == 123.456 store["foo/bar"] = -98.7 store["foo/bar"].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == 123.456 end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = 123.456 store["foo/bar"].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store["foo/bar"] = 123.456 store.fetch("foo/bar", -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store["foo/bar"] = 123.456 unaltered = 'unaltered' store.fetch("foo/bar") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = -98.7 store["bar/foo/baz"].should == -98.7 store.load("bar/foo/baz").should == -98.7 end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = -98.7 store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = -98.7 store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == -98.7 store.load("bar/foo/baz").should == -98.7 end it 'stores values after clear' do store["bar/foo/baz"] = -98.7 store["foo/bar"] = 123.456 store.clear.should equal(store) store["bar/foo/baz"] = -98.7 store["bar/foo/baz"].should == -98.7 store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = -98.7 store.delete("bar/foo/baz").should == -98.7 store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = -98.7 store["bar/foo/baz"].should == -98.7 store["bar/foo/baz"] = 123.456 store["bar/foo/baz"].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == -98.7 end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = -98.7 store["bar/foo/baz"].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store["bar/foo/baz"] = -98.7 store.fetch("bar/foo/baz", 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store["bar/foo/baz"] = -98.7 unaltered = 'unaltered' store.fetch("bar/foo/baz") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["foo/bar"] = -98.7 store["foo/bar"].should == -98.7 store.load("foo/bar").should == -98.7 end it 'returns true from #key? if a key is available' do store["foo/bar"] = -98.7 store.key?("foo/bar").should be_true end it 'stores values with #store' do value = -98.7 store.store("foo/bar", value).should equal(value) store["foo/bar"].should == -98.7 store.load("foo/bar").should == -98.7 end it 'stores values after clear' do store["foo/bar"] = -98.7 store["bar/foo/baz"] = 123.456 store.clear.should equal(store) store["foo/bar"] = -98.7 store["foo/bar"].should == -98.7 store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = -98.7 store.delete("foo/bar").should == -98.7 store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = -98.7 store["foo/bar"].should == -98.7 store["foo/bar"] = 123.456 store["foo/bar"].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == -98.7 end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = -98.7 store["foo/bar"].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store["foo/bar"] = -98.7 store.fetch("foo/bar", 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store["foo/bar"] = -98.7 unaltered = 'unaltered' store.fetch("foo/bar") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = 340282366920938463463374607431768211456 store["bar/foo/baz"].should == 340282366920938463463374607431768211456 store.load("bar/foo/baz").should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = 340282366920938463463374607431768211456 store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == 340282366920938463463374607431768211456 store.load("bar/foo/baz").should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store["bar/foo/baz"] = 340282366920938463463374607431768211456 store["foo/bar"] = 33 store.clear.should equal(store) store["bar/foo/baz"] = 340282366920938463463374607431768211456 store["bar/foo/baz"].should == 340282366920938463463374607431768211456 store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = 340282366920938463463374607431768211456 store.delete("bar/foo/baz").should == 340282366920938463463374607431768211456 store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = 340282366920938463463374607431768211456 store["bar/foo/baz"].should == 340282366920938463463374607431768211456 store["bar/foo/baz"] = 33 store["bar/foo/baz"].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = 340282366920938463463374607431768211456 store["bar/foo/baz"].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store["bar/foo/baz"] = 340282366920938463463374607431768211456 store.fetch("bar/foo/baz", 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store["bar/foo/baz"] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch("bar/foo/baz") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["foo/bar"] = 340282366920938463463374607431768211456 store["foo/bar"].should == 340282366920938463463374607431768211456 store.load("foo/bar").should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store["foo/bar"] = 340282366920938463463374607431768211456 store.key?("foo/bar").should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store("foo/bar", value).should equal(value) store["foo/bar"].should == 340282366920938463463374607431768211456 store.load("foo/bar").should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store["foo/bar"] = 340282366920938463463374607431768211456 store["bar/foo/baz"] = 33 store.clear.should equal(store) store["foo/bar"] = 340282366920938463463374607431768211456 store["foo/bar"].should == 340282366920938463463374607431768211456 store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = 340282366920938463463374607431768211456 store.delete("foo/bar").should == 340282366920938463463374607431768211456 store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = 340282366920938463463374607431768211456 store["foo/bar"].should == 340282366920938463463374607431768211456 store["foo/bar"] = 33 store["foo/bar"].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = 340282366920938463463374607431768211456 store["foo/bar"].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store["foo/bar"] = 340282366920938463463374607431768211456 store.fetch("foo/bar", 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store["foo/bar"] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch("foo/bar") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = 33 store["bar/foo/baz"].should == 33 store.load("bar/foo/baz").should == 33 end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = 33 store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = 33 store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == 33 store.load("bar/foo/baz").should == 33 end it 'stores values after clear' do store["bar/foo/baz"] = 33 store["foo/bar"] = 340282366920938463463374607431768211456 store.clear.should equal(store) store["bar/foo/baz"] = 33 store["bar/foo/baz"].should == 33 store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = 33 store.delete("bar/foo/baz").should == 33 store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = 33 store["bar/foo/baz"].should == 33 store["bar/foo/baz"] = 340282366920938463463374607431768211456 store["bar/foo/baz"].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == 33 end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = 33 store["bar/foo/baz"].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store["bar/foo/baz"] = 33 store.fetch("bar/foo/baz", 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store["bar/foo/baz"] = 33 unaltered = 'unaltered' store.fetch("bar/foo/baz") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["foo/bar"] = 33 store["foo/bar"].should == 33 store.load("foo/bar").should == 33 end it 'returns true from #key? if a key is available' do store["foo/bar"] = 33 store.key?("foo/bar").should be_true end it 'stores values with #store' do value = 33 store.store("foo/bar", value).should equal(value) store["foo/bar"].should == 33 store.load("foo/bar").should == 33 end it 'stores values after clear' do store["foo/bar"] = 33 store["bar/foo/baz"] = 340282366920938463463374607431768211456 store.clear.should equal(store) store["foo/bar"] = 33 store["foo/bar"].should == 33 store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = 33 store.delete("foo/bar").should == 33 store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = 33 store["foo/bar"].should == 33 store["foo/bar"] = 340282366920938463463374607431768211456 store["foo/bar"].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == 33 end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = 33 store["foo/bar"].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store["foo/bar"] = 33 store.fetch("foo/bar", 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store["foo/bar"] = 33 unaltered = 'unaltered' store.fetch("foo/bar") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_pathkey_numbervalue #################### shared_examples_for 'persist_pathkey_numbervalue' do it 'persists values' do store["bar/foo/baz"] = 123.456 store.close @store = nil store["bar/foo/baz"].should == 123.456 end it 'persists values' do store["foo/bar"] = 123.456 store.close @store = nil store["foo/bar"].should == 123.456 end it 'persists values' do store["bar/foo/baz"] = -98.7 store.close @store = nil store["bar/foo/baz"].should == -98.7 end it 'persists values' do store["foo/bar"] = -98.7 store.close @store = nil store["foo/bar"].should == -98.7 end it 'persists values' do store["bar/foo/baz"] = 340282366920938463463374607431768211456 store.close @store = nil store["bar/foo/baz"].should == 340282366920938463463374607431768211456 end it 'persists values' do store["foo/bar"] = 340282366920938463463374607431768211456 store.close @store = nil store["foo/bar"].should == 340282366920938463463374607431768211456 end it 'persists values' do store["bar/foo/baz"] = 33 store.close @store = nil store["bar/foo/baz"].should == 33 end it 'persists values' do store["foo/bar"] = 33 store.close @store = nil store["foo/bar"].should == 33 end end #################### null_pathkey_booleanvalue #################### shared_examples_for 'null_pathkey_booleanvalue' do it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = true store["foo/bar"] = false store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", true, options).should == true end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = true store["bar/foo/baz"] = false store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", true, options).should == true end it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = false store["foo/bar"] = true store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", false, options).should == false end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = false store["bar/foo/baz"] = true store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", false, options).should == false end end #################### store_pathkey_booleanvalue #################### shared_examples_for 'store_pathkey_booleanvalue' do it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = true store["bar/foo/baz"].should == true store.load("bar/foo/baz").should == true end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = true store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = true store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == true store.load("bar/foo/baz").should == true end it 'stores values after clear' do store["bar/foo/baz"] = true store["foo/bar"] = false store.clear.should equal(store) store["bar/foo/baz"] = true store["bar/foo/baz"].should == true store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = true store.delete("bar/foo/baz").should == true store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = true store["bar/foo/baz"].should == true store["bar/foo/baz"] = false store["bar/foo/baz"].should == false end it 'stores frozen values' do value = true.freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == true end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = true store["bar/foo/baz"].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store["bar/foo/baz"] = true store.fetch("bar/foo/baz", false).should == true end it 'does not run the block in fetch if the key is available' do store["bar/foo/baz"] = true unaltered = 'unaltered' store.fetch("bar/foo/baz") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["foo/bar"] = true store["foo/bar"].should == true store.load("foo/bar").should == true end it 'returns true from #key? if a key is available' do store["foo/bar"] = true store.key?("foo/bar").should be_true end it 'stores values with #store' do value = true store.store("foo/bar", value).should equal(value) store["foo/bar"].should == true store.load("foo/bar").should == true end it 'stores values after clear' do store["foo/bar"] = true store["bar/foo/baz"] = false store.clear.should equal(store) store["foo/bar"] = true store["foo/bar"].should == true store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = true store.delete("foo/bar").should == true store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = true store["foo/bar"].should == true store["foo/bar"] = false store["foo/bar"].should == false end it 'stores frozen values' do value = true.freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == true end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = true store["foo/bar"].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store["foo/bar"] = true store.fetch("foo/bar", false).should == true end it 'does not run the block in fetch if the key is available' do store["foo/bar"] = true unaltered = 'unaltered' store.fetch("foo/bar") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = false store["bar/foo/baz"].should == false store.load("bar/foo/baz").should == false end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = false store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = false store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == false store.load("bar/foo/baz").should == false end it 'stores values after clear' do store["bar/foo/baz"] = false store["foo/bar"] = true store.clear.should equal(store) store["bar/foo/baz"] = false store["bar/foo/baz"].should == false store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = false store.delete("bar/foo/baz").should == false store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = false store["bar/foo/baz"].should == false store["bar/foo/baz"] = true store["bar/foo/baz"].should == true end it 'stores frozen values' do value = false.freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == false end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = false store["bar/foo/baz"].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store["bar/foo/baz"] = false store.fetch("bar/foo/baz", true).should == false end it 'does not run the block in fetch if the key is available' do store["bar/foo/baz"] = false unaltered = 'unaltered' store.fetch("bar/foo/baz") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["foo/bar"] = false store["foo/bar"].should == false store.load("foo/bar").should == false end it 'returns true from #key? if a key is available' do store["foo/bar"] = false store.key?("foo/bar").should be_true end it 'stores values with #store' do value = false store.store("foo/bar", value).should equal(value) store["foo/bar"].should == false store.load("foo/bar").should == false end it 'stores values after clear' do store["foo/bar"] = false store["bar/foo/baz"] = true store.clear.should equal(store) store["foo/bar"] = false store["foo/bar"].should == false store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = false store.delete("foo/bar").should == false store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = false store["foo/bar"].should == false store["foo/bar"] = true store["foo/bar"].should == true end it 'stores frozen values' do value = false.freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == false end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = false store["foo/bar"].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store["foo/bar"] = false store.fetch("foo/bar", true).should == false end it 'does not run the block in fetch if the key is available' do store["foo/bar"] = false unaltered = 'unaltered' store.fetch("foo/bar") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_pathkey_booleanvalue #################### shared_examples_for 'persist_pathkey_booleanvalue' do it 'persists values' do store["bar/foo/baz"] = true store.close @store = nil store["bar/foo/baz"].should == true end it 'persists values' do store["foo/bar"] = true store.close @store = nil store["foo/bar"].should == true end it 'persists values' do store["bar/foo/baz"] = false store.close @store = nil store["bar/foo/baz"].should == false end it 'persists values' do store["foo/bar"] = false store.close @store = nil store["foo/bar"].should == false end end #################### null_pathkey_stringvalue #################### shared_examples_for 'null_pathkey_stringvalue' do it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = "strval1" store["foo/bar"] = "strval2" store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = "strval1" store["bar/foo/baz"] = "strval2" store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = "strval2" store["foo/bar"] = "strval1" store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", "strval2", options).should == "strval2" end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = "strval2" store["bar/foo/baz"] = "strval1" store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", "strval2", options).should == "strval2" end end #################### store_pathkey_stringvalue #################### shared_examples_for 'store_pathkey_stringvalue' do it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = "strval1" store["bar/foo/baz"].should == "strval1" store.load("bar/foo/baz").should == "strval1" end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = "strval1" store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = "strval1" store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == "strval1" store.load("bar/foo/baz").should == "strval1" end it 'stores values after clear' do store["bar/foo/baz"] = "strval1" store["foo/bar"] = "strval2" store.clear.should equal(store) store["bar/foo/baz"] = "strval1" store["bar/foo/baz"].should == "strval1" store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = "strval1" store.delete("bar/foo/baz").should == "strval1" store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = "strval1" store["bar/foo/baz"].should == "strval1" store["bar/foo/baz"] = "strval2" store["bar/foo/baz"].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == "strval1" end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = "strval1" store["bar/foo/baz"].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store["bar/foo/baz"] = "strval1" store.fetch("bar/foo/baz", "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store["bar/foo/baz"] = "strval1" unaltered = 'unaltered' store.fetch("bar/foo/baz") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["foo/bar"] = "strval1" store["foo/bar"].should == "strval1" store.load("foo/bar").should == "strval1" end it 'returns true from #key? if a key is available' do store["foo/bar"] = "strval1" store.key?("foo/bar").should be_true end it 'stores values with #store' do value = "strval1" store.store("foo/bar", value).should equal(value) store["foo/bar"].should == "strval1" store.load("foo/bar").should == "strval1" end it 'stores values after clear' do store["foo/bar"] = "strval1" store["bar/foo/baz"] = "strval2" store.clear.should equal(store) store["foo/bar"] = "strval1" store["foo/bar"].should == "strval1" store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = "strval1" store.delete("foo/bar").should == "strval1" store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = "strval1" store["foo/bar"].should == "strval1" store["foo/bar"] = "strval2" store["foo/bar"].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == "strval1" end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = "strval1" store["foo/bar"].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store["foo/bar"] = "strval1" store.fetch("foo/bar", "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store["foo/bar"] = "strval1" unaltered = 'unaltered' store.fetch("foo/bar") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = "strval2" store["bar/foo/baz"].should == "strval2" store.load("bar/foo/baz").should == "strval2" end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = "strval2" store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = "strval2" store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == "strval2" store.load("bar/foo/baz").should == "strval2" end it 'stores values after clear' do store["bar/foo/baz"] = "strval2" store["foo/bar"] = "strval1" store.clear.should equal(store) store["bar/foo/baz"] = "strval2" store["bar/foo/baz"].should == "strval2" store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = "strval2" store.delete("bar/foo/baz").should == "strval2" store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = "strval2" store["bar/foo/baz"].should == "strval2" store["bar/foo/baz"] = "strval1" store["bar/foo/baz"].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == "strval2" end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = "strval2" store["bar/foo/baz"].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store["bar/foo/baz"] = "strval2" store.fetch("bar/foo/baz", "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store["bar/foo/baz"] = "strval2" unaltered = 'unaltered' store.fetch("bar/foo/baz") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["foo/bar"] = "strval2" store["foo/bar"].should == "strval2" store.load("foo/bar").should == "strval2" end it 'returns true from #key? if a key is available' do store["foo/bar"] = "strval2" store.key?("foo/bar").should be_true end it 'stores values with #store' do value = "strval2" store.store("foo/bar", value).should equal(value) store["foo/bar"].should == "strval2" store.load("foo/bar").should == "strval2" end it 'stores values after clear' do store["foo/bar"] = "strval2" store["bar/foo/baz"] = "strval1" store.clear.should equal(store) store["foo/bar"] = "strval2" store["foo/bar"].should == "strval2" store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = "strval2" store.delete("foo/bar").should == "strval2" store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = "strval2" store["foo/bar"].should == "strval2" store["foo/bar"] = "strval1" store["foo/bar"].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == "strval2" end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = "strval2" store["foo/bar"].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store["foo/bar"] = "strval2" store.fetch("foo/bar", "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store["foo/bar"] = "strval2" unaltered = 'unaltered' store.fetch("foo/bar") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_pathkey_stringvalue #################### shared_examples_for 'returndifferent_pathkey_stringvalue' do it 'guarantees that a different value is retrieved' do value = "strval1" store["bar/foo/baz"] = value store["bar/foo/baz"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval1" store["foo/bar"] = value store["foo/bar"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store["bar/foo/baz"] = value store["bar/foo/baz"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store["foo/bar"] = value store["foo/bar"].should_not be_equal(value) end end #################### returnsame_pathkey_stringvalue #################### shared_examples_for 'returnsame_pathkey_stringvalue' do it 'guarantees that the same value is retrieved' do value = "strval1" store["bar/foo/baz"] = value store["bar/foo/baz"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval1" store["foo/bar"] = value store["foo/bar"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store["bar/foo/baz"] = value store["bar/foo/baz"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store["foo/bar"] = value store["foo/bar"].should be_equal(value) end end #################### persist_pathkey_stringvalue #################### shared_examples_for 'persist_pathkey_stringvalue' do it 'persists values' do store["bar/foo/baz"] = "strval1" store.close @store = nil store["bar/foo/baz"].should == "strval1" end it 'persists values' do store["foo/bar"] = "strval1" store.close @store = nil store["foo/bar"].should == "strval1" end it 'persists values' do store["bar/foo/baz"] = "strval2" store.close @store = nil store["bar/foo/baz"].should == "strval2" end it 'persists values' do store["foo/bar"] = "strval2" store.close @store = nil store["foo/bar"].should == "strval2" end end #################### null_pathkey_binaryvalue #################### shared_examples_for 'null_pathkey_binaryvalue' do it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = "über" store["foo/bar"] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", "über", options).should == "über" end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = "über" store["bar/foo/baz"] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", "über", options).should == "über" end it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = "\xAA\xBB\xCC" store["foo/bar"] = "über" store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = "\xAA\xBB\xCC" store["bar/foo/baz"] = "über" store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end end #################### store_pathkey_binaryvalue #################### shared_examples_for 'store_pathkey_binaryvalue' do it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = "über" store["bar/foo/baz"].should == "über" store.load("bar/foo/baz").should == "über" end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = "über" store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = "über" store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == "über" store.load("bar/foo/baz").should == "über" end it 'stores values after clear' do store["bar/foo/baz"] = "über" store["foo/bar"] = "\xAA\xBB\xCC" store.clear.should equal(store) store["bar/foo/baz"] = "über" store["bar/foo/baz"].should == "über" store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = "über" store.delete("bar/foo/baz").should == "über" store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = "über" store["bar/foo/baz"].should == "über" store["bar/foo/baz"] = "\xAA\xBB\xCC" store["bar/foo/baz"].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == "über" end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = "über" store["bar/foo/baz"].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store["bar/foo/baz"] = "über" store.fetch("bar/foo/baz", "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store["bar/foo/baz"] = "über" unaltered = 'unaltered' store.fetch("bar/foo/baz") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["foo/bar"] = "über" store["foo/bar"].should == "über" store.load("foo/bar").should == "über" end it 'returns true from #key? if a key is available' do store["foo/bar"] = "über" store.key?("foo/bar").should be_true end it 'stores values with #store' do value = "über" store.store("foo/bar", value).should equal(value) store["foo/bar"].should == "über" store.load("foo/bar").should == "über" end it 'stores values after clear' do store["foo/bar"] = "über" store["bar/foo/baz"] = "\xAA\xBB\xCC" store.clear.should equal(store) store["foo/bar"] = "über" store["foo/bar"].should == "über" store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = "über" store.delete("foo/bar").should == "über" store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = "über" store["foo/bar"].should == "über" store["foo/bar"] = "\xAA\xBB\xCC" store["foo/bar"].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == "über" end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = "über" store["foo/bar"].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store["foo/bar"] = "über" store.fetch("foo/bar", "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store["foo/bar"] = "über" unaltered = 'unaltered' store.fetch("foo/bar") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = "\xAA\xBB\xCC" store["bar/foo/baz"].should == "\xAA\xBB\xCC" store.load("bar/foo/baz").should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = "\xAA\xBB\xCC" store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == "\xAA\xBB\xCC" store.load("bar/foo/baz").should == "\xAA\xBB\xCC" end it 'stores values after clear' do store["bar/foo/baz"] = "\xAA\xBB\xCC" store["foo/bar"] = "über" store.clear.should equal(store) store["bar/foo/baz"] = "\xAA\xBB\xCC" store["bar/foo/baz"].should == "\xAA\xBB\xCC" store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = "\xAA\xBB\xCC" store.delete("bar/foo/baz").should == "\xAA\xBB\xCC" store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = "\xAA\xBB\xCC" store["bar/foo/baz"].should == "\xAA\xBB\xCC" store["bar/foo/baz"] = "über" store["bar/foo/baz"].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = "\xAA\xBB\xCC" store["bar/foo/baz"].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store["bar/foo/baz"] = "\xAA\xBB\xCC" store.fetch("bar/foo/baz", "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store["bar/foo/baz"] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch("bar/foo/baz") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["foo/bar"] = "\xAA\xBB\xCC" store["foo/bar"].should == "\xAA\xBB\xCC" store.load("foo/bar").should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store["foo/bar"] = "\xAA\xBB\xCC" store.key?("foo/bar").should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store("foo/bar", value).should equal(value) store["foo/bar"].should == "\xAA\xBB\xCC" store.load("foo/bar").should == "\xAA\xBB\xCC" end it 'stores values after clear' do store["foo/bar"] = "\xAA\xBB\xCC" store["bar/foo/baz"] = "über" store.clear.should equal(store) store["foo/bar"] = "\xAA\xBB\xCC" store["foo/bar"].should == "\xAA\xBB\xCC" store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = "\xAA\xBB\xCC" store.delete("foo/bar").should == "\xAA\xBB\xCC" store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = "\xAA\xBB\xCC" store["foo/bar"].should == "\xAA\xBB\xCC" store["foo/bar"] = "über" store["foo/bar"].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = "\xAA\xBB\xCC" store["foo/bar"].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store["foo/bar"] = "\xAA\xBB\xCC" store.fetch("foo/bar", "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store["foo/bar"] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch("foo/bar") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_pathkey_binaryvalue #################### shared_examples_for 'returndifferent_pathkey_binaryvalue' do it 'guarantees that a different value is retrieved' do value = "über" store["bar/foo/baz"] = value store["bar/foo/baz"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "über" store["foo/bar"] = value store["foo/bar"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store["bar/foo/baz"] = value store["bar/foo/baz"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store["foo/bar"] = value store["foo/bar"].should_not be_equal(value) end end #################### returnsame_pathkey_binaryvalue #################### shared_examples_for 'returnsame_pathkey_binaryvalue' do it 'guarantees that the same value is retrieved' do value = "über" store["bar/foo/baz"] = value store["bar/foo/baz"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "über" store["foo/bar"] = value store["foo/bar"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store["bar/foo/baz"] = value store["bar/foo/baz"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store["foo/bar"] = value store["foo/bar"].should be_equal(value) end end #################### persist_pathkey_binaryvalue #################### shared_examples_for 'persist_pathkey_binaryvalue' do it 'persists values' do store["bar/foo/baz"] = "über" store.close @store = nil store["bar/foo/baz"].should == "über" end it 'persists values' do store["foo/bar"] = "über" store.close @store = nil store["foo/bar"].should == "über" end it 'persists values' do store["bar/foo/baz"] = "\xAA\xBB\xCC" store.close @store = nil store["bar/foo/baz"].should == "\xAA\xBB\xCC" end it 'persists values' do store["foo/bar"] = "\xAA\xBB\xCC" store.close @store = nil store["foo/bar"].should == "\xAA\xBB\xCC" end end #################### null_pathkey_hashvalue #################### shared_examples_for 'null_pathkey_hashvalue' do it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = {"hashval1"=>["array1", 1]} store["foo/bar"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = {"hashval1"=>["array1", 1]} store["bar/foo/baz"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["foo/bar"] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["bar/foo/baz"] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### store_pathkey_hashvalue #################### shared_examples_for 'store_pathkey_hashvalue' do it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = {"hashval1"=>["array1", 1]} store["bar/foo/baz"].should == {"hashval1"=>["array1", 1]} store.load("bar/foo/baz").should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = {"hashval1"=>["array1", 1]} store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == {"hashval1"=>["array1", 1]} store.load("bar/foo/baz").should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store["bar/foo/baz"] = {"hashval1"=>["array1", 1]} store["foo/bar"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store["bar/foo/baz"] = {"hashval1"=>["array1", 1]} store["bar/foo/baz"].should == {"hashval1"=>["array1", 1]} store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = {"hashval1"=>["array1", 1]} store.delete("bar/foo/baz").should == {"hashval1"=>["array1", 1]} store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = {"hashval1"=>["array1", 1]} store["bar/foo/baz"].should == {"hashval1"=>["array1", 1]} store["bar/foo/baz"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["bar/foo/baz"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = {"hashval1"=>["array1", 1]} store["bar/foo/baz"].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store["bar/foo/baz"] = {"hashval1"=>["array1", 1]} store.fetch("bar/foo/baz", {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store["bar/foo/baz"] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch("bar/foo/baz") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["foo/bar"] = {"hashval1"=>["array1", 1]} store["foo/bar"].should == {"hashval1"=>["array1", 1]} store.load("foo/bar").should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store["foo/bar"] = {"hashval1"=>["array1", 1]} store.key?("foo/bar").should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store("foo/bar", value).should equal(value) store["foo/bar"].should == {"hashval1"=>["array1", 1]} store.load("foo/bar").should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store["foo/bar"] = {"hashval1"=>["array1", 1]} store["bar/foo/baz"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store["foo/bar"] = {"hashval1"=>["array1", 1]} store["foo/bar"].should == {"hashval1"=>["array1", 1]} store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = {"hashval1"=>["array1", 1]} store.delete("foo/bar").should == {"hashval1"=>["array1", 1]} store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = {"hashval1"=>["array1", 1]} store["foo/bar"].should == {"hashval1"=>["array1", 1]} store["foo/bar"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["foo/bar"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = {"hashval1"=>["array1", 1]} store["foo/bar"].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store["foo/bar"] = {"hashval1"=>["array1", 1]} store.fetch("foo/bar", {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store["foo/bar"] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch("foo/bar") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["bar/foo/baz"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load("bar/foo/baz").should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load("bar/foo/baz").should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store["bar/foo/baz"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["foo/bar"] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store["bar/foo/baz"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["bar/foo/baz"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete("bar/foo/baz").should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["bar/foo/baz"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store["bar/foo/baz"] = {"hashval1"=>["array1", 1]} store["bar/foo/baz"].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["bar/foo/baz"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store["bar/foo/baz"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch("bar/foo/baz", {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store["bar/foo/baz"] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch("bar/foo/baz") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["foo/bar"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["foo/bar"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load("foo/bar").should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store["foo/bar"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?("foo/bar").should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store("foo/bar", value).should equal(value) store["foo/bar"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load("foo/bar").should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store["foo/bar"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["bar/foo/baz"] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store["foo/bar"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["foo/bar"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete("foo/bar").should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["foo/bar"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store["foo/bar"] = {"hashval1"=>["array1", 1]} store["foo/bar"].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["foo/bar"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store["foo/bar"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch("foo/bar", {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store["foo/bar"] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch("foo/bar") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_pathkey_hashvalue #################### shared_examples_for 'returndifferent_pathkey_hashvalue' do it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store["bar/foo/baz"] = value store["bar/foo/baz"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store["foo/bar"] = value store["foo/bar"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store["bar/foo/baz"] = value store["bar/foo/baz"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store["foo/bar"] = value store["foo/bar"].should_not be_equal(value) end end #################### returnsame_pathkey_hashvalue #################### shared_examples_for 'returnsame_pathkey_hashvalue' do it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store["bar/foo/baz"] = value store["bar/foo/baz"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store["foo/bar"] = value store["foo/bar"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store["bar/foo/baz"] = value store["bar/foo/baz"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store["foo/bar"] = value store["foo/bar"].should be_equal(value) end end #################### persist_pathkey_hashvalue #################### shared_examples_for 'persist_pathkey_hashvalue' do it 'persists values' do store["bar/foo/baz"] = {"hashval1"=>["array1", 1]} store.close @store = nil store["bar/foo/baz"].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store["foo/bar"] = {"hashval1"=>["array1", 1]} store.close @store = nil store["foo/bar"].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store["bar/foo/baz"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store["bar/foo/baz"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'persists values' do store["foo/bar"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store["foo/bar"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### null_pathkey_objectvalue #################### shared_examples_for 'null_pathkey_objectvalue' do it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = Value.new(:objval1) store["foo/bar"] = Value.new(:objval2) store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = Value.new(:objval1) store["bar/foo/baz"] = Value.new(:objval2) store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store["bar/foo/baz"].should be_nil store.load("bar/foo/baz").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store["bar/foo/baz"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("bar/foo/baz").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("bar/foo/baz").should be_nil end it 'removes all keys from the store with clear' do store["bar/foo/baz"] = Value.new(:objval2) store["foo/bar"] = Value.new(:objval1) store.clear.should equal(store) store.key?("bar/foo/baz").should be_false store.key?("foo/bar").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("bar/foo/baz", Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = "bar/foo/baz" value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("bar/foo/baz", options).should be_false store.load("bar/foo/baz", options).should be_nil store.fetch("bar/foo/baz", 42, options).should == 42 store.fetch("bar/foo/baz", options) { 42 }.should == 42 store.delete("bar/foo/baz", options).should be_nil store.clear(options).should equal(store) store.store("bar/foo/baz", Value.new(:objval2), options).should == Value.new(:objval2) end it 'reads from keys like a Hash' do store["foo/bar"].should be_nil store.load("foo/bar").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store["foo/bar"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("foo/bar").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("foo/bar").should be_nil end it 'removes all keys from the store with clear' do store["foo/bar"] = Value.new(:objval2) store["bar/foo/baz"] = Value.new(:objval1) store.clear.should equal(store) store.key?("foo/bar").should be_false store.key?("bar/foo/baz").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("foo/bar", Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = "foo/bar" value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("foo/bar", options).should be_false store.load("foo/bar", options).should be_nil store.fetch("foo/bar", 42, options).should == 42 store.fetch("foo/bar", options) { 42 }.should == 42 store.delete("foo/bar", options).should be_nil store.clear(options).should equal(store) store.store("foo/bar", Value.new(:objval2), options).should == Value.new(:objval2) end end #################### store_pathkey_objectvalue #################### shared_examples_for 'store_pathkey_objectvalue' do it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = Value.new(:objval1) store["bar/foo/baz"].should == Value.new(:objval1) store.load("bar/foo/baz").should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = Value.new(:objval1) store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == Value.new(:objval1) store.load("bar/foo/baz").should == Value.new(:objval1) end it 'stores values after clear' do store["bar/foo/baz"] = Value.new(:objval1) store["foo/bar"] = Value.new(:objval2) store.clear.should equal(store) store["bar/foo/baz"] = Value.new(:objval1) store["bar/foo/baz"].should == Value.new(:objval1) store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = Value.new(:objval1) store.delete("bar/foo/baz").should == Value.new(:objval1) store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = Value.new(:objval1) store["bar/foo/baz"].should == Value.new(:objval1) store["bar/foo/baz"] = Value.new(:objval2) store["bar/foo/baz"].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == Value.new(:objval1) end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = Value.new(:objval1) store["bar/foo/baz"].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store["bar/foo/baz"] = Value.new(:objval1) store.fetch("bar/foo/baz", Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store["bar/foo/baz"] = Value.new(:objval1) unaltered = 'unaltered' store.fetch("bar/foo/baz") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["foo/bar"] = Value.new(:objval1) store["foo/bar"].should == Value.new(:objval1) store.load("foo/bar").should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store["foo/bar"] = Value.new(:objval1) store.key?("foo/bar").should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store("foo/bar", value).should equal(value) store["foo/bar"].should == Value.new(:objval1) store.load("foo/bar").should == Value.new(:objval1) end it 'stores values after clear' do store["foo/bar"] = Value.new(:objval1) store["bar/foo/baz"] = Value.new(:objval2) store.clear.should equal(store) store["foo/bar"] = Value.new(:objval1) store["foo/bar"].should == Value.new(:objval1) store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = Value.new(:objval1) store.delete("foo/bar").should == Value.new(:objval1) store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = Value.new(:objval1) store["foo/bar"].should == Value.new(:objval1) store["foo/bar"] = Value.new(:objval2) store["foo/bar"].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == Value.new(:objval1) end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = Value.new(:objval1) store["foo/bar"].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store["foo/bar"] = Value.new(:objval1) store.fetch("foo/bar", Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store["foo/bar"] = Value.new(:objval1) unaltered = 'unaltered' store.fetch("foo/bar") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["bar/foo/baz"] = Value.new(:objval2) store["bar/foo/baz"].should == Value.new(:objval2) store.load("bar/foo/baz").should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store["bar/foo/baz"] = Value.new(:objval2) store.key?("bar/foo/baz").should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store("bar/foo/baz", value).should equal(value) store["bar/foo/baz"].should == Value.new(:objval2) store.load("bar/foo/baz").should == Value.new(:objval2) end it 'stores values after clear' do store["bar/foo/baz"] = Value.new(:objval2) store["foo/bar"] = Value.new(:objval1) store.clear.should equal(store) store["bar/foo/baz"] = Value.new(:objval2) store["bar/foo/baz"].should == Value.new(:objval2) store["foo/bar"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["bar/foo/baz"] = Value.new(:objval2) store.delete("bar/foo/baz").should == Value.new(:objval2) store.key?("bar/foo/baz").should be_false end it 'overwrites existing values' do store["bar/foo/baz"] = Value.new(:objval2) store["bar/foo/baz"].should == Value.new(:objval2) store["bar/foo/baz"] = Value.new(:objval1) store["bar/foo/baz"].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store["bar/foo/baz"] = value).should equal(value) store["bar/foo/baz"].should == Value.new(:objval2) end it 'stores frozen keys' do key = "bar/foo/baz".freeze store[key] = Value.new(:objval2) store["bar/foo/baz"].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store["bar/foo/baz"] = Value.new(:objval2) store.fetch("bar/foo/baz", Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store["bar/foo/baz"] = Value.new(:objval2) unaltered = 'unaltered' store.fetch("bar/foo/baz") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["foo/bar"] = Value.new(:objval2) store["foo/bar"].should == Value.new(:objval2) store.load("foo/bar").should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store["foo/bar"] = Value.new(:objval2) store.key?("foo/bar").should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store("foo/bar", value).should equal(value) store["foo/bar"].should == Value.new(:objval2) store.load("foo/bar").should == Value.new(:objval2) end it 'stores values after clear' do store["foo/bar"] = Value.new(:objval2) store["bar/foo/baz"] = Value.new(:objval1) store.clear.should equal(store) store["foo/bar"] = Value.new(:objval2) store["foo/bar"].should == Value.new(:objval2) store["bar/foo/baz"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["foo/bar"] = Value.new(:objval2) store.delete("foo/bar").should == Value.new(:objval2) store.key?("foo/bar").should be_false end it 'overwrites existing values' do store["foo/bar"] = Value.new(:objval2) store["foo/bar"].should == Value.new(:objval2) store["foo/bar"] = Value.new(:objval1) store["foo/bar"].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store["foo/bar"] = value).should equal(value) store["foo/bar"].should == Value.new(:objval2) end it 'stores frozen keys' do key = "foo/bar".freeze store[key] = Value.new(:objval2) store["foo/bar"].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store["foo/bar"] = Value.new(:objval2) store.fetch("foo/bar", Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store["foo/bar"] = Value.new(:objval2) unaltered = 'unaltered' store.fetch("foo/bar") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_pathkey_objectvalue #################### shared_examples_for 'returndifferent_pathkey_objectvalue' do it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store["bar/foo/baz"] = value store["bar/foo/baz"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store["foo/bar"] = value store["foo/bar"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store["bar/foo/baz"] = value store["bar/foo/baz"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store["foo/bar"] = value store["foo/bar"].should_not be_equal(value) end end #################### returnsame_pathkey_objectvalue #################### shared_examples_for 'returnsame_pathkey_objectvalue' do it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store["bar/foo/baz"] = value store["bar/foo/baz"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store["foo/bar"] = value store["foo/bar"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store["bar/foo/baz"] = value store["bar/foo/baz"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store["foo/bar"] = value store["foo/bar"].should be_equal(value) end end #################### persist_pathkey_objectvalue #################### shared_examples_for 'persist_pathkey_objectvalue' do it 'persists values' do store["bar/foo/baz"] = Value.new(:objval1) store.close @store = nil store["bar/foo/baz"].should == Value.new(:objval1) end it 'persists values' do store["foo/bar"] = Value.new(:objval1) store.close @store = nil store["foo/bar"].should == Value.new(:objval1) end it 'persists values' do store["bar/foo/baz"] = Value.new(:objval2) store.close @store = nil store["bar/foo/baz"].should == Value.new(:objval2) end it 'persists values' do store["foo/bar"] = Value.new(:objval2) store.close @store = nil store["foo/bar"].should == Value.new(:objval2) end end #################### null_binarykey_nilvalue #################### shared_examples_for 'null_binarykey_nilvalue' do it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = '' store["\xAA\xBB\xCC"] = nil store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", '', options).should == '' end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = '' store["über"] = nil store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", '', options).should == '' end it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = nil store["\xAA\xBB\xCC"] = '' store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", nil, options).should == nil end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = nil store["über"] = '' store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", nil, options).should == nil end it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = 0 store["\xAA\xBB\xCC"] = false store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", 0, options).should == 0 end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = 0 store["über"] = false store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", 0, options).should == 0 end it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = false store["\xAA\xBB\xCC"] = 0 store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", false, options).should == false end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = false store["über"] = 0 store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", false, options).should == false end end #################### store_binarykey_nilvalue #################### shared_examples_for 'store_binarykey_nilvalue' do it 'writes values to keys that like a Hash' do store["über"] = '' store["über"].should == '' store.load("über").should == '' end it 'returns true from #key? if a key is available' do store["über"] = '' store.key?("über").should be_true end it 'stores values with #store' do value = '' store.store("über", value).should equal(value) store["über"].should == '' store.load("über").should == '' end it 'stores values after clear' do store["über"] = '' store["\xAA\xBB\xCC"] = nil store.clear.should equal(store) store["über"] = '' store["über"].should == '' store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = '' store.delete("über").should == '' store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = '' store["über"].should == '' store["über"] = nil store["über"].should == nil end it 'stores frozen values' do value = ''.freeze (store["über"] = value).should equal(value) store["über"].should == '' end it 'stores frozen keys' do key = "über".freeze store[key] = '' store["über"].should == '' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = '' store["\xAA\xBB\xCC"].should == '' store.load("\xAA\xBB\xCC").should == '' end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = '' store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = '' store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == '' store.load("\xAA\xBB\xCC").should == '' end it 'stores values after clear' do store["\xAA\xBB\xCC"] = '' store["über"] = nil store.clear.should equal(store) store["\xAA\xBB\xCC"] = '' store["\xAA\xBB\xCC"].should == '' store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = '' store.delete("\xAA\xBB\xCC").should == '' store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = '' store["\xAA\xBB\xCC"].should == '' store["\xAA\xBB\xCC"] = nil store["\xAA\xBB\xCC"].should == nil end it 'stores frozen values' do value = ''.freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == '' end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = '' store["\xAA\xBB\xCC"].should == '' end it 'writes values to keys that like a Hash' do store["über"] = nil store["über"].should == nil store.load("über").should == nil end it 'returns true from #key? if a key is available' do store["über"] = nil store.key?("über").should be_true end it 'stores values with #store' do value = nil store.store("über", value).should equal(value) store["über"].should == nil store.load("über").should == nil end it 'stores values after clear' do store["über"] = nil store["\xAA\xBB\xCC"] = '' store.clear.should equal(store) store["über"] = nil store["über"].should == nil store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = nil store.delete("über").should == nil store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = nil store["über"].should == nil store["über"] = '' store["über"].should == '' end it 'stores frozen values' do value = nil.freeze (store["über"] = value).should equal(value) store["über"].should == nil end it 'stores frozen keys' do key = "über".freeze store[key] = nil store["über"].should == nil end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = nil store["\xAA\xBB\xCC"].should == nil store.load("\xAA\xBB\xCC").should == nil end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = nil store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = nil store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == nil store.load("\xAA\xBB\xCC").should == nil end it 'stores values after clear' do store["\xAA\xBB\xCC"] = nil store["über"] = '' store.clear.should equal(store) store["\xAA\xBB\xCC"] = nil store["\xAA\xBB\xCC"].should == nil store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = nil store.delete("\xAA\xBB\xCC").should == nil store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = nil store["\xAA\xBB\xCC"].should == nil store["\xAA\xBB\xCC"] = '' store["\xAA\xBB\xCC"].should == '' end it 'stores frozen values' do value = nil.freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == nil end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = nil store["\xAA\xBB\xCC"].should == nil end it 'writes values to keys that like a Hash' do store["über"] = 0 store["über"].should == 0 store.load("über").should == 0 end it 'returns true from #key? if a key is available' do store["über"] = 0 store.key?("über").should be_true end it 'stores values with #store' do value = 0 store.store("über", value).should equal(value) store["über"].should == 0 store.load("über").should == 0 end it 'stores values after clear' do store["über"] = 0 store["\xAA\xBB\xCC"] = false store.clear.should equal(store) store["über"] = 0 store["über"].should == 0 store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = 0 store.delete("über").should == 0 store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = 0 store["über"].should == 0 store["über"] = false store["über"].should == false end it 'stores frozen values' do value = 0.freeze (store["über"] = value).should equal(value) store["über"].should == 0 end it 'stores frozen keys' do key = "über".freeze store[key] = 0 store["über"].should == 0 end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = 0 store["\xAA\xBB\xCC"].should == 0 store.load("\xAA\xBB\xCC").should == 0 end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = 0 store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = 0 store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == 0 store.load("\xAA\xBB\xCC").should == 0 end it 'stores values after clear' do store["\xAA\xBB\xCC"] = 0 store["über"] = false store.clear.should equal(store) store["\xAA\xBB\xCC"] = 0 store["\xAA\xBB\xCC"].should == 0 store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = 0 store.delete("\xAA\xBB\xCC").should == 0 store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = 0 store["\xAA\xBB\xCC"].should == 0 store["\xAA\xBB\xCC"] = false store["\xAA\xBB\xCC"].should == false end it 'stores frozen values' do value = 0.freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == 0 end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = 0 store["\xAA\xBB\xCC"].should == 0 end it 'writes values to keys that like a Hash' do store["über"] = false store["über"].should == false store.load("über").should == false end it 'returns true from #key? if a key is available' do store["über"] = false store.key?("über").should be_true end it 'stores values with #store' do value = false store.store("über", value).should equal(value) store["über"].should == false store.load("über").should == false end it 'stores values after clear' do store["über"] = false store["\xAA\xBB\xCC"] = 0 store.clear.should equal(store) store["über"] = false store["über"].should == false store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = false store.delete("über").should == false store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = false store["über"].should == false store["über"] = 0 store["über"].should == 0 end it 'stores frozen values' do value = false.freeze (store["über"] = value).should equal(value) store["über"].should == false end it 'stores frozen keys' do key = "über".freeze store[key] = false store["über"].should == false end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = false store["\xAA\xBB\xCC"].should == false store.load("\xAA\xBB\xCC").should == false end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = false store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = false store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == false store.load("\xAA\xBB\xCC").should == false end it 'stores values after clear' do store["\xAA\xBB\xCC"] = false store["über"] = 0 store.clear.should equal(store) store["\xAA\xBB\xCC"] = false store["\xAA\xBB\xCC"].should == false store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = false store.delete("\xAA\xBB\xCC").should == false store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = false store["\xAA\xBB\xCC"].should == false store["\xAA\xBB\xCC"] = 0 store["\xAA\xBB\xCC"].should == 0 end it 'stores frozen values' do value = false.freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == false end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = false store["\xAA\xBB\xCC"].should == false end end #################### persist_binarykey_nilvalue #################### shared_examples_for 'persist_binarykey_nilvalue' do it 'persists values' do store["über"] = '' store.close @store = nil store["über"].should == '' end it 'persists values' do store["\xAA\xBB\xCC"] = '' store.close @store = nil store["\xAA\xBB\xCC"].should == '' end it 'persists values' do store["über"] = nil store.close @store = nil store["über"].should == nil end it 'persists values' do store["\xAA\xBB\xCC"] = nil store.close @store = nil store["\xAA\xBB\xCC"].should == nil end it 'persists values' do store["über"] = 0 store.close @store = nil store["über"].should == 0 end it 'persists values' do store["\xAA\xBB\xCC"] = 0 store.close @store = nil store["\xAA\xBB\xCC"].should == 0 end it 'persists values' do store["über"] = false store.close @store = nil store["über"].should == false end it 'persists values' do store["\xAA\xBB\xCC"] = false store.close @store = nil store["\xAA\xBB\xCC"].should == false end end #################### null_binarykey_integervalue #################### shared_examples_for 'null_binarykey_integervalue' do it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = 41 store["\xAA\xBB\xCC"] = -12 store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", 41, options).should == 41 end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = 41 store["über"] = -12 store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", 41, options).should == 41 end it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = -12 store["\xAA\xBB\xCC"] = 41 store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", -12, options).should == -12 end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = -12 store["über"] = 41 store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", -12, options).should == -12 end end #################### store_binarykey_integervalue #################### shared_examples_for 'store_binarykey_integervalue' do it 'writes values to keys that like a Hash' do store["über"] = 41 store["über"].should == 41 store.load("über").should == 41 end it 'returns true from #key? if a key is available' do store["über"] = 41 store.key?("über").should be_true end it 'stores values with #store' do value = 41 store.store("über", value).should equal(value) store["über"].should == 41 store.load("über").should == 41 end it 'stores values after clear' do store["über"] = 41 store["\xAA\xBB\xCC"] = -12 store.clear.should equal(store) store["über"] = 41 store["über"].should == 41 store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = 41 store.delete("über").should == 41 store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = 41 store["über"].should == 41 store["über"] = -12 store["über"].should == -12 end it 'stores frozen values' do value = 41.freeze (store["über"] = value).should equal(value) store["über"].should == 41 end it 'stores frozen keys' do key = "über".freeze store[key] = 41 store["über"].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store["über"] = 41 store.fetch("über", -12).should == 41 end it 'does not run the block in fetch if the key is available' do store["über"] = 41 unaltered = 'unaltered' store.fetch("über") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = 41 store["\xAA\xBB\xCC"].should == 41 store.load("\xAA\xBB\xCC").should == 41 end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = 41 store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = 41 store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == 41 store.load("\xAA\xBB\xCC").should == 41 end it 'stores values after clear' do store["\xAA\xBB\xCC"] = 41 store["über"] = -12 store.clear.should equal(store) store["\xAA\xBB\xCC"] = 41 store["\xAA\xBB\xCC"].should == 41 store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = 41 store.delete("\xAA\xBB\xCC").should == 41 store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = 41 store["\xAA\xBB\xCC"].should == 41 store["\xAA\xBB\xCC"] = -12 store["\xAA\xBB\xCC"].should == -12 end it 'stores frozen values' do value = 41.freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == 41 end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = 41 store["\xAA\xBB\xCC"].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store["\xAA\xBB\xCC"] = 41 store.fetch("\xAA\xBB\xCC", -12).should == 41 end it 'does not run the block in fetch if the key is available' do store["\xAA\xBB\xCC"] = 41 unaltered = 'unaltered' store.fetch("\xAA\xBB\xCC") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["über"] = -12 store["über"].should == -12 store.load("über").should == -12 end it 'returns true from #key? if a key is available' do store["über"] = -12 store.key?("über").should be_true end it 'stores values with #store' do value = -12 store.store("über", value).should equal(value) store["über"].should == -12 store.load("über").should == -12 end it 'stores values after clear' do store["über"] = -12 store["\xAA\xBB\xCC"] = 41 store.clear.should equal(store) store["über"] = -12 store["über"].should == -12 store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = -12 store.delete("über").should == -12 store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = -12 store["über"].should == -12 store["über"] = 41 store["über"].should == 41 end it 'stores frozen values' do value = -12.freeze (store["über"] = value).should equal(value) store["über"].should == -12 end it 'stores frozen keys' do key = "über".freeze store[key] = -12 store["über"].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store["über"] = -12 store.fetch("über", 41).should == -12 end it 'does not run the block in fetch if the key is available' do store["über"] = -12 unaltered = 'unaltered' store.fetch("über") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = -12 store["\xAA\xBB\xCC"].should == -12 store.load("\xAA\xBB\xCC").should == -12 end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = -12 store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = -12 store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == -12 store.load("\xAA\xBB\xCC").should == -12 end it 'stores values after clear' do store["\xAA\xBB\xCC"] = -12 store["über"] = 41 store.clear.should equal(store) store["\xAA\xBB\xCC"] = -12 store["\xAA\xBB\xCC"].should == -12 store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = -12 store.delete("\xAA\xBB\xCC").should == -12 store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = -12 store["\xAA\xBB\xCC"].should == -12 store["\xAA\xBB\xCC"] = 41 store["\xAA\xBB\xCC"].should == 41 end it 'stores frozen values' do value = -12.freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == -12 end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = -12 store["\xAA\xBB\xCC"].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store["\xAA\xBB\xCC"] = -12 store.fetch("\xAA\xBB\xCC", 41).should == -12 end it 'does not run the block in fetch if the key is available' do store["\xAA\xBB\xCC"] = -12 unaltered = 'unaltered' store.fetch("\xAA\xBB\xCC") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_binarykey_integervalue #################### shared_examples_for 'persist_binarykey_integervalue' do it 'persists values' do store["über"] = 41 store.close @store = nil store["über"].should == 41 end it 'persists values' do store["\xAA\xBB\xCC"] = 41 store.close @store = nil store["\xAA\xBB\xCC"].should == 41 end it 'persists values' do store["über"] = -12 store.close @store = nil store["über"].should == -12 end it 'persists values' do store["\xAA\xBB\xCC"] = -12 store.close @store = nil store["\xAA\xBB\xCC"].should == -12 end end #################### null_binarykey_numbervalue #################### shared_examples_for 'null_binarykey_numbervalue' do it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = 123.456 store["\xAA\xBB\xCC"] = -98.7 store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = 123.456 store["über"] = -98.7 store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = -98.7 store["\xAA\xBB\xCC"] = 123.456 store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = -98.7 store["über"] = 123.456 store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = 340282366920938463463374607431768211456 store["\xAA\xBB\xCC"] = 33 store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = 340282366920938463463374607431768211456 store["über"] = 33 store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = 33 store["\xAA\xBB\xCC"] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", 33, options).should == 33 end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = 33 store["über"] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", 33, options).should == 33 end end #################### store_binarykey_numbervalue #################### shared_examples_for 'store_binarykey_numbervalue' do it 'writes values to keys that like a Hash' do store["über"] = 123.456 store["über"].should == 123.456 store.load("über").should == 123.456 end it 'returns true from #key? if a key is available' do store["über"] = 123.456 store.key?("über").should be_true end it 'stores values with #store' do value = 123.456 store.store("über", value).should equal(value) store["über"].should == 123.456 store.load("über").should == 123.456 end it 'stores values after clear' do store["über"] = 123.456 store["\xAA\xBB\xCC"] = -98.7 store.clear.should equal(store) store["über"] = 123.456 store["über"].should == 123.456 store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = 123.456 store.delete("über").should == 123.456 store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = 123.456 store["über"].should == 123.456 store["über"] = -98.7 store["über"].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store["über"] = value).should equal(value) store["über"].should == 123.456 end it 'stores frozen keys' do key = "über".freeze store[key] = 123.456 store["über"].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store["über"] = 123.456 store.fetch("über", -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store["über"] = 123.456 unaltered = 'unaltered' store.fetch("über") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = 123.456 store["\xAA\xBB\xCC"].should == 123.456 store.load("\xAA\xBB\xCC").should == 123.456 end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = 123.456 store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = 123.456 store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == 123.456 store.load("\xAA\xBB\xCC").should == 123.456 end it 'stores values after clear' do store["\xAA\xBB\xCC"] = 123.456 store["über"] = -98.7 store.clear.should equal(store) store["\xAA\xBB\xCC"] = 123.456 store["\xAA\xBB\xCC"].should == 123.456 store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = 123.456 store.delete("\xAA\xBB\xCC").should == 123.456 store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = 123.456 store["\xAA\xBB\xCC"].should == 123.456 store["\xAA\xBB\xCC"] = -98.7 store["\xAA\xBB\xCC"].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == 123.456 end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = 123.456 store["\xAA\xBB\xCC"].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store["\xAA\xBB\xCC"] = 123.456 store.fetch("\xAA\xBB\xCC", -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store["\xAA\xBB\xCC"] = 123.456 unaltered = 'unaltered' store.fetch("\xAA\xBB\xCC") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["über"] = -98.7 store["über"].should == -98.7 store.load("über").should == -98.7 end it 'returns true from #key? if a key is available' do store["über"] = -98.7 store.key?("über").should be_true end it 'stores values with #store' do value = -98.7 store.store("über", value).should equal(value) store["über"].should == -98.7 store.load("über").should == -98.7 end it 'stores values after clear' do store["über"] = -98.7 store["\xAA\xBB\xCC"] = 123.456 store.clear.should equal(store) store["über"] = -98.7 store["über"].should == -98.7 store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = -98.7 store.delete("über").should == -98.7 store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = -98.7 store["über"].should == -98.7 store["über"] = 123.456 store["über"].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store["über"] = value).should equal(value) store["über"].should == -98.7 end it 'stores frozen keys' do key = "über".freeze store[key] = -98.7 store["über"].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store["über"] = -98.7 store.fetch("über", 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store["über"] = -98.7 unaltered = 'unaltered' store.fetch("über") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = -98.7 store["\xAA\xBB\xCC"].should == -98.7 store.load("\xAA\xBB\xCC").should == -98.7 end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = -98.7 store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = -98.7 store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == -98.7 store.load("\xAA\xBB\xCC").should == -98.7 end it 'stores values after clear' do store["\xAA\xBB\xCC"] = -98.7 store["über"] = 123.456 store.clear.should equal(store) store["\xAA\xBB\xCC"] = -98.7 store["\xAA\xBB\xCC"].should == -98.7 store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = -98.7 store.delete("\xAA\xBB\xCC").should == -98.7 store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = -98.7 store["\xAA\xBB\xCC"].should == -98.7 store["\xAA\xBB\xCC"] = 123.456 store["\xAA\xBB\xCC"].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == -98.7 end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = -98.7 store["\xAA\xBB\xCC"].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store["\xAA\xBB\xCC"] = -98.7 store.fetch("\xAA\xBB\xCC", 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store["\xAA\xBB\xCC"] = -98.7 unaltered = 'unaltered' store.fetch("\xAA\xBB\xCC") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["über"] = 340282366920938463463374607431768211456 store["über"].should == 340282366920938463463374607431768211456 store.load("über").should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store["über"] = 340282366920938463463374607431768211456 store.key?("über").should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store("über", value).should equal(value) store["über"].should == 340282366920938463463374607431768211456 store.load("über").should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store["über"] = 340282366920938463463374607431768211456 store["\xAA\xBB\xCC"] = 33 store.clear.should equal(store) store["über"] = 340282366920938463463374607431768211456 store["über"].should == 340282366920938463463374607431768211456 store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = 340282366920938463463374607431768211456 store.delete("über").should == 340282366920938463463374607431768211456 store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = 340282366920938463463374607431768211456 store["über"].should == 340282366920938463463374607431768211456 store["über"] = 33 store["über"].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store["über"] = value).should equal(value) store["über"].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = "über".freeze store[key] = 340282366920938463463374607431768211456 store["über"].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store["über"] = 340282366920938463463374607431768211456 store.fetch("über", 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store["über"] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch("über") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = 340282366920938463463374607431768211456 store["\xAA\xBB\xCC"].should == 340282366920938463463374607431768211456 store.load("\xAA\xBB\xCC").should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = 340282366920938463463374607431768211456 store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == 340282366920938463463374607431768211456 store.load("\xAA\xBB\xCC").should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store["\xAA\xBB\xCC"] = 340282366920938463463374607431768211456 store["über"] = 33 store.clear.should equal(store) store["\xAA\xBB\xCC"] = 340282366920938463463374607431768211456 store["\xAA\xBB\xCC"].should == 340282366920938463463374607431768211456 store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = 340282366920938463463374607431768211456 store.delete("\xAA\xBB\xCC").should == 340282366920938463463374607431768211456 store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = 340282366920938463463374607431768211456 store["\xAA\xBB\xCC"].should == 340282366920938463463374607431768211456 store["\xAA\xBB\xCC"] = 33 store["\xAA\xBB\xCC"].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = 340282366920938463463374607431768211456 store["\xAA\xBB\xCC"].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store["\xAA\xBB\xCC"] = 340282366920938463463374607431768211456 store.fetch("\xAA\xBB\xCC", 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store["\xAA\xBB\xCC"] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch("\xAA\xBB\xCC") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["über"] = 33 store["über"].should == 33 store.load("über").should == 33 end it 'returns true from #key? if a key is available' do store["über"] = 33 store.key?("über").should be_true end it 'stores values with #store' do value = 33 store.store("über", value).should equal(value) store["über"].should == 33 store.load("über").should == 33 end it 'stores values after clear' do store["über"] = 33 store["\xAA\xBB\xCC"] = 340282366920938463463374607431768211456 store.clear.should equal(store) store["über"] = 33 store["über"].should == 33 store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = 33 store.delete("über").should == 33 store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = 33 store["über"].should == 33 store["über"] = 340282366920938463463374607431768211456 store["über"].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store["über"] = value).should equal(value) store["über"].should == 33 end it 'stores frozen keys' do key = "über".freeze store[key] = 33 store["über"].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store["über"] = 33 store.fetch("über", 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store["über"] = 33 unaltered = 'unaltered' store.fetch("über") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = 33 store["\xAA\xBB\xCC"].should == 33 store.load("\xAA\xBB\xCC").should == 33 end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = 33 store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = 33 store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == 33 store.load("\xAA\xBB\xCC").should == 33 end it 'stores values after clear' do store["\xAA\xBB\xCC"] = 33 store["über"] = 340282366920938463463374607431768211456 store.clear.should equal(store) store["\xAA\xBB\xCC"] = 33 store["\xAA\xBB\xCC"].should == 33 store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = 33 store.delete("\xAA\xBB\xCC").should == 33 store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = 33 store["\xAA\xBB\xCC"].should == 33 store["\xAA\xBB\xCC"] = 340282366920938463463374607431768211456 store["\xAA\xBB\xCC"].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == 33 end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = 33 store["\xAA\xBB\xCC"].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store["\xAA\xBB\xCC"] = 33 store.fetch("\xAA\xBB\xCC", 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store["\xAA\xBB\xCC"] = 33 unaltered = 'unaltered' store.fetch("\xAA\xBB\xCC") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_binarykey_numbervalue #################### shared_examples_for 'persist_binarykey_numbervalue' do it 'persists values' do store["über"] = 123.456 store.close @store = nil store["über"].should == 123.456 end it 'persists values' do store["\xAA\xBB\xCC"] = 123.456 store.close @store = nil store["\xAA\xBB\xCC"].should == 123.456 end it 'persists values' do store["über"] = -98.7 store.close @store = nil store["über"].should == -98.7 end it 'persists values' do store["\xAA\xBB\xCC"] = -98.7 store.close @store = nil store["\xAA\xBB\xCC"].should == -98.7 end it 'persists values' do store["über"] = 340282366920938463463374607431768211456 store.close @store = nil store["über"].should == 340282366920938463463374607431768211456 end it 'persists values' do store["\xAA\xBB\xCC"] = 340282366920938463463374607431768211456 store.close @store = nil store["\xAA\xBB\xCC"].should == 340282366920938463463374607431768211456 end it 'persists values' do store["über"] = 33 store.close @store = nil store["über"].should == 33 end it 'persists values' do store["\xAA\xBB\xCC"] = 33 store.close @store = nil store["\xAA\xBB\xCC"].should == 33 end end #################### null_binarykey_booleanvalue #################### shared_examples_for 'null_binarykey_booleanvalue' do it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = true store["\xAA\xBB\xCC"] = false store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", true, options).should == true end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = true store["über"] = false store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", true, options).should == true end it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = false store["\xAA\xBB\xCC"] = true store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", false, options).should == false end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = false store["über"] = true store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", false, options).should == false end end #################### store_binarykey_booleanvalue #################### shared_examples_for 'store_binarykey_booleanvalue' do it 'writes values to keys that like a Hash' do store["über"] = true store["über"].should == true store.load("über").should == true end it 'returns true from #key? if a key is available' do store["über"] = true store.key?("über").should be_true end it 'stores values with #store' do value = true store.store("über", value).should equal(value) store["über"].should == true store.load("über").should == true end it 'stores values after clear' do store["über"] = true store["\xAA\xBB\xCC"] = false store.clear.should equal(store) store["über"] = true store["über"].should == true store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = true store.delete("über").should == true store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = true store["über"].should == true store["über"] = false store["über"].should == false end it 'stores frozen values' do value = true.freeze (store["über"] = value).should equal(value) store["über"].should == true end it 'stores frozen keys' do key = "über".freeze store[key] = true store["über"].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store["über"] = true store.fetch("über", false).should == true end it 'does not run the block in fetch if the key is available' do store["über"] = true unaltered = 'unaltered' store.fetch("über") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = true store["\xAA\xBB\xCC"].should == true store.load("\xAA\xBB\xCC").should == true end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = true store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = true store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == true store.load("\xAA\xBB\xCC").should == true end it 'stores values after clear' do store["\xAA\xBB\xCC"] = true store["über"] = false store.clear.should equal(store) store["\xAA\xBB\xCC"] = true store["\xAA\xBB\xCC"].should == true store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = true store.delete("\xAA\xBB\xCC").should == true store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = true store["\xAA\xBB\xCC"].should == true store["\xAA\xBB\xCC"] = false store["\xAA\xBB\xCC"].should == false end it 'stores frozen values' do value = true.freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == true end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = true store["\xAA\xBB\xCC"].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store["\xAA\xBB\xCC"] = true store.fetch("\xAA\xBB\xCC", false).should == true end it 'does not run the block in fetch if the key is available' do store["\xAA\xBB\xCC"] = true unaltered = 'unaltered' store.fetch("\xAA\xBB\xCC") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["über"] = false store["über"].should == false store.load("über").should == false end it 'returns true from #key? if a key is available' do store["über"] = false store.key?("über").should be_true end it 'stores values with #store' do value = false store.store("über", value).should equal(value) store["über"].should == false store.load("über").should == false end it 'stores values after clear' do store["über"] = false store["\xAA\xBB\xCC"] = true store.clear.should equal(store) store["über"] = false store["über"].should == false store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = false store.delete("über").should == false store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = false store["über"].should == false store["über"] = true store["über"].should == true end it 'stores frozen values' do value = false.freeze (store["über"] = value).should equal(value) store["über"].should == false end it 'stores frozen keys' do key = "über".freeze store[key] = false store["über"].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store["über"] = false store.fetch("über", true).should == false end it 'does not run the block in fetch if the key is available' do store["über"] = false unaltered = 'unaltered' store.fetch("über") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = false store["\xAA\xBB\xCC"].should == false store.load("\xAA\xBB\xCC").should == false end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = false store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = false store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == false store.load("\xAA\xBB\xCC").should == false end it 'stores values after clear' do store["\xAA\xBB\xCC"] = false store["über"] = true store.clear.should equal(store) store["\xAA\xBB\xCC"] = false store["\xAA\xBB\xCC"].should == false store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = false store.delete("\xAA\xBB\xCC").should == false store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = false store["\xAA\xBB\xCC"].should == false store["\xAA\xBB\xCC"] = true store["\xAA\xBB\xCC"].should == true end it 'stores frozen values' do value = false.freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == false end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = false store["\xAA\xBB\xCC"].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store["\xAA\xBB\xCC"] = false store.fetch("\xAA\xBB\xCC", true).should == false end it 'does not run the block in fetch if the key is available' do store["\xAA\xBB\xCC"] = false unaltered = 'unaltered' store.fetch("\xAA\xBB\xCC") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_binarykey_booleanvalue #################### shared_examples_for 'persist_binarykey_booleanvalue' do it 'persists values' do store["über"] = true store.close @store = nil store["über"].should == true end it 'persists values' do store["\xAA\xBB\xCC"] = true store.close @store = nil store["\xAA\xBB\xCC"].should == true end it 'persists values' do store["über"] = false store.close @store = nil store["über"].should == false end it 'persists values' do store["\xAA\xBB\xCC"] = false store.close @store = nil store["\xAA\xBB\xCC"].should == false end end #################### null_binarykey_stringvalue #################### shared_examples_for 'null_binarykey_stringvalue' do it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = "strval1" store["\xAA\xBB\xCC"] = "strval2" store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = "strval1" store["über"] = "strval2" store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = "strval2" store["\xAA\xBB\xCC"] = "strval1" store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", "strval2", options).should == "strval2" end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = "strval2" store["über"] = "strval1" store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", "strval2", options).should == "strval2" end end #################### store_binarykey_stringvalue #################### shared_examples_for 'store_binarykey_stringvalue' do it 'writes values to keys that like a Hash' do store["über"] = "strval1" store["über"].should == "strval1" store.load("über").should == "strval1" end it 'returns true from #key? if a key is available' do store["über"] = "strval1" store.key?("über").should be_true end it 'stores values with #store' do value = "strval1" store.store("über", value).should equal(value) store["über"].should == "strval1" store.load("über").should == "strval1" end it 'stores values after clear' do store["über"] = "strval1" store["\xAA\xBB\xCC"] = "strval2" store.clear.should equal(store) store["über"] = "strval1" store["über"].should == "strval1" store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = "strval1" store.delete("über").should == "strval1" store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = "strval1" store["über"].should == "strval1" store["über"] = "strval2" store["über"].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store["über"] = value).should equal(value) store["über"].should == "strval1" end it 'stores frozen keys' do key = "über".freeze store[key] = "strval1" store["über"].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store["über"] = "strval1" store.fetch("über", "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store["über"] = "strval1" unaltered = 'unaltered' store.fetch("über") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = "strval1" store["\xAA\xBB\xCC"].should == "strval1" store.load("\xAA\xBB\xCC").should == "strval1" end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = "strval1" store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = "strval1" store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == "strval1" store.load("\xAA\xBB\xCC").should == "strval1" end it 'stores values after clear' do store["\xAA\xBB\xCC"] = "strval1" store["über"] = "strval2" store.clear.should equal(store) store["\xAA\xBB\xCC"] = "strval1" store["\xAA\xBB\xCC"].should == "strval1" store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = "strval1" store.delete("\xAA\xBB\xCC").should == "strval1" store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = "strval1" store["\xAA\xBB\xCC"].should == "strval1" store["\xAA\xBB\xCC"] = "strval2" store["\xAA\xBB\xCC"].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == "strval1" end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = "strval1" store["\xAA\xBB\xCC"].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store["\xAA\xBB\xCC"] = "strval1" store.fetch("\xAA\xBB\xCC", "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store["\xAA\xBB\xCC"] = "strval1" unaltered = 'unaltered' store.fetch("\xAA\xBB\xCC") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["über"] = "strval2" store["über"].should == "strval2" store.load("über").should == "strval2" end it 'returns true from #key? if a key is available' do store["über"] = "strval2" store.key?("über").should be_true end it 'stores values with #store' do value = "strval2" store.store("über", value).should equal(value) store["über"].should == "strval2" store.load("über").should == "strval2" end it 'stores values after clear' do store["über"] = "strval2" store["\xAA\xBB\xCC"] = "strval1" store.clear.should equal(store) store["über"] = "strval2" store["über"].should == "strval2" store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = "strval2" store.delete("über").should == "strval2" store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = "strval2" store["über"].should == "strval2" store["über"] = "strval1" store["über"].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store["über"] = value).should equal(value) store["über"].should == "strval2" end it 'stores frozen keys' do key = "über".freeze store[key] = "strval2" store["über"].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store["über"] = "strval2" store.fetch("über", "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store["über"] = "strval2" unaltered = 'unaltered' store.fetch("über") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = "strval2" store["\xAA\xBB\xCC"].should == "strval2" store.load("\xAA\xBB\xCC").should == "strval2" end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = "strval2" store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = "strval2" store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == "strval2" store.load("\xAA\xBB\xCC").should == "strval2" end it 'stores values after clear' do store["\xAA\xBB\xCC"] = "strval2" store["über"] = "strval1" store.clear.should equal(store) store["\xAA\xBB\xCC"] = "strval2" store["\xAA\xBB\xCC"].should == "strval2" store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = "strval2" store.delete("\xAA\xBB\xCC").should == "strval2" store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = "strval2" store["\xAA\xBB\xCC"].should == "strval2" store["\xAA\xBB\xCC"] = "strval1" store["\xAA\xBB\xCC"].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == "strval2" end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = "strval2" store["\xAA\xBB\xCC"].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store["\xAA\xBB\xCC"] = "strval2" store.fetch("\xAA\xBB\xCC", "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store["\xAA\xBB\xCC"] = "strval2" unaltered = 'unaltered' store.fetch("\xAA\xBB\xCC") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_binarykey_stringvalue #################### shared_examples_for 'returndifferent_binarykey_stringvalue' do it 'guarantees that a different value is retrieved' do value = "strval1" store["über"] = value store["über"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval1" store["\xAA\xBB\xCC"] = value store["\xAA\xBB\xCC"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store["über"] = value store["über"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store["\xAA\xBB\xCC"] = value store["\xAA\xBB\xCC"].should_not be_equal(value) end end #################### returnsame_binarykey_stringvalue #################### shared_examples_for 'returnsame_binarykey_stringvalue' do it 'guarantees that the same value is retrieved' do value = "strval1" store["über"] = value store["über"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval1" store["\xAA\xBB\xCC"] = value store["\xAA\xBB\xCC"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store["über"] = value store["über"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store["\xAA\xBB\xCC"] = value store["\xAA\xBB\xCC"].should be_equal(value) end end #################### persist_binarykey_stringvalue #################### shared_examples_for 'persist_binarykey_stringvalue' do it 'persists values' do store["über"] = "strval1" store.close @store = nil store["über"].should == "strval1" end it 'persists values' do store["\xAA\xBB\xCC"] = "strval1" store.close @store = nil store["\xAA\xBB\xCC"].should == "strval1" end it 'persists values' do store["über"] = "strval2" store.close @store = nil store["über"].should == "strval2" end it 'persists values' do store["\xAA\xBB\xCC"] = "strval2" store.close @store = nil store["\xAA\xBB\xCC"].should == "strval2" end end #################### null_binarykey_binaryvalue #################### shared_examples_for 'null_binarykey_binaryvalue' do it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = "über" store["\xAA\xBB\xCC"] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", "über", options).should == "über" end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = "über" store["über"] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", "über", options).should == "über" end it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = "\xAA\xBB\xCC" store["\xAA\xBB\xCC"] = "über" store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = "\xAA\xBB\xCC" store["über"] = "über" store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end end #################### store_binarykey_binaryvalue #################### shared_examples_for 'store_binarykey_binaryvalue' do it 'writes values to keys that like a Hash' do store["über"] = "über" store["über"].should == "über" store.load("über").should == "über" end it 'returns true from #key? if a key is available' do store["über"] = "über" store.key?("über").should be_true end it 'stores values with #store' do value = "über" store.store("über", value).should equal(value) store["über"].should == "über" store.load("über").should == "über" end it 'stores values after clear' do store["über"] = "über" store["\xAA\xBB\xCC"] = "\xAA\xBB\xCC" store.clear.should equal(store) store["über"] = "über" store["über"].should == "über" store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = "über" store.delete("über").should == "über" store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = "über" store["über"].should == "über" store["über"] = "\xAA\xBB\xCC" store["über"].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store["über"] = value).should equal(value) store["über"].should == "über" end it 'stores frozen keys' do key = "über".freeze store[key] = "über" store["über"].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store["über"] = "über" store.fetch("über", "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store["über"] = "über" unaltered = 'unaltered' store.fetch("über") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = "über" store["\xAA\xBB\xCC"].should == "über" store.load("\xAA\xBB\xCC").should == "über" end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = "über" store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = "über" store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == "über" store.load("\xAA\xBB\xCC").should == "über" end it 'stores values after clear' do store["\xAA\xBB\xCC"] = "über" store["über"] = "\xAA\xBB\xCC" store.clear.should equal(store) store["\xAA\xBB\xCC"] = "über" store["\xAA\xBB\xCC"].should == "über" store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = "über" store.delete("\xAA\xBB\xCC").should == "über" store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = "über" store["\xAA\xBB\xCC"].should == "über" store["\xAA\xBB\xCC"] = "\xAA\xBB\xCC" store["\xAA\xBB\xCC"].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == "über" end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = "über" store["\xAA\xBB\xCC"].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store["\xAA\xBB\xCC"] = "über" store.fetch("\xAA\xBB\xCC", "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store["\xAA\xBB\xCC"] = "über" unaltered = 'unaltered' store.fetch("\xAA\xBB\xCC") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["über"] = "\xAA\xBB\xCC" store["über"].should == "\xAA\xBB\xCC" store.load("über").should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store["über"] = "\xAA\xBB\xCC" store.key?("über").should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store("über", value).should equal(value) store["über"].should == "\xAA\xBB\xCC" store.load("über").should == "\xAA\xBB\xCC" end it 'stores values after clear' do store["über"] = "\xAA\xBB\xCC" store["\xAA\xBB\xCC"] = "über" store.clear.should equal(store) store["über"] = "\xAA\xBB\xCC" store["über"].should == "\xAA\xBB\xCC" store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = "\xAA\xBB\xCC" store.delete("über").should == "\xAA\xBB\xCC" store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = "\xAA\xBB\xCC" store["über"].should == "\xAA\xBB\xCC" store["über"] = "über" store["über"].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store["über"] = value).should equal(value) store["über"].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = "über".freeze store[key] = "\xAA\xBB\xCC" store["über"].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store["über"] = "\xAA\xBB\xCC" store.fetch("über", "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store["über"] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch("über") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = "\xAA\xBB\xCC" store["\xAA\xBB\xCC"].should == "\xAA\xBB\xCC" store.load("\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = "\xAA\xBB\xCC" store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == "\xAA\xBB\xCC" store.load("\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'stores values after clear' do store["\xAA\xBB\xCC"] = "\xAA\xBB\xCC" store["über"] = "über" store.clear.should equal(store) store["\xAA\xBB\xCC"] = "\xAA\xBB\xCC" store["\xAA\xBB\xCC"].should == "\xAA\xBB\xCC" store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = "\xAA\xBB\xCC" store.delete("\xAA\xBB\xCC").should == "\xAA\xBB\xCC" store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = "\xAA\xBB\xCC" store["\xAA\xBB\xCC"].should == "\xAA\xBB\xCC" store["\xAA\xBB\xCC"] = "über" store["\xAA\xBB\xCC"].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = "\xAA\xBB\xCC" store["\xAA\xBB\xCC"].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store["\xAA\xBB\xCC"] = "\xAA\xBB\xCC" store.fetch("\xAA\xBB\xCC", "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store["\xAA\xBB\xCC"] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch("\xAA\xBB\xCC") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_binarykey_binaryvalue #################### shared_examples_for 'returndifferent_binarykey_binaryvalue' do it 'guarantees that a different value is retrieved' do value = "über" store["über"] = value store["über"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "über" store["\xAA\xBB\xCC"] = value store["\xAA\xBB\xCC"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store["über"] = value store["über"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store["\xAA\xBB\xCC"] = value store["\xAA\xBB\xCC"].should_not be_equal(value) end end #################### returnsame_binarykey_binaryvalue #################### shared_examples_for 'returnsame_binarykey_binaryvalue' do it 'guarantees that the same value is retrieved' do value = "über" store["über"] = value store["über"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "über" store["\xAA\xBB\xCC"] = value store["\xAA\xBB\xCC"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store["über"] = value store["über"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store["\xAA\xBB\xCC"] = value store["\xAA\xBB\xCC"].should be_equal(value) end end #################### persist_binarykey_binaryvalue #################### shared_examples_for 'persist_binarykey_binaryvalue' do it 'persists values' do store["über"] = "über" store.close @store = nil store["über"].should == "über" end it 'persists values' do store["\xAA\xBB\xCC"] = "über" store.close @store = nil store["\xAA\xBB\xCC"].should == "über" end it 'persists values' do store["über"] = "\xAA\xBB\xCC" store.close @store = nil store["über"].should == "\xAA\xBB\xCC" end it 'persists values' do store["\xAA\xBB\xCC"] = "\xAA\xBB\xCC" store.close @store = nil store["\xAA\xBB\xCC"].should == "\xAA\xBB\xCC" end end #################### null_binarykey_hashvalue #################### shared_examples_for 'null_binarykey_hashvalue' do it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = {"hashval1"=>["array1", 1]} store["\xAA\xBB\xCC"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = {"hashval1"=>["array1", 1]} store["über"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["\xAA\xBB\xCC"] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["über"] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### store_binarykey_hashvalue #################### shared_examples_for 'store_binarykey_hashvalue' do it 'writes values to keys that like a Hash' do store["über"] = {"hashval1"=>["array1", 1]} store["über"].should == {"hashval1"=>["array1", 1]} store.load("über").should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store["über"] = {"hashval1"=>["array1", 1]} store.key?("über").should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store("über", value).should equal(value) store["über"].should == {"hashval1"=>["array1", 1]} store.load("über").should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store["über"] = {"hashval1"=>["array1", 1]} store["\xAA\xBB\xCC"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store["über"] = {"hashval1"=>["array1", 1]} store["über"].should == {"hashval1"=>["array1", 1]} store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = {"hashval1"=>["array1", 1]} store.delete("über").should == {"hashval1"=>["array1", 1]} store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = {"hashval1"=>["array1", 1]} store["über"].should == {"hashval1"=>["array1", 1]} store["über"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["über"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store["über"] = value).should equal(value) store["über"].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = "über".freeze store[key] = {"hashval1"=>["array1", 1]} store["über"].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store["über"] = {"hashval1"=>["array1", 1]} store.fetch("über", {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store["über"] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch("über") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = {"hashval1"=>["array1", 1]} store["\xAA\xBB\xCC"].should == {"hashval1"=>["array1", 1]} store.load("\xAA\xBB\xCC").should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = {"hashval1"=>["array1", 1]} store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == {"hashval1"=>["array1", 1]} store.load("\xAA\xBB\xCC").should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store["\xAA\xBB\xCC"] = {"hashval1"=>["array1", 1]} store["über"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store["\xAA\xBB\xCC"] = {"hashval1"=>["array1", 1]} store["\xAA\xBB\xCC"].should == {"hashval1"=>["array1", 1]} store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = {"hashval1"=>["array1", 1]} store.delete("\xAA\xBB\xCC").should == {"hashval1"=>["array1", 1]} store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = {"hashval1"=>["array1", 1]} store["\xAA\xBB\xCC"].should == {"hashval1"=>["array1", 1]} store["\xAA\xBB\xCC"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["\xAA\xBB\xCC"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = {"hashval1"=>["array1", 1]} store["\xAA\xBB\xCC"].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store["\xAA\xBB\xCC"] = {"hashval1"=>["array1", 1]} store.fetch("\xAA\xBB\xCC", {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store["\xAA\xBB\xCC"] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch("\xAA\xBB\xCC") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["über"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["über"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load("über").should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store["über"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?("über").should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store("über", value).should equal(value) store["über"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load("über").should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store["über"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["\xAA\xBB\xCC"] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store["über"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["über"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete("über").should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["über"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store["über"] = {"hashval1"=>["array1", 1]} store["über"].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store["über"] = value).should equal(value) store["über"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = "über".freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["über"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store["über"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch("über", {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store["über"] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch("über") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["\xAA\xBB\xCC"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load("\xAA\xBB\xCC").should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load("\xAA\xBB\xCC").should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store["\xAA\xBB\xCC"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["über"] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store["\xAA\xBB\xCC"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["\xAA\xBB\xCC"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete("\xAA\xBB\xCC").should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["\xAA\xBB\xCC"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store["\xAA\xBB\xCC"] = {"hashval1"=>["array1", 1]} store["\xAA\xBB\xCC"].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store["\xAA\xBB\xCC"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store["\xAA\xBB\xCC"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch("\xAA\xBB\xCC", {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store["\xAA\xBB\xCC"] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch("\xAA\xBB\xCC") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_binarykey_hashvalue #################### shared_examples_for 'returndifferent_binarykey_hashvalue' do it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store["über"] = value store["über"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store["\xAA\xBB\xCC"] = value store["\xAA\xBB\xCC"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store["über"] = value store["über"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store["\xAA\xBB\xCC"] = value store["\xAA\xBB\xCC"].should_not be_equal(value) end end #################### returnsame_binarykey_hashvalue #################### shared_examples_for 'returnsame_binarykey_hashvalue' do it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store["über"] = value store["über"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store["\xAA\xBB\xCC"] = value store["\xAA\xBB\xCC"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store["über"] = value store["über"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store["\xAA\xBB\xCC"] = value store["\xAA\xBB\xCC"].should be_equal(value) end end #################### persist_binarykey_hashvalue #################### shared_examples_for 'persist_binarykey_hashvalue' do it 'persists values' do store["über"] = {"hashval1"=>["array1", 1]} store.close @store = nil store["über"].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store["\xAA\xBB\xCC"] = {"hashval1"=>["array1", 1]} store.close @store = nil store["\xAA\xBB\xCC"].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store["über"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store["über"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'persists values' do store["\xAA\xBB\xCC"] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store["\xAA\xBB\xCC"].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### null_binarykey_objectvalue #################### shared_examples_for 'null_binarykey_objectvalue' do it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = Value.new(:objval1) store["\xAA\xBB\xCC"] = Value.new(:objval2) store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = Value.new(:objval1) store["über"] = Value.new(:objval2) store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store["über"].should be_nil store.load("über").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store["über"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("über").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("über").should be_nil end it 'removes all keys from the store with clear' do store["über"] = Value.new(:objval2) store["\xAA\xBB\xCC"] = Value.new(:objval1) store.clear.should equal(store) store.key?("über").should be_false store.key?("\xAA\xBB\xCC").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("über", Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = "über" value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("über", options).should be_false store.load("über", options).should be_nil store.fetch("über", 42, options).should == 42 store.fetch("über", options) { 42 }.should == 42 store.delete("über", options).should be_nil store.clear(options).should equal(store) store.store("über", Value.new(:objval2), options).should == Value.new(:objval2) end it 'reads from keys like a Hash' do store["\xAA\xBB\xCC"].should be_nil store.load("\xAA\xBB\xCC").should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store["\xAA\xBB\xCC"] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?("\xAA\xBB\xCC").should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete("\xAA\xBB\xCC").should be_nil end it 'removes all keys from the store with clear' do store["\xAA\xBB\xCC"] = Value.new(:objval2) store["über"] = Value.new(:objval1) store.clear.should equal(store) store.key?("\xAA\xBB\xCC").should be_false store.key?("über").should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch("\xAA\xBB\xCC", Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = "\xAA\xBB\xCC" value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?("\xAA\xBB\xCC", options).should be_false store.load("\xAA\xBB\xCC", options).should be_nil store.fetch("\xAA\xBB\xCC", 42, options).should == 42 store.fetch("\xAA\xBB\xCC", options) { 42 }.should == 42 store.delete("\xAA\xBB\xCC", options).should be_nil store.clear(options).should equal(store) store.store("\xAA\xBB\xCC", Value.new(:objval2), options).should == Value.new(:objval2) end end #################### store_binarykey_objectvalue #################### shared_examples_for 'store_binarykey_objectvalue' do it 'writes values to keys that like a Hash' do store["über"] = Value.new(:objval1) store["über"].should == Value.new(:objval1) store.load("über").should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store["über"] = Value.new(:objval1) store.key?("über").should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store("über", value).should equal(value) store["über"].should == Value.new(:objval1) store.load("über").should == Value.new(:objval1) end it 'stores values after clear' do store["über"] = Value.new(:objval1) store["\xAA\xBB\xCC"] = Value.new(:objval2) store.clear.should equal(store) store["über"] = Value.new(:objval1) store["über"].should == Value.new(:objval1) store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = Value.new(:objval1) store.delete("über").should == Value.new(:objval1) store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = Value.new(:objval1) store["über"].should == Value.new(:objval1) store["über"] = Value.new(:objval2) store["über"].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store["über"] = value).should equal(value) store["über"].should == Value.new(:objval1) end it 'stores frozen keys' do key = "über".freeze store[key] = Value.new(:objval1) store["über"].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store["über"] = Value.new(:objval1) store.fetch("über", Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store["über"] = Value.new(:objval1) unaltered = 'unaltered' store.fetch("über") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = Value.new(:objval1) store["\xAA\xBB\xCC"].should == Value.new(:objval1) store.load("\xAA\xBB\xCC").should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = Value.new(:objval1) store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == Value.new(:objval1) store.load("\xAA\xBB\xCC").should == Value.new(:objval1) end it 'stores values after clear' do store["\xAA\xBB\xCC"] = Value.new(:objval1) store["über"] = Value.new(:objval2) store.clear.should equal(store) store["\xAA\xBB\xCC"] = Value.new(:objval1) store["\xAA\xBB\xCC"].should == Value.new(:objval1) store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = Value.new(:objval1) store.delete("\xAA\xBB\xCC").should == Value.new(:objval1) store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = Value.new(:objval1) store["\xAA\xBB\xCC"].should == Value.new(:objval1) store["\xAA\xBB\xCC"] = Value.new(:objval2) store["\xAA\xBB\xCC"].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == Value.new(:objval1) end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = Value.new(:objval1) store["\xAA\xBB\xCC"].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store["\xAA\xBB\xCC"] = Value.new(:objval1) store.fetch("\xAA\xBB\xCC", Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store["\xAA\xBB\xCC"] = Value.new(:objval1) unaltered = 'unaltered' store.fetch("\xAA\xBB\xCC") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["über"] = Value.new(:objval2) store["über"].should == Value.new(:objval2) store.load("über").should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store["über"] = Value.new(:objval2) store.key?("über").should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store("über", value).should equal(value) store["über"].should == Value.new(:objval2) store.load("über").should == Value.new(:objval2) end it 'stores values after clear' do store["über"] = Value.new(:objval2) store["\xAA\xBB\xCC"] = Value.new(:objval1) store.clear.should equal(store) store["über"] = Value.new(:objval2) store["über"].should == Value.new(:objval2) store["\xAA\xBB\xCC"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["über"] = Value.new(:objval2) store.delete("über").should == Value.new(:objval2) store.key?("über").should be_false end it 'overwrites existing values' do store["über"] = Value.new(:objval2) store["über"].should == Value.new(:objval2) store["über"] = Value.new(:objval1) store["über"].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store["über"] = value).should equal(value) store["über"].should == Value.new(:objval2) end it 'stores frozen keys' do key = "über".freeze store[key] = Value.new(:objval2) store["über"].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store["über"] = Value.new(:objval2) store.fetch("über", Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store["über"] = Value.new(:objval2) unaltered = 'unaltered' store.fetch("über") { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store["\xAA\xBB\xCC"] = Value.new(:objval2) store["\xAA\xBB\xCC"].should == Value.new(:objval2) store.load("\xAA\xBB\xCC").should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store["\xAA\xBB\xCC"] = Value.new(:objval2) store.key?("\xAA\xBB\xCC").should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store("\xAA\xBB\xCC", value).should equal(value) store["\xAA\xBB\xCC"].should == Value.new(:objval2) store.load("\xAA\xBB\xCC").should == Value.new(:objval2) end it 'stores values after clear' do store["\xAA\xBB\xCC"] = Value.new(:objval2) store["über"] = Value.new(:objval1) store.clear.should equal(store) store["\xAA\xBB\xCC"] = Value.new(:objval2) store["\xAA\xBB\xCC"].should == Value.new(:objval2) store["über"].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store["\xAA\xBB\xCC"] = Value.new(:objval2) store.delete("\xAA\xBB\xCC").should == Value.new(:objval2) store.key?("\xAA\xBB\xCC").should be_false end it 'overwrites existing values' do store["\xAA\xBB\xCC"] = Value.new(:objval2) store["\xAA\xBB\xCC"].should == Value.new(:objval2) store["\xAA\xBB\xCC"] = Value.new(:objval1) store["\xAA\xBB\xCC"].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store["\xAA\xBB\xCC"] = value).should equal(value) store["\xAA\xBB\xCC"].should == Value.new(:objval2) end it 'stores frozen keys' do key = "\xAA\xBB\xCC".freeze store[key] = Value.new(:objval2) store["\xAA\xBB\xCC"].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store["\xAA\xBB\xCC"] = Value.new(:objval2) store.fetch("\xAA\xBB\xCC", Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store["\xAA\xBB\xCC"] = Value.new(:objval2) unaltered = 'unaltered' store.fetch("\xAA\xBB\xCC") { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_binarykey_objectvalue #################### shared_examples_for 'returndifferent_binarykey_objectvalue' do it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store["über"] = value store["über"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store["\xAA\xBB\xCC"] = value store["\xAA\xBB\xCC"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store["über"] = value store["über"].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store["\xAA\xBB\xCC"] = value store["\xAA\xBB\xCC"].should_not be_equal(value) end end #################### returnsame_binarykey_objectvalue #################### shared_examples_for 'returnsame_binarykey_objectvalue' do it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store["über"] = value store["über"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store["\xAA\xBB\xCC"] = value store["\xAA\xBB\xCC"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store["über"] = value store["über"].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store["\xAA\xBB\xCC"] = value store["\xAA\xBB\xCC"].should be_equal(value) end end #################### persist_binarykey_objectvalue #################### shared_examples_for 'persist_binarykey_objectvalue' do it 'persists values' do store["über"] = Value.new(:objval1) store.close @store = nil store["über"].should == Value.new(:objval1) end it 'persists values' do store["\xAA\xBB\xCC"] = Value.new(:objval1) store.close @store = nil store["\xAA\xBB\xCC"].should == Value.new(:objval1) end it 'persists values' do store["über"] = Value.new(:objval2) store.close @store = nil store["über"].should == Value.new(:objval2) end it 'persists values' do store["\xAA\xBB\xCC"] = Value.new(:objval2) store.close @store = nil store["\xAA\xBB\xCC"].should == Value.new(:objval2) end end #################### null_objectkey_nilvalue #################### shared_examples_for 'null_objectkey_nilvalue' do it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = '' store[Value.new(:objkey2)] = nil store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), '', options).should == '' end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = '' store[Value.new(:objkey1)] = nil store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), '', options).should == '' end it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = nil store[Value.new(:objkey2)] = '' store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), nil, options).should == nil end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = nil store[Value.new(:objkey1)] = '' store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), nil, options).should == nil end it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = 0 store[Value.new(:objkey2)] = false store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), 0, options).should == 0 end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = 0 store[Value.new(:objkey1)] = false store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), 0, options).should == 0 end it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = false store[Value.new(:objkey2)] = 0 store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), false, options).should == false end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = false store[Value.new(:objkey1)] = 0 store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), false, options).should == false end end #################### store_objectkey_nilvalue #################### shared_examples_for 'store_objectkey_nilvalue' do it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = '' store[Value.new(:objkey1)].should == '' store.load(Value.new(:objkey1)).should == '' end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = '' store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = '' store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == '' store.load(Value.new(:objkey1)).should == '' end it 'stores values after clear' do store[Value.new(:objkey1)] = '' store[Value.new(:objkey2)] = nil store.clear.should equal(store) store[Value.new(:objkey1)] = '' store[Value.new(:objkey1)].should == '' store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = '' store.delete(Value.new(:objkey1)).should == '' store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = '' store[Value.new(:objkey1)].should == '' store[Value.new(:objkey1)] = nil store[Value.new(:objkey1)].should == nil end it 'stores frozen values' do value = ''.freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == '' end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = '' store[Value.new(:objkey1)].should == '' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = '' store[Value.new(:objkey2)].should == '' store.load(Value.new(:objkey2)).should == '' end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = '' store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = '' store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == '' store.load(Value.new(:objkey2)).should == '' end it 'stores values after clear' do store[Value.new(:objkey2)] = '' store[Value.new(:objkey1)] = nil store.clear.should equal(store) store[Value.new(:objkey2)] = '' store[Value.new(:objkey2)].should == '' store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = '' store.delete(Value.new(:objkey2)).should == '' store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = '' store[Value.new(:objkey2)].should == '' store[Value.new(:objkey2)] = nil store[Value.new(:objkey2)].should == nil end it 'stores frozen values' do value = ''.freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == '' end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = '' store[Value.new(:objkey2)].should == '' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = nil store[Value.new(:objkey1)].should == nil store.load(Value.new(:objkey1)).should == nil end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = nil store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = nil store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == nil store.load(Value.new(:objkey1)).should == nil end it 'stores values after clear' do store[Value.new(:objkey1)] = nil store[Value.new(:objkey2)] = '' store.clear.should equal(store) store[Value.new(:objkey1)] = nil store[Value.new(:objkey1)].should == nil store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = nil store.delete(Value.new(:objkey1)).should == nil store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = nil store[Value.new(:objkey1)].should == nil store[Value.new(:objkey1)] = '' store[Value.new(:objkey1)].should == '' end it 'stores frozen values' do value = nil.freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == nil end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = nil store[Value.new(:objkey1)].should == nil end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = nil store[Value.new(:objkey2)].should == nil store.load(Value.new(:objkey2)).should == nil end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = nil store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = nil store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == nil store.load(Value.new(:objkey2)).should == nil end it 'stores values after clear' do store[Value.new(:objkey2)] = nil store[Value.new(:objkey1)] = '' store.clear.should equal(store) store[Value.new(:objkey2)] = nil store[Value.new(:objkey2)].should == nil store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = nil store.delete(Value.new(:objkey2)).should == nil store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = nil store[Value.new(:objkey2)].should == nil store[Value.new(:objkey2)] = '' store[Value.new(:objkey2)].should == '' end it 'stores frozen values' do value = nil.freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == nil end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = nil store[Value.new(:objkey2)].should == nil end it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = 0 store[Value.new(:objkey1)].should == 0 store.load(Value.new(:objkey1)).should == 0 end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = 0 store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = 0 store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == 0 store.load(Value.new(:objkey1)).should == 0 end it 'stores values after clear' do store[Value.new(:objkey1)] = 0 store[Value.new(:objkey2)] = false store.clear.should equal(store) store[Value.new(:objkey1)] = 0 store[Value.new(:objkey1)].should == 0 store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = 0 store.delete(Value.new(:objkey1)).should == 0 store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = 0 store[Value.new(:objkey1)].should == 0 store[Value.new(:objkey1)] = false store[Value.new(:objkey1)].should == false end it 'stores frozen values' do value = 0.freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == 0 end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = 0 store[Value.new(:objkey1)].should == 0 end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = 0 store[Value.new(:objkey2)].should == 0 store.load(Value.new(:objkey2)).should == 0 end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = 0 store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = 0 store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == 0 store.load(Value.new(:objkey2)).should == 0 end it 'stores values after clear' do store[Value.new(:objkey2)] = 0 store[Value.new(:objkey1)] = false store.clear.should equal(store) store[Value.new(:objkey2)] = 0 store[Value.new(:objkey2)].should == 0 store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = 0 store.delete(Value.new(:objkey2)).should == 0 store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = 0 store[Value.new(:objkey2)].should == 0 store[Value.new(:objkey2)] = false store[Value.new(:objkey2)].should == false end it 'stores frozen values' do value = 0.freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == 0 end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = 0 store[Value.new(:objkey2)].should == 0 end it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = false store[Value.new(:objkey1)].should == false store.load(Value.new(:objkey1)).should == false end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = false store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = false store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == false store.load(Value.new(:objkey1)).should == false end it 'stores values after clear' do store[Value.new(:objkey1)] = false store[Value.new(:objkey2)] = 0 store.clear.should equal(store) store[Value.new(:objkey1)] = false store[Value.new(:objkey1)].should == false store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = false store.delete(Value.new(:objkey1)).should == false store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = false store[Value.new(:objkey1)].should == false store[Value.new(:objkey1)] = 0 store[Value.new(:objkey1)].should == 0 end it 'stores frozen values' do value = false.freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == false end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = false store[Value.new(:objkey1)].should == false end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = false store[Value.new(:objkey2)].should == false store.load(Value.new(:objkey2)).should == false end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = false store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = false store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == false store.load(Value.new(:objkey2)).should == false end it 'stores values after clear' do store[Value.new(:objkey2)] = false store[Value.new(:objkey1)] = 0 store.clear.should equal(store) store[Value.new(:objkey2)] = false store[Value.new(:objkey2)].should == false store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = false store.delete(Value.new(:objkey2)).should == false store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = false store[Value.new(:objkey2)].should == false store[Value.new(:objkey2)] = 0 store[Value.new(:objkey2)].should == 0 end it 'stores frozen values' do value = false.freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == false end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = false store[Value.new(:objkey2)].should == false end end #################### persist_objectkey_nilvalue #################### shared_examples_for 'persist_objectkey_nilvalue' do it 'persists values' do store[Value.new(:objkey1)] = '' store.close @store = nil store[Value.new(:objkey1)].should == '' end it 'persists values' do store[Value.new(:objkey2)] = '' store.close @store = nil store[Value.new(:objkey2)].should == '' end it 'persists values' do store[Value.new(:objkey1)] = nil store.close @store = nil store[Value.new(:objkey1)].should == nil end it 'persists values' do store[Value.new(:objkey2)] = nil store.close @store = nil store[Value.new(:objkey2)].should == nil end it 'persists values' do store[Value.new(:objkey1)] = 0 store.close @store = nil store[Value.new(:objkey1)].should == 0 end it 'persists values' do store[Value.new(:objkey2)] = 0 store.close @store = nil store[Value.new(:objkey2)].should == 0 end it 'persists values' do store[Value.new(:objkey1)] = false store.close @store = nil store[Value.new(:objkey1)].should == false end it 'persists values' do store[Value.new(:objkey2)] = false store.close @store = nil store[Value.new(:objkey2)].should == false end end #################### null_objectkey_integervalue #################### shared_examples_for 'null_objectkey_integervalue' do it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = 41 store[Value.new(:objkey2)] = -12 store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), 41, options).should == 41 end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = 41 store[Value.new(:objkey1)] = -12 store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), 41, options).should == 41 end it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = -12 store[Value.new(:objkey2)] = 41 store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), -12, options).should == -12 end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = -12 store[Value.new(:objkey1)] = 41 store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), -12, options).should == -12 end end #################### store_objectkey_integervalue #################### shared_examples_for 'store_objectkey_integervalue' do it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = 41 store[Value.new(:objkey1)].should == 41 store.load(Value.new(:objkey1)).should == 41 end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = 41 store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = 41 store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == 41 store.load(Value.new(:objkey1)).should == 41 end it 'stores values after clear' do store[Value.new(:objkey1)] = 41 store[Value.new(:objkey2)] = -12 store.clear.should equal(store) store[Value.new(:objkey1)] = 41 store[Value.new(:objkey1)].should == 41 store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = 41 store.delete(Value.new(:objkey1)).should == 41 store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = 41 store[Value.new(:objkey1)].should == 41 store[Value.new(:objkey1)] = -12 store[Value.new(:objkey1)].should == -12 end it 'stores frozen values' do value = 41.freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == 41 end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = 41 store[Value.new(:objkey1)].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey1)] = 41 store.fetch(Value.new(:objkey1), -12).should == 41 end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey1)] = 41 unaltered = 'unaltered' store.fetch(Value.new(:objkey1)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = 41 store[Value.new(:objkey2)].should == 41 store.load(Value.new(:objkey2)).should == 41 end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = 41 store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = 41 store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == 41 store.load(Value.new(:objkey2)).should == 41 end it 'stores values after clear' do store[Value.new(:objkey2)] = 41 store[Value.new(:objkey1)] = -12 store.clear.should equal(store) store[Value.new(:objkey2)] = 41 store[Value.new(:objkey2)].should == 41 store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = 41 store.delete(Value.new(:objkey2)).should == 41 store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = 41 store[Value.new(:objkey2)].should == 41 store[Value.new(:objkey2)] = -12 store[Value.new(:objkey2)].should == -12 end it 'stores frozen values' do value = 41.freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == 41 end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = 41 store[Value.new(:objkey2)].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey2)] = 41 store.fetch(Value.new(:objkey2), -12).should == 41 end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey2)] = 41 unaltered = 'unaltered' store.fetch(Value.new(:objkey2)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = -12 store[Value.new(:objkey1)].should == -12 store.load(Value.new(:objkey1)).should == -12 end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = -12 store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = -12 store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == -12 store.load(Value.new(:objkey1)).should == -12 end it 'stores values after clear' do store[Value.new(:objkey1)] = -12 store[Value.new(:objkey2)] = 41 store.clear.should equal(store) store[Value.new(:objkey1)] = -12 store[Value.new(:objkey1)].should == -12 store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = -12 store.delete(Value.new(:objkey1)).should == -12 store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = -12 store[Value.new(:objkey1)].should == -12 store[Value.new(:objkey1)] = 41 store[Value.new(:objkey1)].should == 41 end it 'stores frozen values' do value = -12.freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == -12 end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = -12 store[Value.new(:objkey1)].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey1)] = -12 store.fetch(Value.new(:objkey1), 41).should == -12 end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey1)] = -12 unaltered = 'unaltered' store.fetch(Value.new(:objkey1)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = -12 store[Value.new(:objkey2)].should == -12 store.load(Value.new(:objkey2)).should == -12 end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = -12 store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = -12 store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == -12 store.load(Value.new(:objkey2)).should == -12 end it 'stores values after clear' do store[Value.new(:objkey2)] = -12 store[Value.new(:objkey1)] = 41 store.clear.should equal(store) store[Value.new(:objkey2)] = -12 store[Value.new(:objkey2)].should == -12 store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = -12 store.delete(Value.new(:objkey2)).should == -12 store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = -12 store[Value.new(:objkey2)].should == -12 store[Value.new(:objkey2)] = 41 store[Value.new(:objkey2)].should == 41 end it 'stores frozen values' do value = -12.freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == -12 end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = -12 store[Value.new(:objkey2)].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey2)] = -12 store.fetch(Value.new(:objkey2), 41).should == -12 end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey2)] = -12 unaltered = 'unaltered' store.fetch(Value.new(:objkey2)) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_objectkey_integervalue #################### shared_examples_for 'persist_objectkey_integervalue' do it 'persists values' do store[Value.new(:objkey1)] = 41 store.close @store = nil store[Value.new(:objkey1)].should == 41 end it 'persists values' do store[Value.new(:objkey2)] = 41 store.close @store = nil store[Value.new(:objkey2)].should == 41 end it 'persists values' do store[Value.new(:objkey1)] = -12 store.close @store = nil store[Value.new(:objkey1)].should == -12 end it 'persists values' do store[Value.new(:objkey2)] = -12 store.close @store = nil store[Value.new(:objkey2)].should == -12 end end #################### null_objectkey_numbervalue #################### shared_examples_for 'null_objectkey_numbervalue' do it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = 123.456 store[Value.new(:objkey2)] = -98.7 store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = 123.456 store[Value.new(:objkey1)] = -98.7 store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = -98.7 store[Value.new(:objkey2)] = 123.456 store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = -98.7 store[Value.new(:objkey1)] = 123.456 store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = 340282366920938463463374607431768211456 store[Value.new(:objkey2)] = 33 store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = 340282366920938463463374607431768211456 store[Value.new(:objkey1)] = 33 store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = 33 store[Value.new(:objkey2)] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), 33, options).should == 33 end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = 33 store[Value.new(:objkey1)] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), 33, options).should == 33 end end #################### store_objectkey_numbervalue #################### shared_examples_for 'store_objectkey_numbervalue' do it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = 123.456 store[Value.new(:objkey1)].should == 123.456 store.load(Value.new(:objkey1)).should == 123.456 end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = 123.456 store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = 123.456 store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == 123.456 store.load(Value.new(:objkey1)).should == 123.456 end it 'stores values after clear' do store[Value.new(:objkey1)] = 123.456 store[Value.new(:objkey2)] = -98.7 store.clear.should equal(store) store[Value.new(:objkey1)] = 123.456 store[Value.new(:objkey1)].should == 123.456 store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = 123.456 store.delete(Value.new(:objkey1)).should == 123.456 store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = 123.456 store[Value.new(:objkey1)].should == 123.456 store[Value.new(:objkey1)] = -98.7 store[Value.new(:objkey1)].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == 123.456 end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = 123.456 store[Value.new(:objkey1)].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey1)] = 123.456 store.fetch(Value.new(:objkey1), -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey1)] = 123.456 unaltered = 'unaltered' store.fetch(Value.new(:objkey1)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = 123.456 store[Value.new(:objkey2)].should == 123.456 store.load(Value.new(:objkey2)).should == 123.456 end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = 123.456 store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = 123.456 store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == 123.456 store.load(Value.new(:objkey2)).should == 123.456 end it 'stores values after clear' do store[Value.new(:objkey2)] = 123.456 store[Value.new(:objkey1)] = -98.7 store.clear.should equal(store) store[Value.new(:objkey2)] = 123.456 store[Value.new(:objkey2)].should == 123.456 store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = 123.456 store.delete(Value.new(:objkey2)).should == 123.456 store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = 123.456 store[Value.new(:objkey2)].should == 123.456 store[Value.new(:objkey2)] = -98.7 store[Value.new(:objkey2)].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == 123.456 end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = 123.456 store[Value.new(:objkey2)].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey2)] = 123.456 store.fetch(Value.new(:objkey2), -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey2)] = 123.456 unaltered = 'unaltered' store.fetch(Value.new(:objkey2)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = -98.7 store[Value.new(:objkey1)].should == -98.7 store.load(Value.new(:objkey1)).should == -98.7 end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = -98.7 store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = -98.7 store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == -98.7 store.load(Value.new(:objkey1)).should == -98.7 end it 'stores values after clear' do store[Value.new(:objkey1)] = -98.7 store[Value.new(:objkey2)] = 123.456 store.clear.should equal(store) store[Value.new(:objkey1)] = -98.7 store[Value.new(:objkey1)].should == -98.7 store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = -98.7 store.delete(Value.new(:objkey1)).should == -98.7 store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = -98.7 store[Value.new(:objkey1)].should == -98.7 store[Value.new(:objkey1)] = 123.456 store[Value.new(:objkey1)].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == -98.7 end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = -98.7 store[Value.new(:objkey1)].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey1)] = -98.7 store.fetch(Value.new(:objkey1), 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey1)] = -98.7 unaltered = 'unaltered' store.fetch(Value.new(:objkey1)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = -98.7 store[Value.new(:objkey2)].should == -98.7 store.load(Value.new(:objkey2)).should == -98.7 end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = -98.7 store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = -98.7 store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == -98.7 store.load(Value.new(:objkey2)).should == -98.7 end it 'stores values after clear' do store[Value.new(:objkey2)] = -98.7 store[Value.new(:objkey1)] = 123.456 store.clear.should equal(store) store[Value.new(:objkey2)] = -98.7 store[Value.new(:objkey2)].should == -98.7 store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = -98.7 store.delete(Value.new(:objkey2)).should == -98.7 store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = -98.7 store[Value.new(:objkey2)].should == -98.7 store[Value.new(:objkey2)] = 123.456 store[Value.new(:objkey2)].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == -98.7 end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = -98.7 store[Value.new(:objkey2)].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey2)] = -98.7 store.fetch(Value.new(:objkey2), 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey2)] = -98.7 unaltered = 'unaltered' store.fetch(Value.new(:objkey2)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = 340282366920938463463374607431768211456 store[Value.new(:objkey1)].should == 340282366920938463463374607431768211456 store.load(Value.new(:objkey1)).should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = 340282366920938463463374607431768211456 store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == 340282366920938463463374607431768211456 store.load(Value.new(:objkey1)).should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store[Value.new(:objkey1)] = 340282366920938463463374607431768211456 store[Value.new(:objkey2)] = 33 store.clear.should equal(store) store[Value.new(:objkey1)] = 340282366920938463463374607431768211456 store[Value.new(:objkey1)].should == 340282366920938463463374607431768211456 store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = 340282366920938463463374607431768211456 store.delete(Value.new(:objkey1)).should == 340282366920938463463374607431768211456 store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = 340282366920938463463374607431768211456 store[Value.new(:objkey1)].should == 340282366920938463463374607431768211456 store[Value.new(:objkey1)] = 33 store[Value.new(:objkey1)].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = 340282366920938463463374607431768211456 store[Value.new(:objkey1)].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey1)] = 340282366920938463463374607431768211456 store.fetch(Value.new(:objkey1), 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey1)] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch(Value.new(:objkey1)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = 340282366920938463463374607431768211456 store[Value.new(:objkey2)].should == 340282366920938463463374607431768211456 store.load(Value.new(:objkey2)).should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = 340282366920938463463374607431768211456 store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == 340282366920938463463374607431768211456 store.load(Value.new(:objkey2)).should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store[Value.new(:objkey2)] = 340282366920938463463374607431768211456 store[Value.new(:objkey1)] = 33 store.clear.should equal(store) store[Value.new(:objkey2)] = 340282366920938463463374607431768211456 store[Value.new(:objkey2)].should == 340282366920938463463374607431768211456 store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = 340282366920938463463374607431768211456 store.delete(Value.new(:objkey2)).should == 340282366920938463463374607431768211456 store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = 340282366920938463463374607431768211456 store[Value.new(:objkey2)].should == 340282366920938463463374607431768211456 store[Value.new(:objkey2)] = 33 store[Value.new(:objkey2)].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = 340282366920938463463374607431768211456 store[Value.new(:objkey2)].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey2)] = 340282366920938463463374607431768211456 store.fetch(Value.new(:objkey2), 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey2)] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch(Value.new(:objkey2)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = 33 store[Value.new(:objkey1)].should == 33 store.load(Value.new(:objkey1)).should == 33 end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = 33 store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = 33 store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == 33 store.load(Value.new(:objkey1)).should == 33 end it 'stores values after clear' do store[Value.new(:objkey1)] = 33 store[Value.new(:objkey2)] = 340282366920938463463374607431768211456 store.clear.should equal(store) store[Value.new(:objkey1)] = 33 store[Value.new(:objkey1)].should == 33 store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = 33 store.delete(Value.new(:objkey1)).should == 33 store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = 33 store[Value.new(:objkey1)].should == 33 store[Value.new(:objkey1)] = 340282366920938463463374607431768211456 store[Value.new(:objkey1)].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == 33 end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = 33 store[Value.new(:objkey1)].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey1)] = 33 store.fetch(Value.new(:objkey1), 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey1)] = 33 unaltered = 'unaltered' store.fetch(Value.new(:objkey1)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = 33 store[Value.new(:objkey2)].should == 33 store.load(Value.new(:objkey2)).should == 33 end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = 33 store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = 33 store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == 33 store.load(Value.new(:objkey2)).should == 33 end it 'stores values after clear' do store[Value.new(:objkey2)] = 33 store[Value.new(:objkey1)] = 340282366920938463463374607431768211456 store.clear.should equal(store) store[Value.new(:objkey2)] = 33 store[Value.new(:objkey2)].should == 33 store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = 33 store.delete(Value.new(:objkey2)).should == 33 store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = 33 store[Value.new(:objkey2)].should == 33 store[Value.new(:objkey2)] = 340282366920938463463374607431768211456 store[Value.new(:objkey2)].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == 33 end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = 33 store[Value.new(:objkey2)].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey2)] = 33 store.fetch(Value.new(:objkey2), 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey2)] = 33 unaltered = 'unaltered' store.fetch(Value.new(:objkey2)) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_objectkey_numbervalue #################### shared_examples_for 'persist_objectkey_numbervalue' do it 'persists values' do store[Value.new(:objkey1)] = 123.456 store.close @store = nil store[Value.new(:objkey1)].should == 123.456 end it 'persists values' do store[Value.new(:objkey2)] = 123.456 store.close @store = nil store[Value.new(:objkey2)].should == 123.456 end it 'persists values' do store[Value.new(:objkey1)] = -98.7 store.close @store = nil store[Value.new(:objkey1)].should == -98.7 end it 'persists values' do store[Value.new(:objkey2)] = -98.7 store.close @store = nil store[Value.new(:objkey2)].should == -98.7 end it 'persists values' do store[Value.new(:objkey1)] = 340282366920938463463374607431768211456 store.close @store = nil store[Value.new(:objkey1)].should == 340282366920938463463374607431768211456 end it 'persists values' do store[Value.new(:objkey2)] = 340282366920938463463374607431768211456 store.close @store = nil store[Value.new(:objkey2)].should == 340282366920938463463374607431768211456 end it 'persists values' do store[Value.new(:objkey1)] = 33 store.close @store = nil store[Value.new(:objkey1)].should == 33 end it 'persists values' do store[Value.new(:objkey2)] = 33 store.close @store = nil store[Value.new(:objkey2)].should == 33 end end #################### null_objectkey_booleanvalue #################### shared_examples_for 'null_objectkey_booleanvalue' do it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = true store[Value.new(:objkey2)] = false store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), true, options).should == true end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = true store[Value.new(:objkey1)] = false store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), true, options).should == true end it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = false store[Value.new(:objkey2)] = true store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), false, options).should == false end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = false store[Value.new(:objkey1)] = true store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), false, options).should == false end end #################### store_objectkey_booleanvalue #################### shared_examples_for 'store_objectkey_booleanvalue' do it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = true store[Value.new(:objkey1)].should == true store.load(Value.new(:objkey1)).should == true end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = true store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = true store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == true store.load(Value.new(:objkey1)).should == true end it 'stores values after clear' do store[Value.new(:objkey1)] = true store[Value.new(:objkey2)] = false store.clear.should equal(store) store[Value.new(:objkey1)] = true store[Value.new(:objkey1)].should == true store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = true store.delete(Value.new(:objkey1)).should == true store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = true store[Value.new(:objkey1)].should == true store[Value.new(:objkey1)] = false store[Value.new(:objkey1)].should == false end it 'stores frozen values' do value = true.freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == true end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = true store[Value.new(:objkey1)].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey1)] = true store.fetch(Value.new(:objkey1), false).should == true end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey1)] = true unaltered = 'unaltered' store.fetch(Value.new(:objkey1)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = true store[Value.new(:objkey2)].should == true store.load(Value.new(:objkey2)).should == true end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = true store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = true store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == true store.load(Value.new(:objkey2)).should == true end it 'stores values after clear' do store[Value.new(:objkey2)] = true store[Value.new(:objkey1)] = false store.clear.should equal(store) store[Value.new(:objkey2)] = true store[Value.new(:objkey2)].should == true store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = true store.delete(Value.new(:objkey2)).should == true store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = true store[Value.new(:objkey2)].should == true store[Value.new(:objkey2)] = false store[Value.new(:objkey2)].should == false end it 'stores frozen values' do value = true.freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == true end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = true store[Value.new(:objkey2)].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey2)] = true store.fetch(Value.new(:objkey2), false).should == true end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey2)] = true unaltered = 'unaltered' store.fetch(Value.new(:objkey2)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = false store[Value.new(:objkey1)].should == false store.load(Value.new(:objkey1)).should == false end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = false store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = false store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == false store.load(Value.new(:objkey1)).should == false end it 'stores values after clear' do store[Value.new(:objkey1)] = false store[Value.new(:objkey2)] = true store.clear.should equal(store) store[Value.new(:objkey1)] = false store[Value.new(:objkey1)].should == false store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = false store.delete(Value.new(:objkey1)).should == false store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = false store[Value.new(:objkey1)].should == false store[Value.new(:objkey1)] = true store[Value.new(:objkey1)].should == true end it 'stores frozen values' do value = false.freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == false end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = false store[Value.new(:objkey1)].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey1)] = false store.fetch(Value.new(:objkey1), true).should == false end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey1)] = false unaltered = 'unaltered' store.fetch(Value.new(:objkey1)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = false store[Value.new(:objkey2)].should == false store.load(Value.new(:objkey2)).should == false end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = false store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = false store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == false store.load(Value.new(:objkey2)).should == false end it 'stores values after clear' do store[Value.new(:objkey2)] = false store[Value.new(:objkey1)] = true store.clear.should equal(store) store[Value.new(:objkey2)] = false store[Value.new(:objkey2)].should == false store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = false store.delete(Value.new(:objkey2)).should == false store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = false store[Value.new(:objkey2)].should == false store[Value.new(:objkey2)] = true store[Value.new(:objkey2)].should == true end it 'stores frozen values' do value = false.freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == false end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = false store[Value.new(:objkey2)].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey2)] = false store.fetch(Value.new(:objkey2), true).should == false end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey2)] = false unaltered = 'unaltered' store.fetch(Value.new(:objkey2)) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_objectkey_booleanvalue #################### shared_examples_for 'persist_objectkey_booleanvalue' do it 'persists values' do store[Value.new(:objkey1)] = true store.close @store = nil store[Value.new(:objkey1)].should == true end it 'persists values' do store[Value.new(:objkey2)] = true store.close @store = nil store[Value.new(:objkey2)].should == true end it 'persists values' do store[Value.new(:objkey1)] = false store.close @store = nil store[Value.new(:objkey1)].should == false end it 'persists values' do store[Value.new(:objkey2)] = false store.close @store = nil store[Value.new(:objkey2)].should == false end end #################### null_objectkey_stringvalue #################### shared_examples_for 'null_objectkey_stringvalue' do it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = "strval1" store[Value.new(:objkey2)] = "strval2" store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = "strval1" store[Value.new(:objkey1)] = "strval2" store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = "strval2" store[Value.new(:objkey2)] = "strval1" store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), "strval2", options).should == "strval2" end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = "strval2" store[Value.new(:objkey1)] = "strval1" store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), "strval2", options).should == "strval2" end end #################### store_objectkey_stringvalue #################### shared_examples_for 'store_objectkey_stringvalue' do it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = "strval1" store[Value.new(:objkey1)].should == "strval1" store.load(Value.new(:objkey1)).should == "strval1" end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = "strval1" store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = "strval1" store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == "strval1" store.load(Value.new(:objkey1)).should == "strval1" end it 'stores values after clear' do store[Value.new(:objkey1)] = "strval1" store[Value.new(:objkey2)] = "strval2" store.clear.should equal(store) store[Value.new(:objkey1)] = "strval1" store[Value.new(:objkey1)].should == "strval1" store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = "strval1" store.delete(Value.new(:objkey1)).should == "strval1" store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = "strval1" store[Value.new(:objkey1)].should == "strval1" store[Value.new(:objkey1)] = "strval2" store[Value.new(:objkey1)].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == "strval1" end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = "strval1" store[Value.new(:objkey1)].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey1)] = "strval1" store.fetch(Value.new(:objkey1), "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey1)] = "strval1" unaltered = 'unaltered' store.fetch(Value.new(:objkey1)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = "strval1" store[Value.new(:objkey2)].should == "strval1" store.load(Value.new(:objkey2)).should == "strval1" end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = "strval1" store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = "strval1" store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == "strval1" store.load(Value.new(:objkey2)).should == "strval1" end it 'stores values after clear' do store[Value.new(:objkey2)] = "strval1" store[Value.new(:objkey1)] = "strval2" store.clear.should equal(store) store[Value.new(:objkey2)] = "strval1" store[Value.new(:objkey2)].should == "strval1" store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = "strval1" store.delete(Value.new(:objkey2)).should == "strval1" store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = "strval1" store[Value.new(:objkey2)].should == "strval1" store[Value.new(:objkey2)] = "strval2" store[Value.new(:objkey2)].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == "strval1" end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = "strval1" store[Value.new(:objkey2)].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey2)] = "strval1" store.fetch(Value.new(:objkey2), "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey2)] = "strval1" unaltered = 'unaltered' store.fetch(Value.new(:objkey2)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = "strval2" store[Value.new(:objkey1)].should == "strval2" store.load(Value.new(:objkey1)).should == "strval2" end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = "strval2" store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = "strval2" store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == "strval2" store.load(Value.new(:objkey1)).should == "strval2" end it 'stores values after clear' do store[Value.new(:objkey1)] = "strval2" store[Value.new(:objkey2)] = "strval1" store.clear.should equal(store) store[Value.new(:objkey1)] = "strval2" store[Value.new(:objkey1)].should == "strval2" store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = "strval2" store.delete(Value.new(:objkey1)).should == "strval2" store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = "strval2" store[Value.new(:objkey1)].should == "strval2" store[Value.new(:objkey1)] = "strval1" store[Value.new(:objkey1)].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == "strval2" end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = "strval2" store[Value.new(:objkey1)].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey1)] = "strval2" store.fetch(Value.new(:objkey1), "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey1)] = "strval2" unaltered = 'unaltered' store.fetch(Value.new(:objkey1)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = "strval2" store[Value.new(:objkey2)].should == "strval2" store.load(Value.new(:objkey2)).should == "strval2" end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = "strval2" store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = "strval2" store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == "strval2" store.load(Value.new(:objkey2)).should == "strval2" end it 'stores values after clear' do store[Value.new(:objkey2)] = "strval2" store[Value.new(:objkey1)] = "strval1" store.clear.should equal(store) store[Value.new(:objkey2)] = "strval2" store[Value.new(:objkey2)].should == "strval2" store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = "strval2" store.delete(Value.new(:objkey2)).should == "strval2" store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = "strval2" store[Value.new(:objkey2)].should == "strval2" store[Value.new(:objkey2)] = "strval1" store[Value.new(:objkey2)].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == "strval2" end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = "strval2" store[Value.new(:objkey2)].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey2)] = "strval2" store.fetch(Value.new(:objkey2), "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey2)] = "strval2" unaltered = 'unaltered' store.fetch(Value.new(:objkey2)) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_objectkey_stringvalue #################### shared_examples_for 'returndifferent_objectkey_stringvalue' do it 'guarantees that a different value is retrieved' do value = "strval1" store[Value.new(:objkey1)] = value store[Value.new(:objkey1)].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval1" store[Value.new(:objkey2)] = value store[Value.new(:objkey2)].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store[Value.new(:objkey1)] = value store[Value.new(:objkey1)].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store[Value.new(:objkey2)] = value store[Value.new(:objkey2)].should_not be_equal(value) end end #################### returnsame_objectkey_stringvalue #################### shared_examples_for 'returnsame_objectkey_stringvalue' do it 'guarantees that the same value is retrieved' do value = "strval1" store[Value.new(:objkey1)] = value store[Value.new(:objkey1)].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval1" store[Value.new(:objkey2)] = value store[Value.new(:objkey2)].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store[Value.new(:objkey1)] = value store[Value.new(:objkey1)].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store[Value.new(:objkey2)] = value store[Value.new(:objkey2)].should be_equal(value) end end #################### persist_objectkey_stringvalue #################### shared_examples_for 'persist_objectkey_stringvalue' do it 'persists values' do store[Value.new(:objkey1)] = "strval1" store.close @store = nil store[Value.new(:objkey1)].should == "strval1" end it 'persists values' do store[Value.new(:objkey2)] = "strval1" store.close @store = nil store[Value.new(:objkey2)].should == "strval1" end it 'persists values' do store[Value.new(:objkey1)] = "strval2" store.close @store = nil store[Value.new(:objkey1)].should == "strval2" end it 'persists values' do store[Value.new(:objkey2)] = "strval2" store.close @store = nil store[Value.new(:objkey2)].should == "strval2" end end #################### null_objectkey_binaryvalue #################### shared_examples_for 'null_objectkey_binaryvalue' do it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = "über" store[Value.new(:objkey2)] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), "über", options).should == "über" end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = "über" store[Value.new(:objkey1)] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), "über", options).should == "über" end it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = "\xAA\xBB\xCC" store[Value.new(:objkey2)] = "über" store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = "\xAA\xBB\xCC" store[Value.new(:objkey1)] = "über" store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end end #################### store_objectkey_binaryvalue #################### shared_examples_for 'store_objectkey_binaryvalue' do it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = "über" store[Value.new(:objkey1)].should == "über" store.load(Value.new(:objkey1)).should == "über" end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = "über" store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = "über" store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == "über" store.load(Value.new(:objkey1)).should == "über" end it 'stores values after clear' do store[Value.new(:objkey1)] = "über" store[Value.new(:objkey2)] = "\xAA\xBB\xCC" store.clear.should equal(store) store[Value.new(:objkey1)] = "über" store[Value.new(:objkey1)].should == "über" store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = "über" store.delete(Value.new(:objkey1)).should == "über" store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = "über" store[Value.new(:objkey1)].should == "über" store[Value.new(:objkey1)] = "\xAA\xBB\xCC" store[Value.new(:objkey1)].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == "über" end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = "über" store[Value.new(:objkey1)].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey1)] = "über" store.fetch(Value.new(:objkey1), "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey1)] = "über" unaltered = 'unaltered' store.fetch(Value.new(:objkey1)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = "über" store[Value.new(:objkey2)].should == "über" store.load(Value.new(:objkey2)).should == "über" end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = "über" store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = "über" store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == "über" store.load(Value.new(:objkey2)).should == "über" end it 'stores values after clear' do store[Value.new(:objkey2)] = "über" store[Value.new(:objkey1)] = "\xAA\xBB\xCC" store.clear.should equal(store) store[Value.new(:objkey2)] = "über" store[Value.new(:objkey2)].should == "über" store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = "über" store.delete(Value.new(:objkey2)).should == "über" store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = "über" store[Value.new(:objkey2)].should == "über" store[Value.new(:objkey2)] = "\xAA\xBB\xCC" store[Value.new(:objkey2)].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == "über" end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = "über" store[Value.new(:objkey2)].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey2)] = "über" store.fetch(Value.new(:objkey2), "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey2)] = "über" unaltered = 'unaltered' store.fetch(Value.new(:objkey2)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = "\xAA\xBB\xCC" store[Value.new(:objkey1)].should == "\xAA\xBB\xCC" store.load(Value.new(:objkey1)).should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = "\xAA\xBB\xCC" store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == "\xAA\xBB\xCC" store.load(Value.new(:objkey1)).should == "\xAA\xBB\xCC" end it 'stores values after clear' do store[Value.new(:objkey1)] = "\xAA\xBB\xCC" store[Value.new(:objkey2)] = "über" store.clear.should equal(store) store[Value.new(:objkey1)] = "\xAA\xBB\xCC" store[Value.new(:objkey1)].should == "\xAA\xBB\xCC" store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = "\xAA\xBB\xCC" store.delete(Value.new(:objkey1)).should == "\xAA\xBB\xCC" store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = "\xAA\xBB\xCC" store[Value.new(:objkey1)].should == "\xAA\xBB\xCC" store[Value.new(:objkey1)] = "über" store[Value.new(:objkey1)].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = "\xAA\xBB\xCC" store[Value.new(:objkey1)].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey1)] = "\xAA\xBB\xCC" store.fetch(Value.new(:objkey1), "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey1)] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch(Value.new(:objkey1)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = "\xAA\xBB\xCC" store[Value.new(:objkey2)].should == "\xAA\xBB\xCC" store.load(Value.new(:objkey2)).should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = "\xAA\xBB\xCC" store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == "\xAA\xBB\xCC" store.load(Value.new(:objkey2)).should == "\xAA\xBB\xCC" end it 'stores values after clear' do store[Value.new(:objkey2)] = "\xAA\xBB\xCC" store[Value.new(:objkey1)] = "über" store.clear.should equal(store) store[Value.new(:objkey2)] = "\xAA\xBB\xCC" store[Value.new(:objkey2)].should == "\xAA\xBB\xCC" store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = "\xAA\xBB\xCC" store.delete(Value.new(:objkey2)).should == "\xAA\xBB\xCC" store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = "\xAA\xBB\xCC" store[Value.new(:objkey2)].should == "\xAA\xBB\xCC" store[Value.new(:objkey2)] = "über" store[Value.new(:objkey2)].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = "\xAA\xBB\xCC" store[Value.new(:objkey2)].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey2)] = "\xAA\xBB\xCC" store.fetch(Value.new(:objkey2), "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey2)] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch(Value.new(:objkey2)) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_objectkey_binaryvalue #################### shared_examples_for 'returndifferent_objectkey_binaryvalue' do it 'guarantees that a different value is retrieved' do value = "über" store[Value.new(:objkey1)] = value store[Value.new(:objkey1)].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "über" store[Value.new(:objkey2)] = value store[Value.new(:objkey2)].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store[Value.new(:objkey1)] = value store[Value.new(:objkey1)].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store[Value.new(:objkey2)] = value store[Value.new(:objkey2)].should_not be_equal(value) end end #################### returnsame_objectkey_binaryvalue #################### shared_examples_for 'returnsame_objectkey_binaryvalue' do it 'guarantees that the same value is retrieved' do value = "über" store[Value.new(:objkey1)] = value store[Value.new(:objkey1)].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "über" store[Value.new(:objkey2)] = value store[Value.new(:objkey2)].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store[Value.new(:objkey1)] = value store[Value.new(:objkey1)].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store[Value.new(:objkey2)] = value store[Value.new(:objkey2)].should be_equal(value) end end #################### persist_objectkey_binaryvalue #################### shared_examples_for 'persist_objectkey_binaryvalue' do it 'persists values' do store[Value.new(:objkey1)] = "über" store.close @store = nil store[Value.new(:objkey1)].should == "über" end it 'persists values' do store[Value.new(:objkey2)] = "über" store.close @store = nil store[Value.new(:objkey2)].should == "über" end it 'persists values' do store[Value.new(:objkey1)] = "\xAA\xBB\xCC" store.close @store = nil store[Value.new(:objkey1)].should == "\xAA\xBB\xCC" end it 'persists values' do store[Value.new(:objkey2)] = "\xAA\xBB\xCC" store.close @store = nil store[Value.new(:objkey2)].should == "\xAA\xBB\xCC" end end #################### null_objectkey_hashvalue #################### shared_examples_for 'null_objectkey_hashvalue' do it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = {"hashval1"=>["array1", 1]} store[Value.new(:objkey2)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = {"hashval1"=>["array1", 1]} store[Value.new(:objkey1)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey2)] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey1)] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### store_objectkey_hashvalue #################### shared_examples_for 'store_objectkey_hashvalue' do it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = {"hashval1"=>["array1", 1]} store[Value.new(:objkey1)].should == {"hashval1"=>["array1", 1]} store.load(Value.new(:objkey1)).should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = {"hashval1"=>["array1", 1]} store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == {"hashval1"=>["array1", 1]} store.load(Value.new(:objkey1)).should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store[Value.new(:objkey1)] = {"hashval1"=>["array1", 1]} store[Value.new(:objkey2)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store[Value.new(:objkey1)] = {"hashval1"=>["array1", 1]} store[Value.new(:objkey1)].should == {"hashval1"=>["array1", 1]} store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = {"hashval1"=>["array1", 1]} store.delete(Value.new(:objkey1)).should == {"hashval1"=>["array1", 1]} store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = {"hashval1"=>["array1", 1]} store[Value.new(:objkey1)].should == {"hashval1"=>["array1", 1]} store[Value.new(:objkey1)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey1)].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = {"hashval1"=>["array1", 1]} store[Value.new(:objkey1)].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey1)] = {"hashval1"=>["array1", 1]} store.fetch(Value.new(:objkey1), {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey1)] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch(Value.new(:objkey1)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = {"hashval1"=>["array1", 1]} store[Value.new(:objkey2)].should == {"hashval1"=>["array1", 1]} store.load(Value.new(:objkey2)).should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = {"hashval1"=>["array1", 1]} store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == {"hashval1"=>["array1", 1]} store.load(Value.new(:objkey2)).should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store[Value.new(:objkey2)] = {"hashval1"=>["array1", 1]} store[Value.new(:objkey1)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store[Value.new(:objkey2)] = {"hashval1"=>["array1", 1]} store[Value.new(:objkey2)].should == {"hashval1"=>["array1", 1]} store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = {"hashval1"=>["array1", 1]} store.delete(Value.new(:objkey2)).should == {"hashval1"=>["array1", 1]} store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = {"hashval1"=>["array1", 1]} store[Value.new(:objkey2)].should == {"hashval1"=>["array1", 1]} store[Value.new(:objkey2)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey2)].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = {"hashval1"=>["array1", 1]} store[Value.new(:objkey2)].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey2)] = {"hashval1"=>["array1", 1]} store.fetch(Value.new(:objkey2), {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey2)] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch(Value.new(:objkey2)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey1)].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(Value.new(:objkey1)).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(Value.new(:objkey1)).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store[Value.new(:objkey1)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey2)] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store[Value.new(:objkey1)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey1)].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete(Value.new(:objkey1)).should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey1)].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey1)] = {"hashval1"=>["array1", 1]} store[Value.new(:objkey1)].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey1)].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey1)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(Value.new(:objkey1), {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey1)] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch(Value.new(:objkey1)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey2)].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(Value.new(:objkey2)).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load(Value.new(:objkey2)).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store[Value.new(:objkey2)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey1)] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store[Value.new(:objkey2)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey2)].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete(Value.new(:objkey2)).should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey2)].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey2)] = {"hashval1"=>["array1", 1]} store[Value.new(:objkey2)].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey2)].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey2)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(Value.new(:objkey2), {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey2)] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch(Value.new(:objkey2)) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_objectkey_hashvalue #################### shared_examples_for 'returndifferent_objectkey_hashvalue' do it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store[Value.new(:objkey1)] = value store[Value.new(:objkey1)].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store[Value.new(:objkey2)] = value store[Value.new(:objkey2)].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey1)] = value store[Value.new(:objkey1)].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey2)] = value store[Value.new(:objkey2)].should_not be_equal(value) end end #################### returnsame_objectkey_hashvalue #################### shared_examples_for 'returnsame_objectkey_hashvalue' do it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store[Value.new(:objkey1)] = value store[Value.new(:objkey1)].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store[Value.new(:objkey2)] = value store[Value.new(:objkey2)].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey1)] = value store[Value.new(:objkey1)].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[Value.new(:objkey2)] = value store[Value.new(:objkey2)].should be_equal(value) end end #################### persist_objectkey_hashvalue #################### shared_examples_for 'persist_objectkey_hashvalue' do it 'persists values' do store[Value.new(:objkey1)] = {"hashval1"=>["array1", 1]} store.close @store = nil store[Value.new(:objkey1)].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store[Value.new(:objkey2)] = {"hashval1"=>["array1", 1]} store.close @store = nil store[Value.new(:objkey2)].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store[Value.new(:objkey1)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store[Value.new(:objkey1)].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'persists values' do store[Value.new(:objkey2)] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store[Value.new(:objkey2)].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### null_objectkey_objectvalue #################### shared_examples_for 'null_objectkey_objectvalue' do it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = Value.new(:objval1) store[Value.new(:objkey2)] = Value.new(:objval2) store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = Value.new(:objval1) store[Value.new(:objkey1)] = Value.new(:objval2) store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store[Value.new(:objkey1)].should be_nil store.load(Value.new(:objkey1)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store[Value.new(:objkey1)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey1)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey1)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey1)] = Value.new(:objval2) store[Value.new(:objkey2)] = Value.new(:objval1) store.clear.should equal(store) store.key?(Value.new(:objkey1)).should be_false store.key?(Value.new(:objkey2)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey1), Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey1) value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey1), options).should be_false store.load(Value.new(:objkey1), options).should be_nil store.fetch(Value.new(:objkey1), 42, options).should == 42 store.fetch(Value.new(:objkey1), options) { 42 }.should == 42 store.delete(Value.new(:objkey1), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey1), Value.new(:objval2), options).should == Value.new(:objval2) end it 'reads from keys like a Hash' do store[Value.new(:objkey2)].should be_nil store.load(Value.new(:objkey2)).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store[Value.new(:objkey2)] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?(Value.new(:objkey2)).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete(Value.new(:objkey2)).should be_nil end it 'removes all keys from the store with clear' do store[Value.new(:objkey2)] = Value.new(:objval2) store[Value.new(:objkey1)] = Value.new(:objval1) store.clear.should equal(store) store.key?(Value.new(:objkey2)).should be_false store.key?(Value.new(:objkey1)).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch(Value.new(:objkey2), Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = Value.new(:objkey2) value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?(Value.new(:objkey2), options).should be_false store.load(Value.new(:objkey2), options).should be_nil store.fetch(Value.new(:objkey2), 42, options).should == 42 store.fetch(Value.new(:objkey2), options) { 42 }.should == 42 store.delete(Value.new(:objkey2), options).should be_nil store.clear(options).should equal(store) store.store(Value.new(:objkey2), Value.new(:objval2), options).should == Value.new(:objval2) end end #################### store_objectkey_objectvalue #################### shared_examples_for 'store_objectkey_objectvalue' do it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = Value.new(:objval1) store[Value.new(:objkey1)].should == Value.new(:objval1) store.load(Value.new(:objkey1)).should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = Value.new(:objval1) store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == Value.new(:objval1) store.load(Value.new(:objkey1)).should == Value.new(:objval1) end it 'stores values after clear' do store[Value.new(:objkey1)] = Value.new(:objval1) store[Value.new(:objkey2)] = Value.new(:objval2) store.clear.should equal(store) store[Value.new(:objkey1)] = Value.new(:objval1) store[Value.new(:objkey1)].should == Value.new(:objval1) store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = Value.new(:objval1) store.delete(Value.new(:objkey1)).should == Value.new(:objval1) store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = Value.new(:objval1) store[Value.new(:objkey1)].should == Value.new(:objval1) store[Value.new(:objkey1)] = Value.new(:objval2) store[Value.new(:objkey1)].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == Value.new(:objval1) end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = Value.new(:objval1) store[Value.new(:objkey1)].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey1)] = Value.new(:objval1) store.fetch(Value.new(:objkey1), Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey1)] = Value.new(:objval1) unaltered = 'unaltered' store.fetch(Value.new(:objkey1)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = Value.new(:objval1) store[Value.new(:objkey2)].should == Value.new(:objval1) store.load(Value.new(:objkey2)).should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = Value.new(:objval1) store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == Value.new(:objval1) store.load(Value.new(:objkey2)).should == Value.new(:objval1) end it 'stores values after clear' do store[Value.new(:objkey2)] = Value.new(:objval1) store[Value.new(:objkey1)] = Value.new(:objval2) store.clear.should equal(store) store[Value.new(:objkey2)] = Value.new(:objval1) store[Value.new(:objkey2)].should == Value.new(:objval1) store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = Value.new(:objval1) store.delete(Value.new(:objkey2)).should == Value.new(:objval1) store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = Value.new(:objval1) store[Value.new(:objkey2)].should == Value.new(:objval1) store[Value.new(:objkey2)] = Value.new(:objval2) store[Value.new(:objkey2)].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == Value.new(:objval1) end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = Value.new(:objval1) store[Value.new(:objkey2)].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey2)] = Value.new(:objval1) store.fetch(Value.new(:objkey2), Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey2)] = Value.new(:objval1) unaltered = 'unaltered' store.fetch(Value.new(:objkey2)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey1)] = Value.new(:objval2) store[Value.new(:objkey1)].should == Value.new(:objval2) store.load(Value.new(:objkey1)).should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store[Value.new(:objkey1)] = Value.new(:objval2) store.key?(Value.new(:objkey1)).should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store(Value.new(:objkey1), value).should equal(value) store[Value.new(:objkey1)].should == Value.new(:objval2) store.load(Value.new(:objkey1)).should == Value.new(:objval2) end it 'stores values after clear' do store[Value.new(:objkey1)] = Value.new(:objval2) store[Value.new(:objkey2)] = Value.new(:objval1) store.clear.should equal(store) store[Value.new(:objkey1)] = Value.new(:objval2) store[Value.new(:objkey1)].should == Value.new(:objval2) store[Value.new(:objkey2)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey1)] = Value.new(:objval2) store.delete(Value.new(:objkey1)).should == Value.new(:objval2) store.key?(Value.new(:objkey1)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey1)] = Value.new(:objval2) store[Value.new(:objkey1)].should == Value.new(:objval2) store[Value.new(:objkey1)] = Value.new(:objval1) store[Value.new(:objkey1)].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store[Value.new(:objkey1)] = value).should equal(value) store[Value.new(:objkey1)].should == Value.new(:objval2) end it 'stores frozen keys' do key = Value.new(:objkey1).freeze store[key] = Value.new(:objval2) store[Value.new(:objkey1)].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey1)] = Value.new(:objval2) store.fetch(Value.new(:objkey1), Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey1)] = Value.new(:objval2) unaltered = 'unaltered' store.fetch(Value.new(:objkey1)) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[Value.new(:objkey2)] = Value.new(:objval2) store[Value.new(:objkey2)].should == Value.new(:objval2) store.load(Value.new(:objkey2)).should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store[Value.new(:objkey2)] = Value.new(:objval2) store.key?(Value.new(:objkey2)).should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store(Value.new(:objkey2), value).should equal(value) store[Value.new(:objkey2)].should == Value.new(:objval2) store.load(Value.new(:objkey2)).should == Value.new(:objval2) end it 'stores values after clear' do store[Value.new(:objkey2)] = Value.new(:objval2) store[Value.new(:objkey1)] = Value.new(:objval1) store.clear.should equal(store) store[Value.new(:objkey2)] = Value.new(:objval2) store[Value.new(:objkey2)].should == Value.new(:objval2) store[Value.new(:objkey1)].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[Value.new(:objkey2)] = Value.new(:objval2) store.delete(Value.new(:objkey2)).should == Value.new(:objval2) store.key?(Value.new(:objkey2)).should be_false end it 'overwrites existing values' do store[Value.new(:objkey2)] = Value.new(:objval2) store[Value.new(:objkey2)].should == Value.new(:objval2) store[Value.new(:objkey2)] = Value.new(:objval1) store[Value.new(:objkey2)].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store[Value.new(:objkey2)] = value).should equal(value) store[Value.new(:objkey2)].should == Value.new(:objval2) end it 'stores frozen keys' do key = Value.new(:objkey2).freeze store[key] = Value.new(:objval2) store[Value.new(:objkey2)].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store[Value.new(:objkey2)] = Value.new(:objval2) store.fetch(Value.new(:objkey2), Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store[Value.new(:objkey2)] = Value.new(:objval2) unaltered = 'unaltered' store.fetch(Value.new(:objkey2)) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_objectkey_objectvalue #################### shared_examples_for 'returndifferent_objectkey_objectvalue' do it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store[Value.new(:objkey1)] = value store[Value.new(:objkey1)].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store[Value.new(:objkey2)] = value store[Value.new(:objkey2)].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store[Value.new(:objkey1)] = value store[Value.new(:objkey1)].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store[Value.new(:objkey2)] = value store[Value.new(:objkey2)].should_not be_equal(value) end end #################### returnsame_objectkey_objectvalue #################### shared_examples_for 'returnsame_objectkey_objectvalue' do it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store[Value.new(:objkey1)] = value store[Value.new(:objkey1)].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store[Value.new(:objkey2)] = value store[Value.new(:objkey2)].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store[Value.new(:objkey1)] = value store[Value.new(:objkey1)].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store[Value.new(:objkey2)] = value store[Value.new(:objkey2)].should be_equal(value) end end #################### persist_objectkey_objectvalue #################### shared_examples_for 'persist_objectkey_objectvalue' do it 'persists values' do store[Value.new(:objkey1)] = Value.new(:objval1) store.close @store = nil store[Value.new(:objkey1)].should == Value.new(:objval1) end it 'persists values' do store[Value.new(:objkey2)] = Value.new(:objval1) store.close @store = nil store[Value.new(:objkey2)].should == Value.new(:objval1) end it 'persists values' do store[Value.new(:objkey1)] = Value.new(:objval2) store.close @store = nil store[Value.new(:objkey1)].should == Value.new(:objval2) end it 'persists values' do store[Value.new(:objkey2)] = Value.new(:objval2) store.close @store = nil store[Value.new(:objkey2)].should == Value.new(:objval2) end end #################### null_hashkey_nilvalue #################### shared_examples_for 'null_hashkey_nilvalue' do it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = '' store[{"hashkey3"=>"hashkey4"}] = nil store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, '', options).should == '' end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = '' (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = '' store[{"hashkey1"=>"hashkey2"}] = nil store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, '').should == '' end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = '' store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, '', options).should == '' end it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = nil store[{"hashkey3"=>"hashkey4"}] = '' store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, nil, options).should == nil end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = nil (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = nil store[{"hashkey1"=>"hashkey2"}] = '' store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, nil).should == nil end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = nil store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, nil, options).should == nil end it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = 0 store[{"hashkey3"=>"hashkey4"}] = false store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, 0, options).should == 0 end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 0 (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = 0 store[{"hashkey1"=>"hashkey2"}] = false store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, 0).should == 0 end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = 0 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, 0, options).should == 0 end it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = false store[{"hashkey3"=>"hashkey4"}] = 0 store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, false, options).should == false end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = false store[{"hashkey1"=>"hashkey2"}] = 0 store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, false, options).should == false end end #################### store_hashkey_nilvalue #################### shared_examples_for 'store_hashkey_nilvalue' do it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = '' store[{"hashkey1"=>"hashkey2"}].should == '' store.load({"hashkey1"=>"hashkey2"}).should == '' end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = '' store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = '' store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == '' store.load({"hashkey1"=>"hashkey2"}).should == '' end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = '' store[{"hashkey3"=>"hashkey4"}] = nil store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = '' store[{"hashkey1"=>"hashkey2"}].should == '' store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = '' store.delete({"hashkey1"=>"hashkey2"}).should == '' store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = '' store[{"hashkey1"=>"hashkey2"}].should == '' store[{"hashkey1"=>"hashkey2"}] = nil store[{"hashkey1"=>"hashkey2"}].should == nil end it 'stores frozen values' do value = ''.freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == '' end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = '' store[{"hashkey1"=>"hashkey2"}].should == '' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = '' store[{"hashkey3"=>"hashkey4"}].should == '' store.load({"hashkey3"=>"hashkey4"}).should == '' end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = '' store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = '' store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == '' store.load({"hashkey3"=>"hashkey4"}).should == '' end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = '' store[{"hashkey1"=>"hashkey2"}] = nil store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = '' store[{"hashkey3"=>"hashkey4"}].should == '' store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = '' store.delete({"hashkey3"=>"hashkey4"}).should == '' store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = '' store[{"hashkey3"=>"hashkey4"}].should == '' store[{"hashkey3"=>"hashkey4"}] = nil store[{"hashkey3"=>"hashkey4"}].should == nil end it 'stores frozen values' do value = ''.freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == '' end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = '' store[{"hashkey3"=>"hashkey4"}].should == '' end it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = nil store[{"hashkey1"=>"hashkey2"}].should == nil store.load({"hashkey1"=>"hashkey2"}).should == nil end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = nil store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = nil store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == nil store.load({"hashkey1"=>"hashkey2"}).should == nil end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = nil store[{"hashkey3"=>"hashkey4"}] = '' store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = nil store[{"hashkey1"=>"hashkey2"}].should == nil store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = nil store.delete({"hashkey1"=>"hashkey2"}).should == nil store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = nil store[{"hashkey1"=>"hashkey2"}].should == nil store[{"hashkey1"=>"hashkey2"}] = '' store[{"hashkey1"=>"hashkey2"}].should == '' end it 'stores frozen values' do value = nil.freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == nil end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = nil store[{"hashkey1"=>"hashkey2"}].should == nil end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = nil store[{"hashkey3"=>"hashkey4"}].should == nil store.load({"hashkey3"=>"hashkey4"}).should == nil end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = nil store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = nil store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == nil store.load({"hashkey3"=>"hashkey4"}).should == nil end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = nil store[{"hashkey1"=>"hashkey2"}] = '' store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = nil store[{"hashkey3"=>"hashkey4"}].should == nil store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = nil store.delete({"hashkey3"=>"hashkey4"}).should == nil store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = nil store[{"hashkey3"=>"hashkey4"}].should == nil store[{"hashkey3"=>"hashkey4"}] = '' store[{"hashkey3"=>"hashkey4"}].should == '' end it 'stores frozen values' do value = nil.freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == nil end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = nil store[{"hashkey3"=>"hashkey4"}].should == nil end it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = 0 store[{"hashkey1"=>"hashkey2"}].should == 0 store.load({"hashkey1"=>"hashkey2"}).should == 0 end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = 0 store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = 0 store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == 0 store.load({"hashkey1"=>"hashkey2"}).should == 0 end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = 0 store[{"hashkey3"=>"hashkey4"}] = false store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = 0 store[{"hashkey1"=>"hashkey2"}].should == 0 store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = 0 store.delete({"hashkey1"=>"hashkey2"}).should == 0 store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = 0 store[{"hashkey1"=>"hashkey2"}].should == 0 store[{"hashkey1"=>"hashkey2"}] = false store[{"hashkey1"=>"hashkey2"}].should == false end it 'stores frozen values' do value = 0.freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == 0 end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = 0 store[{"hashkey1"=>"hashkey2"}].should == 0 end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = 0 store[{"hashkey3"=>"hashkey4"}].should == 0 store.load({"hashkey3"=>"hashkey4"}).should == 0 end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = 0 store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = 0 store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == 0 store.load({"hashkey3"=>"hashkey4"}).should == 0 end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = 0 store[{"hashkey1"=>"hashkey2"}] = false store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = 0 store[{"hashkey3"=>"hashkey4"}].should == 0 store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = 0 store.delete({"hashkey3"=>"hashkey4"}).should == 0 store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = 0 store[{"hashkey3"=>"hashkey4"}].should == 0 store[{"hashkey3"=>"hashkey4"}] = false store[{"hashkey3"=>"hashkey4"}].should == false end it 'stores frozen values' do value = 0.freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == 0 end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = 0 store[{"hashkey3"=>"hashkey4"}].should == 0 end it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = false store[{"hashkey1"=>"hashkey2"}].should == false store.load({"hashkey1"=>"hashkey2"}).should == false end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = false store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = false store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == false store.load({"hashkey1"=>"hashkey2"}).should == false end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = false store[{"hashkey3"=>"hashkey4"}] = 0 store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = false store[{"hashkey1"=>"hashkey2"}].should == false store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = false store.delete({"hashkey1"=>"hashkey2"}).should == false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = false store[{"hashkey1"=>"hashkey2"}].should == false store[{"hashkey1"=>"hashkey2"}] = 0 store[{"hashkey1"=>"hashkey2"}].should == 0 end it 'stores frozen values' do value = false.freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == false end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = false store[{"hashkey1"=>"hashkey2"}].should == false end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = false store[{"hashkey3"=>"hashkey4"}].should == false store.load({"hashkey3"=>"hashkey4"}).should == false end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = false store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = false store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == false store.load({"hashkey3"=>"hashkey4"}).should == false end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = false store[{"hashkey1"=>"hashkey2"}] = 0 store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = false store[{"hashkey3"=>"hashkey4"}].should == false store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = false store.delete({"hashkey3"=>"hashkey4"}).should == false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = false store[{"hashkey3"=>"hashkey4"}].should == false store[{"hashkey3"=>"hashkey4"}] = 0 store[{"hashkey3"=>"hashkey4"}].should == 0 end it 'stores frozen values' do value = false.freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == false end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = false store[{"hashkey3"=>"hashkey4"}].should == false end end #################### persist_hashkey_nilvalue #################### shared_examples_for 'persist_hashkey_nilvalue' do it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = '' store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == '' end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = '' store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == '' end it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = nil store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == nil end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = nil store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == nil end it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = 0 store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == 0 end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = 0 store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == 0 end it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = false store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == false end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = false store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == false end end #################### null_hashkey_integervalue #################### shared_examples_for 'null_hashkey_integervalue' do it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = 41 store[{"hashkey3"=>"hashkey4"}] = -12 store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, 41, options).should == 41 end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 41 (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = 41 store[{"hashkey1"=>"hashkey2"}] = -12 store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, 41).should == 41 end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = 41 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, 41, options).should == 41 end it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = -12 store[{"hashkey3"=>"hashkey4"}] = 41 store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, -12, options).should == -12 end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -12 (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = -12 store[{"hashkey1"=>"hashkey2"}] = 41 store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, -12).should == -12 end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = -12 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, -12, options).should == -12 end end #################### store_hashkey_integervalue #################### shared_examples_for 'store_hashkey_integervalue' do it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = 41 store[{"hashkey1"=>"hashkey2"}].should == 41 store.load({"hashkey1"=>"hashkey2"}).should == 41 end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = 41 store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = 41 store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == 41 store.load({"hashkey1"=>"hashkey2"}).should == 41 end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = 41 store[{"hashkey3"=>"hashkey4"}] = -12 store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = 41 store[{"hashkey1"=>"hashkey2"}].should == 41 store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = 41 store.delete({"hashkey1"=>"hashkey2"}).should == 41 store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = 41 store[{"hashkey1"=>"hashkey2"}].should == 41 store[{"hashkey1"=>"hashkey2"}] = -12 store[{"hashkey1"=>"hashkey2"}].should == -12 end it 'stores frozen values' do value = 41.freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == 41 end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = 41 store[{"hashkey1"=>"hashkey2"}].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey1"=>"hashkey2"}] = 41 store.fetch({"hashkey1"=>"hashkey2"}, -12).should == 41 end it 'does not run the block in fetch if the key is available' do store[{"hashkey1"=>"hashkey2"}] = 41 unaltered = 'unaltered' store.fetch({"hashkey1"=>"hashkey2"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = 41 store[{"hashkey3"=>"hashkey4"}].should == 41 store.load({"hashkey3"=>"hashkey4"}).should == 41 end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = 41 store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = 41 store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == 41 store.load({"hashkey3"=>"hashkey4"}).should == 41 end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = 41 store[{"hashkey1"=>"hashkey2"}] = -12 store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = 41 store[{"hashkey3"=>"hashkey4"}].should == 41 store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = 41 store.delete({"hashkey3"=>"hashkey4"}).should == 41 store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = 41 store[{"hashkey3"=>"hashkey4"}].should == 41 store[{"hashkey3"=>"hashkey4"}] = -12 store[{"hashkey3"=>"hashkey4"}].should == -12 end it 'stores frozen values' do value = 41.freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == 41 end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = 41 store[{"hashkey3"=>"hashkey4"}].should == 41 end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey3"=>"hashkey4"}] = 41 store.fetch({"hashkey3"=>"hashkey4"}, -12).should == 41 end it 'does not run the block in fetch if the key is available' do store[{"hashkey3"=>"hashkey4"}] = 41 unaltered = 'unaltered' store.fetch({"hashkey3"=>"hashkey4"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = -12 store[{"hashkey1"=>"hashkey2"}].should == -12 store.load({"hashkey1"=>"hashkey2"}).should == -12 end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = -12 store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = -12 store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == -12 store.load({"hashkey1"=>"hashkey2"}).should == -12 end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = -12 store[{"hashkey3"=>"hashkey4"}] = 41 store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = -12 store[{"hashkey1"=>"hashkey2"}].should == -12 store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = -12 store.delete({"hashkey1"=>"hashkey2"}).should == -12 store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = -12 store[{"hashkey1"=>"hashkey2"}].should == -12 store[{"hashkey1"=>"hashkey2"}] = 41 store[{"hashkey1"=>"hashkey2"}].should == 41 end it 'stores frozen values' do value = -12.freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == -12 end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = -12 store[{"hashkey1"=>"hashkey2"}].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey1"=>"hashkey2"}] = -12 store.fetch({"hashkey1"=>"hashkey2"}, 41).should == -12 end it 'does not run the block in fetch if the key is available' do store[{"hashkey1"=>"hashkey2"}] = -12 unaltered = 'unaltered' store.fetch({"hashkey1"=>"hashkey2"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = -12 store[{"hashkey3"=>"hashkey4"}].should == -12 store.load({"hashkey3"=>"hashkey4"}).should == -12 end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = -12 store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = -12 store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == -12 store.load({"hashkey3"=>"hashkey4"}).should == -12 end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = -12 store[{"hashkey1"=>"hashkey2"}] = 41 store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = -12 store[{"hashkey3"=>"hashkey4"}].should == -12 store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = -12 store.delete({"hashkey3"=>"hashkey4"}).should == -12 store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = -12 store[{"hashkey3"=>"hashkey4"}].should == -12 store[{"hashkey3"=>"hashkey4"}] = 41 store[{"hashkey3"=>"hashkey4"}].should == 41 end it 'stores frozen values' do value = -12.freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == -12 end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = -12 store[{"hashkey3"=>"hashkey4"}].should == -12 end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey3"=>"hashkey4"}] = -12 store.fetch({"hashkey3"=>"hashkey4"}, 41).should == -12 end it 'does not run the block in fetch if the key is available' do store[{"hashkey3"=>"hashkey4"}] = -12 unaltered = 'unaltered' store.fetch({"hashkey3"=>"hashkey4"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_hashkey_integervalue #################### shared_examples_for 'persist_hashkey_integervalue' do it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = 41 store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == 41 end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = 41 store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == 41 end it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = -12 store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == -12 end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = -12 store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == -12 end end #################### null_hashkey_numbervalue #################### shared_examples_for 'null_hashkey_numbervalue' do it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = 123.456 store[{"hashkey3"=>"hashkey4"}] = -98.7 store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 123.456 (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = 123.456 store[{"hashkey1"=>"hashkey2"}] = -98.7 store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, 123.456).should == 123.456 end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = 123.456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, 123.456, options).should == 123.456 end it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = -98.7 store[{"hashkey3"=>"hashkey4"}] = 123.456 store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = -98.7 (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = -98.7 store[{"hashkey1"=>"hashkey2"}] = 123.456 store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, -98.7).should == -98.7 end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = -98.7 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, -98.7, options).should == -98.7 end it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = 340282366920938463463374607431768211456 store[{"hashkey3"=>"hashkey4"}] = 33 store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 340282366920938463463374607431768211456 (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = 340282366920938463463374607431768211456 store[{"hashkey1"=>"hashkey2"}] = 33 store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, 340282366920938463463374607431768211456).should == 340282366920938463463374607431768211456 end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = 340282366920938463463374607431768211456 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, 340282366920938463463374607431768211456, options).should == 340282366920938463463374607431768211456 end it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = 33 store[{"hashkey3"=>"hashkey4"}] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, 33, options).should == 33 end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = 33 (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = 33 store[{"hashkey1"=>"hashkey2"}] = 340282366920938463463374607431768211456 store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, 33).should == 33 end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = 33 store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, 33, options).should == 33 end end #################### store_hashkey_numbervalue #################### shared_examples_for 'store_hashkey_numbervalue' do it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = 123.456 store[{"hashkey1"=>"hashkey2"}].should == 123.456 store.load({"hashkey1"=>"hashkey2"}).should == 123.456 end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = 123.456 store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = 123.456 store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == 123.456 store.load({"hashkey1"=>"hashkey2"}).should == 123.456 end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = 123.456 store[{"hashkey3"=>"hashkey4"}] = -98.7 store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = 123.456 store[{"hashkey1"=>"hashkey2"}].should == 123.456 store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = 123.456 store.delete({"hashkey1"=>"hashkey2"}).should == 123.456 store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = 123.456 store[{"hashkey1"=>"hashkey2"}].should == 123.456 store[{"hashkey1"=>"hashkey2"}] = -98.7 store[{"hashkey1"=>"hashkey2"}].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == 123.456 end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = 123.456 store[{"hashkey1"=>"hashkey2"}].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey1"=>"hashkey2"}] = 123.456 store.fetch({"hashkey1"=>"hashkey2"}, -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store[{"hashkey1"=>"hashkey2"}] = 123.456 unaltered = 'unaltered' store.fetch({"hashkey1"=>"hashkey2"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = 123.456 store[{"hashkey3"=>"hashkey4"}].should == 123.456 store.load({"hashkey3"=>"hashkey4"}).should == 123.456 end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = 123.456 store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = 123.456 store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == 123.456 store.load({"hashkey3"=>"hashkey4"}).should == 123.456 end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = 123.456 store[{"hashkey1"=>"hashkey2"}] = -98.7 store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = 123.456 store[{"hashkey3"=>"hashkey4"}].should == 123.456 store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = 123.456 store.delete({"hashkey3"=>"hashkey4"}).should == 123.456 store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = 123.456 store[{"hashkey3"=>"hashkey4"}].should == 123.456 store[{"hashkey3"=>"hashkey4"}] = -98.7 store[{"hashkey3"=>"hashkey4"}].should == -98.7 end it 'stores frozen values' do value = 123.456.freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == 123.456 end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = 123.456 store[{"hashkey3"=>"hashkey4"}].should == 123.456 end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey3"=>"hashkey4"}] = 123.456 store.fetch({"hashkey3"=>"hashkey4"}, -98.7).should == 123.456 end it 'does not run the block in fetch if the key is available' do store[{"hashkey3"=>"hashkey4"}] = 123.456 unaltered = 'unaltered' store.fetch({"hashkey3"=>"hashkey4"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = -98.7 store[{"hashkey1"=>"hashkey2"}].should == -98.7 store.load({"hashkey1"=>"hashkey2"}).should == -98.7 end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = -98.7 store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = -98.7 store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == -98.7 store.load({"hashkey1"=>"hashkey2"}).should == -98.7 end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = -98.7 store[{"hashkey3"=>"hashkey4"}] = 123.456 store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = -98.7 store[{"hashkey1"=>"hashkey2"}].should == -98.7 store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = -98.7 store.delete({"hashkey1"=>"hashkey2"}).should == -98.7 store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = -98.7 store[{"hashkey1"=>"hashkey2"}].should == -98.7 store[{"hashkey1"=>"hashkey2"}] = 123.456 store[{"hashkey1"=>"hashkey2"}].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == -98.7 end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = -98.7 store[{"hashkey1"=>"hashkey2"}].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey1"=>"hashkey2"}] = -98.7 store.fetch({"hashkey1"=>"hashkey2"}, 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store[{"hashkey1"=>"hashkey2"}] = -98.7 unaltered = 'unaltered' store.fetch({"hashkey1"=>"hashkey2"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = -98.7 store[{"hashkey3"=>"hashkey4"}].should == -98.7 store.load({"hashkey3"=>"hashkey4"}).should == -98.7 end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = -98.7 store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = -98.7 store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == -98.7 store.load({"hashkey3"=>"hashkey4"}).should == -98.7 end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = -98.7 store[{"hashkey1"=>"hashkey2"}] = 123.456 store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = -98.7 store[{"hashkey3"=>"hashkey4"}].should == -98.7 store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = -98.7 store.delete({"hashkey3"=>"hashkey4"}).should == -98.7 store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = -98.7 store[{"hashkey3"=>"hashkey4"}].should == -98.7 store[{"hashkey3"=>"hashkey4"}] = 123.456 store[{"hashkey3"=>"hashkey4"}].should == 123.456 end it 'stores frozen values' do value = -98.7.freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == -98.7 end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = -98.7 store[{"hashkey3"=>"hashkey4"}].should == -98.7 end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey3"=>"hashkey4"}] = -98.7 store.fetch({"hashkey3"=>"hashkey4"}, 123.456).should == -98.7 end it 'does not run the block in fetch if the key is available' do store[{"hashkey3"=>"hashkey4"}] = -98.7 unaltered = 'unaltered' store.fetch({"hashkey3"=>"hashkey4"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = 340282366920938463463374607431768211456 store[{"hashkey1"=>"hashkey2"}].should == 340282366920938463463374607431768211456 store.load({"hashkey1"=>"hashkey2"}).should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = 340282366920938463463374607431768211456 store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == 340282366920938463463374607431768211456 store.load({"hashkey1"=>"hashkey2"}).should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = 340282366920938463463374607431768211456 store[{"hashkey3"=>"hashkey4"}] = 33 store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = 340282366920938463463374607431768211456 store[{"hashkey1"=>"hashkey2"}].should == 340282366920938463463374607431768211456 store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = 340282366920938463463374607431768211456 store.delete({"hashkey1"=>"hashkey2"}).should == 340282366920938463463374607431768211456 store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = 340282366920938463463374607431768211456 store[{"hashkey1"=>"hashkey2"}].should == 340282366920938463463374607431768211456 store[{"hashkey1"=>"hashkey2"}] = 33 store[{"hashkey1"=>"hashkey2"}].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = 340282366920938463463374607431768211456 store[{"hashkey1"=>"hashkey2"}].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey1"=>"hashkey2"}] = 340282366920938463463374607431768211456 store.fetch({"hashkey1"=>"hashkey2"}, 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store[{"hashkey1"=>"hashkey2"}] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch({"hashkey1"=>"hashkey2"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = 340282366920938463463374607431768211456 store[{"hashkey3"=>"hashkey4"}].should == 340282366920938463463374607431768211456 store.load({"hashkey3"=>"hashkey4"}).should == 340282366920938463463374607431768211456 end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = 340282366920938463463374607431768211456 store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = 340282366920938463463374607431768211456 store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == 340282366920938463463374607431768211456 store.load({"hashkey3"=>"hashkey4"}).should == 340282366920938463463374607431768211456 end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = 340282366920938463463374607431768211456 store[{"hashkey1"=>"hashkey2"}] = 33 store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = 340282366920938463463374607431768211456 store[{"hashkey3"=>"hashkey4"}].should == 340282366920938463463374607431768211456 store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = 340282366920938463463374607431768211456 store.delete({"hashkey3"=>"hashkey4"}).should == 340282366920938463463374607431768211456 store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = 340282366920938463463374607431768211456 store[{"hashkey3"=>"hashkey4"}].should == 340282366920938463463374607431768211456 store[{"hashkey3"=>"hashkey4"}] = 33 store[{"hashkey3"=>"hashkey4"}].should == 33 end it 'stores frozen values' do value = 340282366920938463463374607431768211456.freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == 340282366920938463463374607431768211456 end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = 340282366920938463463374607431768211456 store[{"hashkey3"=>"hashkey4"}].should == 340282366920938463463374607431768211456 end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey3"=>"hashkey4"}] = 340282366920938463463374607431768211456 store.fetch({"hashkey3"=>"hashkey4"}, 33).should == 340282366920938463463374607431768211456 end it 'does not run the block in fetch if the key is available' do store[{"hashkey3"=>"hashkey4"}] = 340282366920938463463374607431768211456 unaltered = 'unaltered' store.fetch({"hashkey3"=>"hashkey4"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = 33 store[{"hashkey1"=>"hashkey2"}].should == 33 store.load({"hashkey1"=>"hashkey2"}).should == 33 end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = 33 store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = 33 store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == 33 store.load({"hashkey1"=>"hashkey2"}).should == 33 end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = 33 store[{"hashkey3"=>"hashkey4"}] = 340282366920938463463374607431768211456 store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = 33 store[{"hashkey1"=>"hashkey2"}].should == 33 store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = 33 store.delete({"hashkey1"=>"hashkey2"}).should == 33 store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = 33 store[{"hashkey1"=>"hashkey2"}].should == 33 store[{"hashkey1"=>"hashkey2"}] = 340282366920938463463374607431768211456 store[{"hashkey1"=>"hashkey2"}].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == 33 end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = 33 store[{"hashkey1"=>"hashkey2"}].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey1"=>"hashkey2"}] = 33 store.fetch({"hashkey1"=>"hashkey2"}, 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store[{"hashkey1"=>"hashkey2"}] = 33 unaltered = 'unaltered' store.fetch({"hashkey1"=>"hashkey2"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = 33 store[{"hashkey3"=>"hashkey4"}].should == 33 store.load({"hashkey3"=>"hashkey4"}).should == 33 end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = 33 store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = 33 store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == 33 store.load({"hashkey3"=>"hashkey4"}).should == 33 end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = 33 store[{"hashkey1"=>"hashkey2"}] = 340282366920938463463374607431768211456 store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = 33 store[{"hashkey3"=>"hashkey4"}].should == 33 store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = 33 store.delete({"hashkey3"=>"hashkey4"}).should == 33 store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = 33 store[{"hashkey3"=>"hashkey4"}].should == 33 store[{"hashkey3"=>"hashkey4"}] = 340282366920938463463374607431768211456 store[{"hashkey3"=>"hashkey4"}].should == 340282366920938463463374607431768211456 end it 'stores frozen values' do value = 33.freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == 33 end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = 33 store[{"hashkey3"=>"hashkey4"}].should == 33 end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey3"=>"hashkey4"}] = 33 store.fetch({"hashkey3"=>"hashkey4"}, 340282366920938463463374607431768211456).should == 33 end it 'does not run the block in fetch if the key is available' do store[{"hashkey3"=>"hashkey4"}] = 33 unaltered = 'unaltered' store.fetch({"hashkey3"=>"hashkey4"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_hashkey_numbervalue #################### shared_examples_for 'persist_hashkey_numbervalue' do it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = 123.456 store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == 123.456 end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = 123.456 store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == 123.456 end it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = -98.7 store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == -98.7 end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = -98.7 store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == -98.7 end it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = 340282366920938463463374607431768211456 store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == 340282366920938463463374607431768211456 end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = 340282366920938463463374607431768211456 store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == 340282366920938463463374607431768211456 end it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = 33 store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == 33 end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = 33 store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == 33 end end #################### null_hashkey_booleanvalue #################### shared_examples_for 'null_hashkey_booleanvalue' do it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = true store[{"hashkey3"=>"hashkey4"}] = false store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, true, options).should == true end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = true (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = true store[{"hashkey1"=>"hashkey2"}] = false store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, true).should == true end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = true store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, true, options).should == true end it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = false store[{"hashkey3"=>"hashkey4"}] = true store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, false, options).should == false end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = false (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = false store[{"hashkey1"=>"hashkey2"}] = true store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, false).should == false end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = false store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, false, options).should == false end end #################### store_hashkey_booleanvalue #################### shared_examples_for 'store_hashkey_booleanvalue' do it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = true store[{"hashkey1"=>"hashkey2"}].should == true store.load({"hashkey1"=>"hashkey2"}).should == true end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = true store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = true store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == true store.load({"hashkey1"=>"hashkey2"}).should == true end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = true store[{"hashkey3"=>"hashkey4"}] = false store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = true store[{"hashkey1"=>"hashkey2"}].should == true store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = true store.delete({"hashkey1"=>"hashkey2"}).should == true store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = true store[{"hashkey1"=>"hashkey2"}].should == true store[{"hashkey1"=>"hashkey2"}] = false store[{"hashkey1"=>"hashkey2"}].should == false end it 'stores frozen values' do value = true.freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == true end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = true store[{"hashkey1"=>"hashkey2"}].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey1"=>"hashkey2"}] = true store.fetch({"hashkey1"=>"hashkey2"}, false).should == true end it 'does not run the block in fetch if the key is available' do store[{"hashkey1"=>"hashkey2"}] = true unaltered = 'unaltered' store.fetch({"hashkey1"=>"hashkey2"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = true store[{"hashkey3"=>"hashkey4"}].should == true store.load({"hashkey3"=>"hashkey4"}).should == true end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = true store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = true store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == true store.load({"hashkey3"=>"hashkey4"}).should == true end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = true store[{"hashkey1"=>"hashkey2"}] = false store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = true store[{"hashkey3"=>"hashkey4"}].should == true store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = true store.delete({"hashkey3"=>"hashkey4"}).should == true store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = true store[{"hashkey3"=>"hashkey4"}].should == true store[{"hashkey3"=>"hashkey4"}] = false store[{"hashkey3"=>"hashkey4"}].should == false end it 'stores frozen values' do value = true.freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == true end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = true store[{"hashkey3"=>"hashkey4"}].should == true end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey3"=>"hashkey4"}] = true store.fetch({"hashkey3"=>"hashkey4"}, false).should == true end it 'does not run the block in fetch if the key is available' do store[{"hashkey3"=>"hashkey4"}] = true unaltered = 'unaltered' store.fetch({"hashkey3"=>"hashkey4"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = false store[{"hashkey1"=>"hashkey2"}].should == false store.load({"hashkey1"=>"hashkey2"}).should == false end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = false store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = false store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == false store.load({"hashkey1"=>"hashkey2"}).should == false end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = false store[{"hashkey3"=>"hashkey4"}] = true store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = false store[{"hashkey1"=>"hashkey2"}].should == false store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = false store.delete({"hashkey1"=>"hashkey2"}).should == false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = false store[{"hashkey1"=>"hashkey2"}].should == false store[{"hashkey1"=>"hashkey2"}] = true store[{"hashkey1"=>"hashkey2"}].should == true end it 'stores frozen values' do value = false.freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == false end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = false store[{"hashkey1"=>"hashkey2"}].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey1"=>"hashkey2"}] = false store.fetch({"hashkey1"=>"hashkey2"}, true).should == false end it 'does not run the block in fetch if the key is available' do store[{"hashkey1"=>"hashkey2"}] = false unaltered = 'unaltered' store.fetch({"hashkey1"=>"hashkey2"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = false store[{"hashkey3"=>"hashkey4"}].should == false store.load({"hashkey3"=>"hashkey4"}).should == false end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = false store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = false store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == false store.load({"hashkey3"=>"hashkey4"}).should == false end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = false store[{"hashkey1"=>"hashkey2"}] = true store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = false store[{"hashkey3"=>"hashkey4"}].should == false store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = false store.delete({"hashkey3"=>"hashkey4"}).should == false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = false store[{"hashkey3"=>"hashkey4"}].should == false store[{"hashkey3"=>"hashkey4"}] = true store[{"hashkey3"=>"hashkey4"}].should == true end it 'stores frozen values' do value = false.freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == false end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = false store[{"hashkey3"=>"hashkey4"}].should == false end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey3"=>"hashkey4"}] = false store.fetch({"hashkey3"=>"hashkey4"}, true).should == false end it 'does not run the block in fetch if the key is available' do store[{"hashkey3"=>"hashkey4"}] = false unaltered = 'unaltered' store.fetch({"hashkey3"=>"hashkey4"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### persist_hashkey_booleanvalue #################### shared_examples_for 'persist_hashkey_booleanvalue' do it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = true store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == true end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = true store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == true end it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = false store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == false end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = false store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == false end end #################### null_hashkey_stringvalue #################### shared_examples_for 'null_hashkey_stringvalue' do it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = "strval1" store[{"hashkey3"=>"hashkey4"}] = "strval2" store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval1" (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = "strval1" store[{"hashkey1"=>"hashkey2"}] = "strval2" store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, "strval1").should == "strval1" end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = "strval1" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, "strval1", options).should == "strval1" end it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = "strval2" store[{"hashkey3"=>"hashkey4"}] = "strval1" store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, "strval2", options).should == "strval2" end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "strval2" (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = "strval2" store[{"hashkey1"=>"hashkey2"}] = "strval1" store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, "strval2").should == "strval2" end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = "strval2" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, "strval2", options).should == "strval2" end end #################### store_hashkey_stringvalue #################### shared_examples_for 'store_hashkey_stringvalue' do it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = "strval1" store[{"hashkey1"=>"hashkey2"}].should == "strval1" store.load({"hashkey1"=>"hashkey2"}).should == "strval1" end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = "strval1" store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = "strval1" store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == "strval1" store.load({"hashkey1"=>"hashkey2"}).should == "strval1" end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = "strval1" store[{"hashkey3"=>"hashkey4"}] = "strval2" store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = "strval1" store[{"hashkey1"=>"hashkey2"}].should == "strval1" store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = "strval1" store.delete({"hashkey1"=>"hashkey2"}).should == "strval1" store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = "strval1" store[{"hashkey1"=>"hashkey2"}].should == "strval1" store[{"hashkey1"=>"hashkey2"}] = "strval2" store[{"hashkey1"=>"hashkey2"}].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == "strval1" end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = "strval1" store[{"hashkey1"=>"hashkey2"}].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey1"=>"hashkey2"}] = "strval1" store.fetch({"hashkey1"=>"hashkey2"}, "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store[{"hashkey1"=>"hashkey2"}] = "strval1" unaltered = 'unaltered' store.fetch({"hashkey1"=>"hashkey2"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = "strval1" store[{"hashkey3"=>"hashkey4"}].should == "strval1" store.load({"hashkey3"=>"hashkey4"}).should == "strval1" end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = "strval1" store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = "strval1" store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == "strval1" store.load({"hashkey3"=>"hashkey4"}).should == "strval1" end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = "strval1" store[{"hashkey1"=>"hashkey2"}] = "strval2" store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = "strval1" store[{"hashkey3"=>"hashkey4"}].should == "strval1" store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = "strval1" store.delete({"hashkey3"=>"hashkey4"}).should == "strval1" store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = "strval1" store[{"hashkey3"=>"hashkey4"}].should == "strval1" store[{"hashkey3"=>"hashkey4"}] = "strval2" store[{"hashkey3"=>"hashkey4"}].should == "strval2" end it 'stores frozen values' do value = "strval1".freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == "strval1" end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = "strval1" store[{"hashkey3"=>"hashkey4"}].should == "strval1" end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey3"=>"hashkey4"}] = "strval1" store.fetch({"hashkey3"=>"hashkey4"}, "strval2").should == "strval1" end it 'does not run the block in fetch if the key is available' do store[{"hashkey3"=>"hashkey4"}] = "strval1" unaltered = 'unaltered' store.fetch({"hashkey3"=>"hashkey4"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = "strval2" store[{"hashkey1"=>"hashkey2"}].should == "strval2" store.load({"hashkey1"=>"hashkey2"}).should == "strval2" end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = "strval2" store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = "strval2" store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == "strval2" store.load({"hashkey1"=>"hashkey2"}).should == "strval2" end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = "strval2" store[{"hashkey3"=>"hashkey4"}] = "strval1" store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = "strval2" store[{"hashkey1"=>"hashkey2"}].should == "strval2" store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = "strval2" store.delete({"hashkey1"=>"hashkey2"}).should == "strval2" store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = "strval2" store[{"hashkey1"=>"hashkey2"}].should == "strval2" store[{"hashkey1"=>"hashkey2"}] = "strval1" store[{"hashkey1"=>"hashkey2"}].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == "strval2" end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = "strval2" store[{"hashkey1"=>"hashkey2"}].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey1"=>"hashkey2"}] = "strval2" store.fetch({"hashkey1"=>"hashkey2"}, "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store[{"hashkey1"=>"hashkey2"}] = "strval2" unaltered = 'unaltered' store.fetch({"hashkey1"=>"hashkey2"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = "strval2" store[{"hashkey3"=>"hashkey4"}].should == "strval2" store.load({"hashkey3"=>"hashkey4"}).should == "strval2" end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = "strval2" store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = "strval2" store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == "strval2" store.load({"hashkey3"=>"hashkey4"}).should == "strval2" end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = "strval2" store[{"hashkey1"=>"hashkey2"}] = "strval1" store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = "strval2" store[{"hashkey3"=>"hashkey4"}].should == "strval2" store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = "strval2" store.delete({"hashkey3"=>"hashkey4"}).should == "strval2" store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = "strval2" store[{"hashkey3"=>"hashkey4"}].should == "strval2" store[{"hashkey3"=>"hashkey4"}] = "strval1" store[{"hashkey3"=>"hashkey4"}].should == "strval1" end it 'stores frozen values' do value = "strval2".freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == "strval2" end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = "strval2" store[{"hashkey3"=>"hashkey4"}].should == "strval2" end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey3"=>"hashkey4"}] = "strval2" store.fetch({"hashkey3"=>"hashkey4"}, "strval1").should == "strval2" end it 'does not run the block in fetch if the key is available' do store[{"hashkey3"=>"hashkey4"}] = "strval2" unaltered = 'unaltered' store.fetch({"hashkey3"=>"hashkey4"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_hashkey_stringvalue #################### shared_examples_for 'returndifferent_hashkey_stringvalue' do it 'guarantees that a different value is retrieved' do value = "strval1" store[{"hashkey1"=>"hashkey2"}] = value store[{"hashkey1"=>"hashkey2"}].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval1" store[{"hashkey3"=>"hashkey4"}] = value store[{"hashkey3"=>"hashkey4"}].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store[{"hashkey1"=>"hashkey2"}] = value store[{"hashkey1"=>"hashkey2"}].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "strval2" store[{"hashkey3"=>"hashkey4"}] = value store[{"hashkey3"=>"hashkey4"}].should_not be_equal(value) end end #################### returnsame_hashkey_stringvalue #################### shared_examples_for 'returnsame_hashkey_stringvalue' do it 'guarantees that the same value is retrieved' do value = "strval1" store[{"hashkey1"=>"hashkey2"}] = value store[{"hashkey1"=>"hashkey2"}].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval1" store[{"hashkey3"=>"hashkey4"}] = value store[{"hashkey3"=>"hashkey4"}].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store[{"hashkey1"=>"hashkey2"}] = value store[{"hashkey1"=>"hashkey2"}].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "strval2" store[{"hashkey3"=>"hashkey4"}] = value store[{"hashkey3"=>"hashkey4"}].should be_equal(value) end end #################### persist_hashkey_stringvalue #################### shared_examples_for 'persist_hashkey_stringvalue' do it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = "strval1" store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == "strval1" end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = "strval1" store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == "strval1" end it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = "strval2" store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == "strval2" end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = "strval2" store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == "strval2" end end #################### null_hashkey_binaryvalue #################### shared_examples_for 'null_hashkey_binaryvalue' do it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = "über" store[{"hashkey3"=>"hashkey4"}] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, "über", options).should == "über" end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "über" (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = "über" store[{"hashkey1"=>"hashkey2"}] = "\xAA\xBB\xCC" store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, "über").should == "über" end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = "über" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, "über", options).should == "über" end it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = "\xAA\xBB\xCC" store[{"hashkey3"=>"hashkey4"}] = "über" store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = "\xAA\xBB\xCC" (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = "\xAA\xBB\xCC" store[{"hashkey1"=>"hashkey2"}] = "über" store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, "\xAA\xBB\xCC").should == "\xAA\xBB\xCC" end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = "\xAA\xBB\xCC" store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, "\xAA\xBB\xCC", options).should == "\xAA\xBB\xCC" end end #################### store_hashkey_binaryvalue #################### shared_examples_for 'store_hashkey_binaryvalue' do it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = "über" store[{"hashkey1"=>"hashkey2"}].should == "über" store.load({"hashkey1"=>"hashkey2"}).should == "über" end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = "über" store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = "über" store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == "über" store.load({"hashkey1"=>"hashkey2"}).should == "über" end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = "über" store[{"hashkey3"=>"hashkey4"}] = "\xAA\xBB\xCC" store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = "über" store[{"hashkey1"=>"hashkey2"}].should == "über" store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = "über" store.delete({"hashkey1"=>"hashkey2"}).should == "über" store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = "über" store[{"hashkey1"=>"hashkey2"}].should == "über" store[{"hashkey1"=>"hashkey2"}] = "\xAA\xBB\xCC" store[{"hashkey1"=>"hashkey2"}].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == "über" end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = "über" store[{"hashkey1"=>"hashkey2"}].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey1"=>"hashkey2"}] = "über" store.fetch({"hashkey1"=>"hashkey2"}, "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store[{"hashkey1"=>"hashkey2"}] = "über" unaltered = 'unaltered' store.fetch({"hashkey1"=>"hashkey2"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = "über" store[{"hashkey3"=>"hashkey4"}].should == "über" store.load({"hashkey3"=>"hashkey4"}).should == "über" end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = "über" store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = "über" store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == "über" store.load({"hashkey3"=>"hashkey4"}).should == "über" end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = "über" store[{"hashkey1"=>"hashkey2"}] = "\xAA\xBB\xCC" store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = "über" store[{"hashkey3"=>"hashkey4"}].should == "über" store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = "über" store.delete({"hashkey3"=>"hashkey4"}).should == "über" store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = "über" store[{"hashkey3"=>"hashkey4"}].should == "über" store[{"hashkey3"=>"hashkey4"}] = "\xAA\xBB\xCC" store[{"hashkey3"=>"hashkey4"}].should == "\xAA\xBB\xCC" end it 'stores frozen values' do value = "über".freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == "über" end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = "über" store[{"hashkey3"=>"hashkey4"}].should == "über" end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey3"=>"hashkey4"}] = "über" store.fetch({"hashkey3"=>"hashkey4"}, "\xAA\xBB\xCC").should == "über" end it 'does not run the block in fetch if the key is available' do store[{"hashkey3"=>"hashkey4"}] = "über" unaltered = 'unaltered' store.fetch({"hashkey3"=>"hashkey4"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = "\xAA\xBB\xCC" store[{"hashkey1"=>"hashkey2"}].should == "\xAA\xBB\xCC" store.load({"hashkey1"=>"hashkey2"}).should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = "\xAA\xBB\xCC" store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == "\xAA\xBB\xCC" store.load({"hashkey1"=>"hashkey2"}).should == "\xAA\xBB\xCC" end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = "\xAA\xBB\xCC" store[{"hashkey3"=>"hashkey4"}] = "über" store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = "\xAA\xBB\xCC" store[{"hashkey1"=>"hashkey2"}].should == "\xAA\xBB\xCC" store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = "\xAA\xBB\xCC" store.delete({"hashkey1"=>"hashkey2"}).should == "\xAA\xBB\xCC" store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = "\xAA\xBB\xCC" store[{"hashkey1"=>"hashkey2"}].should == "\xAA\xBB\xCC" store[{"hashkey1"=>"hashkey2"}] = "über" store[{"hashkey1"=>"hashkey2"}].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = "\xAA\xBB\xCC" store[{"hashkey1"=>"hashkey2"}].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey1"=>"hashkey2"}] = "\xAA\xBB\xCC" store.fetch({"hashkey1"=>"hashkey2"}, "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store[{"hashkey1"=>"hashkey2"}] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch({"hashkey1"=>"hashkey2"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = "\xAA\xBB\xCC" store[{"hashkey3"=>"hashkey4"}].should == "\xAA\xBB\xCC" store.load({"hashkey3"=>"hashkey4"}).should == "\xAA\xBB\xCC" end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = "\xAA\xBB\xCC" store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = "\xAA\xBB\xCC" store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == "\xAA\xBB\xCC" store.load({"hashkey3"=>"hashkey4"}).should == "\xAA\xBB\xCC" end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = "\xAA\xBB\xCC" store[{"hashkey1"=>"hashkey2"}] = "über" store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = "\xAA\xBB\xCC" store[{"hashkey3"=>"hashkey4"}].should == "\xAA\xBB\xCC" store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = "\xAA\xBB\xCC" store.delete({"hashkey3"=>"hashkey4"}).should == "\xAA\xBB\xCC" store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = "\xAA\xBB\xCC" store[{"hashkey3"=>"hashkey4"}].should == "\xAA\xBB\xCC" store[{"hashkey3"=>"hashkey4"}] = "über" store[{"hashkey3"=>"hashkey4"}].should == "über" end it 'stores frozen values' do value = "\xAA\xBB\xCC".freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == "\xAA\xBB\xCC" end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = "\xAA\xBB\xCC" store[{"hashkey3"=>"hashkey4"}].should == "\xAA\xBB\xCC" end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey3"=>"hashkey4"}] = "\xAA\xBB\xCC" store.fetch({"hashkey3"=>"hashkey4"}, "über").should == "\xAA\xBB\xCC" end it 'does not run the block in fetch if the key is available' do store[{"hashkey3"=>"hashkey4"}] = "\xAA\xBB\xCC" unaltered = 'unaltered' store.fetch({"hashkey3"=>"hashkey4"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_hashkey_binaryvalue #################### shared_examples_for 'returndifferent_hashkey_binaryvalue' do it 'guarantees that a different value is retrieved' do value = "über" store[{"hashkey1"=>"hashkey2"}] = value store[{"hashkey1"=>"hashkey2"}].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "über" store[{"hashkey3"=>"hashkey4"}] = value store[{"hashkey3"=>"hashkey4"}].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store[{"hashkey1"=>"hashkey2"}] = value store[{"hashkey1"=>"hashkey2"}].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = "\xAA\xBB\xCC" store[{"hashkey3"=>"hashkey4"}] = value store[{"hashkey3"=>"hashkey4"}].should_not be_equal(value) end end #################### returnsame_hashkey_binaryvalue #################### shared_examples_for 'returnsame_hashkey_binaryvalue' do it 'guarantees that the same value is retrieved' do value = "über" store[{"hashkey1"=>"hashkey2"}] = value store[{"hashkey1"=>"hashkey2"}].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "über" store[{"hashkey3"=>"hashkey4"}] = value store[{"hashkey3"=>"hashkey4"}].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store[{"hashkey1"=>"hashkey2"}] = value store[{"hashkey1"=>"hashkey2"}].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = "\xAA\xBB\xCC" store[{"hashkey3"=>"hashkey4"}] = value store[{"hashkey3"=>"hashkey4"}].should be_equal(value) end end #################### persist_hashkey_binaryvalue #################### shared_examples_for 'persist_hashkey_binaryvalue' do it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = "über" store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == "über" end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = "über" store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == "über" end it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = "\xAA\xBB\xCC" store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == "\xAA\xBB\xCC" end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = "\xAA\xBB\xCC" store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == "\xAA\xBB\xCC" end end #################### null_hashkey_hashvalue #################### shared_examples_for 'null_hashkey_hashvalue' do it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = {"hashval1"=>["array1", 1]} store[{"hashkey3"=>"hashkey4"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval1"=>["array1", 1]} (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = {"hashval1"=>["array1", 1]} store[{"hashkey1"=>"hashkey2"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, {"hashval1"=>["array1", 1]}).should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = {"hashval1"=>["array1", 1]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, {"hashval1"=>["array1", 1]}, options).should == {"hashval1"=>["array1", 1]} end it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey3"=>"hashkey4"}] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey1"=>"hashkey2"}] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, {"hashval3"=>["array2", {"hashval4"=>42}]}, options).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### store_hashkey_hashvalue #################### shared_examples_for 'store_hashkey_hashvalue' do it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = {"hashval1"=>["array1", 1]} store[{"hashkey1"=>"hashkey2"}].should == {"hashval1"=>["array1", 1]} store.load({"hashkey1"=>"hashkey2"}).should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = {"hashval1"=>["array1", 1]} store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == {"hashval1"=>["array1", 1]} store.load({"hashkey1"=>"hashkey2"}).should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = {"hashval1"=>["array1", 1]} store[{"hashkey3"=>"hashkey4"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = {"hashval1"=>["array1", 1]} store[{"hashkey1"=>"hashkey2"}].should == {"hashval1"=>["array1", 1]} store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = {"hashval1"=>["array1", 1]} store.delete({"hashkey1"=>"hashkey2"}).should == {"hashval1"=>["array1", 1]} store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = {"hashval1"=>["array1", 1]} store[{"hashkey1"=>"hashkey2"}].should == {"hashval1"=>["array1", 1]} store[{"hashkey1"=>"hashkey2"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey1"=>"hashkey2"}].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = {"hashval1"=>["array1", 1]} store[{"hashkey1"=>"hashkey2"}].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey1"=>"hashkey2"}] = {"hashval1"=>["array1", 1]} store.fetch({"hashkey1"=>"hashkey2"}, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store[{"hashkey1"=>"hashkey2"}] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch({"hashkey1"=>"hashkey2"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = {"hashval1"=>["array1", 1]} store[{"hashkey3"=>"hashkey4"}].should == {"hashval1"=>["array1", 1]} store.load({"hashkey3"=>"hashkey4"}).should == {"hashval1"=>["array1", 1]} end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = {"hashval1"=>["array1", 1]} store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = {"hashval1"=>["array1", 1]} store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == {"hashval1"=>["array1", 1]} store.load({"hashkey3"=>"hashkey4"}).should == {"hashval1"=>["array1", 1]} end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = {"hashval1"=>["array1", 1]} store[{"hashkey1"=>"hashkey2"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = {"hashval1"=>["array1", 1]} store[{"hashkey3"=>"hashkey4"}].should == {"hashval1"=>["array1", 1]} store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = {"hashval1"=>["array1", 1]} store.delete({"hashkey3"=>"hashkey4"}).should == {"hashval1"=>["array1", 1]} store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = {"hashval1"=>["array1", 1]} store[{"hashkey3"=>"hashkey4"}].should == {"hashval1"=>["array1", 1]} store[{"hashkey3"=>"hashkey4"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey3"=>"hashkey4"}].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen values' do value = {"hashval1"=>["array1", 1]}.freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == {"hashval1"=>["array1", 1]} end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = {"hashval1"=>["array1", 1]} store[{"hashkey3"=>"hashkey4"}].should == {"hashval1"=>["array1", 1]} end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey3"=>"hashkey4"}] = {"hashval1"=>["array1", 1]} store.fetch({"hashkey3"=>"hashkey4"}, {"hashval3"=>["array2", {"hashval4"=>42}]}).should == {"hashval1"=>["array1", 1]} end it 'does not run the block in fetch if the key is available' do store[{"hashkey3"=>"hashkey4"}] = {"hashval1"=>["array1", 1]} unaltered = 'unaltered' store.fetch({"hashkey3"=>"hashkey4"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey1"=>"hashkey2"}].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load({"hashkey1"=>"hashkey2"}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load({"hashkey1"=>"hashkey2"}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey3"=>"hashkey4"}] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey1"=>"hashkey2"}].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete({"hashkey1"=>"hashkey2"}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey1"=>"hashkey2"}].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey1"=>"hashkey2"}] = {"hashval1"=>["array1", 1]} store[{"hashkey1"=>"hashkey2"}].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey1"=>"hashkey2"}].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey1"=>"hashkey2"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch({"hashkey1"=>"hashkey2"}, {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store[{"hashkey1"=>"hashkey2"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch({"hashkey1"=>"hashkey2"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey3"=>"hashkey4"}].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load({"hashkey3"=>"hashkey4"}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.load({"hashkey3"=>"hashkey4"}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey1"=>"hashkey2"}] = {"hashval1"=>["array1", 1]} store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey3"=>"hashkey4"}].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.delete({"hashkey3"=>"hashkey4"}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey3"=>"hashkey4"}].should == {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey3"=>"hashkey4"}] = {"hashval1"=>["array1", 1]} store[{"hashkey3"=>"hashkey4"}].should == {"hashval1"=>["array1", 1]} end it 'stores frozen values' do value = {"hashval3"=>["array2", {"hashval4"=>42}]}.freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey3"=>"hashkey4"}].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey3"=>"hashkey4"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.fetch({"hashkey3"=>"hashkey4"}, {"hashval1"=>["array1", 1]}).should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'does not run the block in fetch if the key is available' do store[{"hashkey3"=>"hashkey4"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} unaltered = 'unaltered' store.fetch({"hashkey3"=>"hashkey4"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_hashkey_hashvalue #################### shared_examples_for 'returndifferent_hashkey_hashvalue' do it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store[{"hashkey1"=>"hashkey2"}] = value store[{"hashkey1"=>"hashkey2"}].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval1"=>["array1", 1]} store[{"hashkey3"=>"hashkey4"}] = value store[{"hashkey3"=>"hashkey4"}].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey1"=>"hashkey2"}] = value store[{"hashkey1"=>"hashkey2"}].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey3"=>"hashkey4"}] = value store[{"hashkey3"=>"hashkey4"}].should_not be_equal(value) end end #################### returnsame_hashkey_hashvalue #################### shared_examples_for 'returnsame_hashkey_hashvalue' do it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store[{"hashkey1"=>"hashkey2"}] = value store[{"hashkey1"=>"hashkey2"}].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval1"=>["array1", 1]} store[{"hashkey3"=>"hashkey4"}] = value store[{"hashkey3"=>"hashkey4"}].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey1"=>"hashkey2"}] = value store[{"hashkey1"=>"hashkey2"}].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = {"hashval3"=>["array2", {"hashval4"=>42}]} store[{"hashkey3"=>"hashkey4"}] = value store[{"hashkey3"=>"hashkey4"}].should be_equal(value) end end #################### persist_hashkey_hashvalue #################### shared_examples_for 'persist_hashkey_hashvalue' do it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = {"hashval1"=>["array1", 1]} store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = {"hashval1"=>["array1", 1]} store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == {"hashval1"=>["array1", 1]} end it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = {"hashval3"=>["array2", {"hashval4"=>42}]} store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == {"hashval3"=>["array2", {"hashval4"=>42}]} end end #################### null_hashkey_objectvalue #################### shared_examples_for 'null_hashkey_objectvalue' do it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval1) store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval2) store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval1) (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval1) store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval2) store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, Value.new(:objval1)).should == Value.new(:objval1) end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = Value.new(:objval1) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, Value.new(:objval1), options).should == Value.new(:objval1) end it 'reads from keys like a Hash' do store[{"hashkey1"=>"hashkey2"}].should be_nil store.load({"hashkey1"=>"hashkey2"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey1"=>"hashkey2"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval2) store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval1) store.clear.should equal(store) store.key?({"hashkey1"=>"hashkey2"}).should be_false store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey1"=>"hashkey2"}, Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey1"=>"hashkey2"} value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey1"=>"hashkey2"}, options).should be_false store.load({"hashkey1"=>"hashkey2"}, options).should be_nil store.fetch({"hashkey1"=>"hashkey2"}, 42, options).should == 42 store.fetch({"hashkey1"=>"hashkey2"}, options) { 42 }.should == 42 store.delete({"hashkey1"=>"hashkey2"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey1"=>"hashkey2"}, Value.new(:objval2), options).should == Value.new(:objval2) end it 'reads from keys like a Hash' do store[{"hashkey3"=>"hashkey4"}].should be_nil store.load({"hashkey3"=>"hashkey4"}).should be_nil end it 'guarantees that the same value is returned when setting a key' do value = Value.new(:objval2) (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) end it 'returns false from #key? if a key is not available' do store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'returns nil from delete if a value for a key does not exist' do store.delete({"hashkey3"=>"hashkey4"}).should be_nil end it 'removes all keys from the store with clear' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval2) store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval1) store.clear.should equal(store) store.key?({"hashkey3"=>"hashkey4"}).should be_false store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'fetches a key with a default value with fetch, if the key is not available' do store.fetch({"hashkey3"=>"hashkey4"}, Value.new(:objval2)).should == Value.new(:objval2) end it 'fetches a key with a block with fetch, if the key is not available' do key = {"hashkey3"=>"hashkey4"} value = Value.new(:objval2) store.fetch(key) do |k| k.should equal(key) value end.should equal(value) end it 'accepts frozen options' do options = {:option1 => 1, :options2 => 2} options.freeze store.key?({"hashkey3"=>"hashkey4"}, options).should be_false store.load({"hashkey3"=>"hashkey4"}, options).should be_nil store.fetch({"hashkey3"=>"hashkey4"}, 42, options).should == 42 store.fetch({"hashkey3"=>"hashkey4"}, options) { 42 }.should == 42 store.delete({"hashkey3"=>"hashkey4"}, options).should be_nil store.clear(options).should equal(store) store.store({"hashkey3"=>"hashkey4"}, Value.new(:objval2), options).should == Value.new(:objval2) end end #################### store_hashkey_objectvalue #################### shared_examples_for 'store_hashkey_objectvalue' do it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval1) store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval1) store.load({"hashkey1"=>"hashkey2"}).should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval1) store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval1) store.load({"hashkey1"=>"hashkey2"}).should == Value.new(:objval1) end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval1) store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval2) store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval1) store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval1) store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval1) store.delete({"hashkey1"=>"hashkey2"}).should == Value.new(:objval1) store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval1) store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval1) store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval2) store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval1) end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = Value.new(:objval1) store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval1) store.fetch({"hashkey1"=>"hashkey2"}, Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval1) unaltered = 'unaltered' store.fetch({"hashkey1"=>"hashkey2"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval1) store[{"hashkey3"=>"hashkey4"}].should == Value.new(:objval1) store.load({"hashkey3"=>"hashkey4"}).should == Value.new(:objval1) end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval1) store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = Value.new(:objval1) store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == Value.new(:objval1) store.load({"hashkey3"=>"hashkey4"}).should == Value.new(:objval1) end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval1) store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval2) store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval1) store[{"hashkey3"=>"hashkey4"}].should == Value.new(:objval1) store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval1) store.delete({"hashkey3"=>"hashkey4"}).should == Value.new(:objval1) store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval1) store[{"hashkey3"=>"hashkey4"}].should == Value.new(:objval1) store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval2) store[{"hashkey3"=>"hashkey4"}].should == Value.new(:objval2) end it 'stores frozen values' do value = Value.new(:objval1).freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == Value.new(:objval1) end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = Value.new(:objval1) store[{"hashkey3"=>"hashkey4"}].should == Value.new(:objval1) end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval1) store.fetch({"hashkey3"=>"hashkey4"}, Value.new(:objval2)).should == Value.new(:objval1) end it 'does not run the block in fetch if the key is available' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval1) unaltered = 'unaltered' store.fetch({"hashkey3"=>"hashkey4"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval2) store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval2) store.load({"hashkey1"=>"hashkey2"}).should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval2) store.key?({"hashkey1"=>"hashkey2"}).should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store({"hashkey1"=>"hashkey2"}, value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval2) store.load({"hashkey1"=>"hashkey2"}).should == Value.new(:objval2) end it 'stores values after clear' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval2) store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval1) store.clear.should equal(store) store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval2) store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval2) store[{"hashkey3"=>"hashkey4"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval2) store.delete({"hashkey1"=>"hashkey2"}).should == Value.new(:objval2) store.key?({"hashkey1"=>"hashkey2"}).should be_false end it 'overwrites existing values' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval2) store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval2) store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval1) store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store[{"hashkey1"=>"hashkey2"}] = value).should equal(value) store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval2) end it 'stores frozen keys' do key = {"hashkey1"=>"hashkey2"}.freeze store[key] = Value.new(:objval2) store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval2) store.fetch({"hashkey1"=>"hashkey2"}, Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval2) unaltered = 'unaltered' store.fetch({"hashkey1"=>"hashkey2"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end it 'writes values to keys that like a Hash' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval2) store[{"hashkey3"=>"hashkey4"}].should == Value.new(:objval2) store.load({"hashkey3"=>"hashkey4"}).should == Value.new(:objval2) end it 'returns true from #key? if a key is available' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval2) store.key?({"hashkey3"=>"hashkey4"}).should be_true end it 'stores values with #store' do value = Value.new(:objval2) store.store({"hashkey3"=>"hashkey4"}, value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == Value.new(:objval2) store.load({"hashkey3"=>"hashkey4"}).should == Value.new(:objval2) end it 'stores values after clear' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval2) store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval1) store.clear.should equal(store) store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval2) store[{"hashkey3"=>"hashkey4"}].should == Value.new(:objval2) store[{"hashkey1"=>"hashkey2"}].should be_nil end it 'removes and returns a value from the backing store via delete if it exists' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval2) store.delete({"hashkey3"=>"hashkey4"}).should == Value.new(:objval2) store.key?({"hashkey3"=>"hashkey4"}).should be_false end it 'overwrites existing values' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval2) store[{"hashkey3"=>"hashkey4"}].should == Value.new(:objval2) store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval1) store[{"hashkey3"=>"hashkey4"}].should == Value.new(:objval1) end it 'stores frozen values' do value = Value.new(:objval2).freeze (store[{"hashkey3"=>"hashkey4"}] = value).should equal(value) store[{"hashkey3"=>"hashkey4"}].should == Value.new(:objval2) end it 'stores frozen keys' do key = {"hashkey3"=>"hashkey4"}.freeze store[key] = Value.new(:objval2) store[{"hashkey3"=>"hashkey4"}].should == Value.new(:objval2) end it 'fetches a key with a default value with fetch, if the key is available' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval2) store.fetch({"hashkey3"=>"hashkey4"}, Value.new(:objval1)).should == Value.new(:objval2) end it 'does not run the block in fetch if the key is available' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval2) unaltered = 'unaltered' store.fetch({"hashkey3"=>"hashkey4"}) { unaltered = 'altered' } unaltered.should == 'unaltered' end end #################### returndifferent_hashkey_objectvalue #################### shared_examples_for 'returndifferent_hashkey_objectvalue' do it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store[{"hashkey1"=>"hashkey2"}] = value store[{"hashkey1"=>"hashkey2"}].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval1) store[{"hashkey3"=>"hashkey4"}] = value store[{"hashkey3"=>"hashkey4"}].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store[{"hashkey1"=>"hashkey2"}] = value store[{"hashkey1"=>"hashkey2"}].should_not be_equal(value) end it 'guarantees that a different value is retrieved' do value = Value.new(:objval2) store[{"hashkey3"=>"hashkey4"}] = value store[{"hashkey3"=>"hashkey4"}].should_not be_equal(value) end end #################### returnsame_hashkey_objectvalue #################### shared_examples_for 'returnsame_hashkey_objectvalue' do it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store[{"hashkey1"=>"hashkey2"}] = value store[{"hashkey1"=>"hashkey2"}].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval1) store[{"hashkey3"=>"hashkey4"}] = value store[{"hashkey3"=>"hashkey4"}].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store[{"hashkey1"=>"hashkey2"}] = value store[{"hashkey1"=>"hashkey2"}].should be_equal(value) end it 'guarantees that the same value is retrieved' do value = Value.new(:objval2) store[{"hashkey3"=>"hashkey4"}] = value store[{"hashkey3"=>"hashkey4"}].should be_equal(value) end end #################### persist_hashkey_objectvalue #################### shared_examples_for 'persist_hashkey_objectvalue' do it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval1) store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval1) end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval1) store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == Value.new(:objval1) end it 'persists values' do store[{"hashkey1"=>"hashkey2"}] = Value.new(:objval2) store.close @store = nil store[{"hashkey1"=>"hashkey2"}].should == Value.new(:objval2) end it 'persists values' do store[{"hashkey3"=>"hashkey4"}] = Value.new(:objval2) store.close @store = nil store[{"hashkey3"=>"hashkey4"}].should == Value.new(:objval2) end end #################### store_large #################### shared_examples_for 'store_large' do it 'should store values up to 32k' do value = 'x' * (32 * 1024) store['large'] = value store['large'].should == value end it 'should store keys up to 128 bytes' do key = 'x' * 128 store[key] = 'value' store[key].should == 'value' end end #################### not_persist #################### shared_examples_for 'not_persist' do it 'does not persist values' do store['key'] = 'val' store.close @store = nil store['key'].should be_nil end end #################### multiprocess #################### shared_examples_for 'multiprocess' do it 'supports access by multiple instances/processes' do store['key'] = 'val' store2 = new_store store2['key'].should == 'val' store2.close end end #################### expires #################### shared_examples_for 'expires' do it 'supports expires on store and []', :retry => 3 do store.store('key1', 'val1', :expires => 3) store['key1'].should == 'val1' sleep 1 store['key1'].should == 'val1' sleep 3 store['key1'].should be_nil end it 'supports strict expires on store and []' do store.store('key1', 'val1', :expires => 2) store['key1'].should == 'val1' sleep 3 # Sleep 3 seconds because after 2 seconds the value can still exist! store['key1'].should be_nil end it 'supports expires on store and fetch', :retry => 3 do store.store('key1', 'val1', :expires => 3) store.fetch('key1').should == 'val1' sleep 1 store.fetch('key1').should == 'val1' sleep 3 store.fetch('key1').should be_nil end it 'supports strict expires on store and fetch' do store.store('key1', 'val1', :expires => 2) store.fetch('key1').should == 'val1' sleep 3 # Sleep 3 seconds because after 2 seconds the value can still exist! store.fetch('key1').should be_nil end it 'supports 0 as no-expires on store and []' do store.store('key1', 'val1', :expires => 0) store['key1'].should == 'val1' sleep 2 store['key1'].should == 'val1' end it 'supports false as no-expires on store and []' do store.store('key1', 'val1', :expires => false) store['key1'].should == 'val1' sleep 2 store['key1'].should == 'val1' end it 'supports expires on store and load', :retry => 3 do store.store('key1', 'val1', :expires => 3) store.load('key1').should == 'val1' sleep 1 store.load('key1').should == 'val1' sleep 3 store.load('key1').should be_nil end it 'supports strict expires on store and load' do store.store('key1', 'val1', :expires => 2) store.load('key1').should == 'val1' sleep 3 # Sleep 3 seconds because after 2 seconds the value can still exist! store.load('key1').should be_nil end it 'supports expires on store and #key?', :retry => 3 do store.store('key1', 'val1', :expires => 3) store.key?('key1').should be_true sleep 1 store.key?('key1').should be_true sleep 3 store.key?('key1').should be_false end it 'supports strict expires on store and #key?' do store.store('key1', 'val1', :expires => 2) store.key?('key1').should be_true sleep 3 # Sleep 3 seconds because after 2 seconds the value can still exist! store.key?('key1').should be_false end it 'supports updating the expiration time in load', :retry => 3 do store.store('key2', 'val2', :expires => 3) store['key2'].should == 'val2' sleep 1 store.load('key2', :expires => 5).should == 'val2' store['key2'].should == 'val2' sleep 3 store['key2'].should == 'val2' sleep 3 store['key2'].should be_nil end it 'supports 0 as no-expires in load' do store.store('key1', 'val1', :expires => 2) store.load('key1', :expires => 0).should == 'val1' sleep 3 store.load('key1').should == 'val1' end it 'supports false as no-expires in load' do store.store('key1', 'val1', :expires => 2) store.load('key1', :expires => false).should == 'val1' sleep 3 store.load('key1').should == 'val1' end it 'supports updating the expiration time in #key?', :retry => 3 do store.store('key2', 'val2', :expires => 3) store['key2'].should == 'val2' sleep 1 store.key?('key2', :expires => 5).should be_true store['key2'].should == 'val2' sleep 3 store['key2'].should == 'val2' sleep 3 store['key2'].should be_nil end it 'supports 0 as no-expires in #key?' do store.store('key1', 'val1', :expires => 2) store.key?('key1', :expires => 0).should be_true sleep 3 store['key1'].should == 'val1' end it 'supports false as no-expires in #key?' do store.store('key1', 'val1', :expires => 2) store.key?('key1', :expires => false ).should be_true sleep 3 store['key1'].should == 'val1' end it 'supports updating the expiration time in fetch', :retry => 3 do store.store('key1', 'val1', :expires => 3) store['key1'].should == 'val1' sleep 1 store.fetch('key1', nil, :expires => 5).should == 'val1' store['key1'].should == 'val1' sleep 3 store['key1'].should == 'val1' sleep 3 store['key1'].should be_nil end it 'supports 0 as no-expires in fetch' do store.store('key1', 'val1', :expires => 2) store.fetch('key1', nil, :expires => 0).should == 'val1' sleep 3 store.load('key1').should == 'val1' end it 'supports false as no-expires in fetch' do store.store('key1', 'val1', :expires => 2) store.fetch('key1', nil, :expires => false).should == 'val1' sleep 3 store.load('key1').should == 'val1' end it 'strictly respects expires in delete' do store.store('key2', 'val2', :expires => 2) store['key2'].should == 'val2' sleep 3 # Sleep 3 seconds because after 2 seconds the value can still exist! store.delete('key2').should be_nil end it 'respects expires in delete', :retry => 3 do store.store('key2', 'val2', :expires => 3) store['key2'].should == 'val2' sleep 1 store['key2'].should == 'val2' sleep 3 store.delete('key2').should be_nil end it 'supports the #expires syntactic sugar', :retry => 3 do store.store('persistent_key', 'persistent_value', :expires => 0) store.expires(1).store('key2', 'val2') store['key2'].should == 'val2' sleep 2 store.delete('key2').should be_nil store['persistent_key'].should == 'persistent_value' end it 'supports false as no-expires on store and []' do store.store('key1', 'val1', :expires => false) store['key1'].should == 'val1' sleep 2 store['key1'].should == 'val1' end it 'does not update the expiration time in #key? when not asked to do so', :retry => 3 do store.store('key1', 'val1', :expires => 1) store.key?('key1').should be_true store.key?('key1', :expires => nil).should be_true sleep 2 store.key?('key1').should be_false end it 'does not update the expiration time in fetch when not asked to do so', :retry => 3 do store.store('key1', 'val1', :expires => 1) store.fetch('key1').should == 'val1' store.fetch('key1', :expires => nil).should == 'val1' sleep 2 store.fetch('key1').should be_nil end it 'does not update the expiration time in load when not asked to do so', :retry => 3 do store.store('key1', 'val1', :expires => 1) store.load('key1').should == 'val1' store.load('key1', :expires => nil).should == 'val1' sleep 2 store.load('key1').should be_nil end end #################### default_expires #################### shared_examples_for 'default_expires' do it 'does set default expiration time' do store['key1'] = 'val1' store.key?('key1').should be_true store.fetch('key1').should == 'val1' store.load('key1').should == 'val1' sleep 2 store.key?('key1').should be_false store.fetch('key1').should be_nil store.load('key1').should be_nil end end #################### not_increment #################### shared_examples_for 'not_increment' do it 'does not support #increment' do expect do store.increment('inckey') end.to raise_error(NotImplementedError) end it 'does not support #decrement' do expect do store.increment('inckey') end.to raise_error(NotImplementedError) end end #################### concurrent_increment #################### shared_examples_for 'concurrent_increment' do def increment_thread(name) Thread.new do s = new_store 100.times do |i| 100.times do |j| s.increment("counter#{j}", 1, :expires => false) Thread.pass if rand(1000) >= 995 end s.store("#{name}#{i}", i.to_s, :expires => false) end s.close end end it 'have atomic increment across multiple processes' do a = increment_thread('a') b = increment_thread('b') c = increment_thread('c') a.join b.join c.join 100.times do |i| store["a#{i}"].should == i.to_s store["b#{i}"].should == i.to_s store["c#{i}"].should == i.to_s end 100.times do |j| store.raw["counter#{j}"].should == 300.to_s end end end #################### concurrent_create #################### shared_examples_for 'concurrent_create' do def create_thread(name) Thread.new do s = new_store 1000.times do |i| s[i.to_s].should == name if s.create(i.to_s, name, :expires => false) Thread.pass if rand(100) >= 99 end s.close end end it 'have atomic create across multiple processes' do a = create_thread('a') b = create_thread('b') c = create_thread('c') a.join b.join c.join end end #################### increment #################### shared_examples_for 'increment' do it 'initializes in #increment with 1' do store.key?('inckey').should be_false store.increment('inckey').should == 1 store.key?('inckey').should be_true store.raw['inckey'].should == '1' store.raw.load('inckey').should == '1' store.load('inckey', :raw => true).should == '1' store.delete('inckey', :raw => true).should == '1' store.key?('inckey').should be_false end it 'initializes in #increment with higher value' do store.increment('inckey', 42).should == 42 store.key?('inckey').should be_true store.raw['inckey'].should == '42' store.delete('inckey', :raw => true).should == '42' end it 'initializes in #increment with 0' do store.increment('inckey', 0).should == 0 store.key?('inckey').should be_true store.raw['inckey'].should == '0' store.delete('inckey', :raw => true).should == '0' end it 'initializes in #decrement with 0' do store.decrement('inckey', 0).should == 0 store.raw['inckey'].should == '0' end it 'initializes in #decrement with negative value' do store.decrement('inckey', -42).should == 42 store.raw['inckey'].should == '42' end it 'supports incrementing existing value by value' do store.increment('inckey').should == 1 store.increment('inckey', 42).should == 43 store.raw['inckey'].should == '43' end it 'supports decrementing existing value by value' do store.increment('inckey').should == 1 store.decrement('inckey').should == 0 store.increment('inckey', 42).should == 42 store.decrement('inckey', 2).should == 40 store.raw['inckey'].should == '40' end it 'supports incrementing existing value by 0' do store.increment('inckey').should == 1 store.increment('inckey', 0).should == 1 store.raw['inckey'].should == '1' end it 'supports decrementing existing value' do store.increment('inckey', 10).should == 10 store.increment('inckey', -5).should == 5 store.raw['inckey'].should == '5' store.increment('inckey', -5).should == 0 store.raw['inckey'].should == '0' end it 'interprets raw value as integer' do store.store('inckey', '42', :raw => true) store.increment('inckey').should == 43 store.raw['inckey'].should == '43' end it 'raises error in #increment on non integer value' do store['strkey'] = 'value' expect do store.increment('strkey') end.to raise_error end it 'raises error in #decrement on non integer value' do store['strkey'] = 'value' expect do store.decrement('strkey') end.to raise_error end it 'supports Semaphore' do a = Moneta::Semaphore.new(store, 'semaphore', 2) b = Moneta::Semaphore.new(store, 'semaphore', 2) c = Moneta::Semaphore.new(store, 'semaphore', 2) a.synchronize do a.locked?.should be_true b.synchronize do b.locked?.should be_true c.try_lock.should be_false end end end end #################### create #################### shared_examples_for 'create' do it 'creates the given key' do store.create('key','value').should be_true store['key'].should == 'value' end it 'creates raw value with the given key' do store.raw.create('key','value').should be_true store.raw['key'].should == 'value' end it 'does not create a key if it exists' do store['key'] = 'value' store.create('key','another value').should be_false store['key'].should == 'value' end it 'supports Mutex' do a = Moneta::Mutex.new(store, 'mutex') b = Moneta::Mutex.new(store, 'mutex') a.lock.should be_true b.try_lock.should be_false a.unlock.should be_nil end end #################### not_create #################### shared_examples_for 'not_create' do it 'does not support #create' do expect do store.create('key','value') end.to raise_error(NotImplementedError) end end #################### create_expires #################### shared_examples_for 'create_expires' do it 'creates the given key and expires it' do store.create('key','value', :expires => 1).should be_true store['key'].should == 'value' sleep 2 store.key?('key').should be_false end it 'does not change expires if the key exists' do store.store('key', 'value', :expires => false).should == 'value' store.create('key','another value', :expires => 1).should be_false store['key'].should == 'value' sleep 2 store['key'].should == 'value' store.key?('key').should be_true end end #################### marshallable_key #################### shared_examples_for 'marshallable_key' do it 'refuses to #[] from keys that cannot be marshalled' do expect do store[Struct.new(:foo).new(:bar)] end.to raise_error(marshal_error) end it 'refuses to load from keys that cannot be marshalled' do expect do store.load(Struct.new(:foo).new(:bar)) end.to raise_error(marshal_error) end it 'refuses to fetch from keys that cannot be marshalled' do expect do store.fetch(Struct.new(:foo).new(:bar), true) end.to raise_error(marshal_error) end it 'refuses to #[]= to keys that cannot be marshalled' do expect do store[Struct.new(:foo).new(:bar)] = 'value' end.to raise_error(marshal_error) end it 'refuses to store to keys that cannot be marshalled' do expect do store.store Struct.new(:foo).new(:bar), 'value' end.to raise_error(marshal_error) end it 'refuses to check for #key? if the key cannot be marshalled' do expect do store.key? Struct.new(:foo).new(:bar) end.to raise_error(marshal_error) end it 'refuses to delete a key if the key cannot be marshalled' do expect do store.delete Struct.new(:foo).new(:bar) end.to raise_error(marshal_error) end end #################### marshallable_value #################### shared_examples_for 'marshallable_value' do it 'refuses to store values that cannot be marshalled' do expect do store.store 'key', Struct.new(:foo).new(:bar) end.to raise_error(marshal_error) end end #################### transform_value #################### shared_examples_for 'transform_value' do it 'allows to bypass transformer with :raw' do store['key'] = 'value' load_value(store.load('key', :raw => true)).should == 'value' store.store('key', 'value', :raw => true) store.load('key', :raw => true).should == 'value' store.delete('key', :raw => true).should == 'value' end it 'allows to bypass transformer with raw syntactic sugar' do store['key'] = 'value' load_value(store.raw.load('key')).should == 'value' store.raw.store('key', 'value') store.raw['key'].should == 'value' store.raw.load('key').should == 'value' store.raw.delete('key').should == 'value' store.raw['key'] = 'value2' store.raw['key'].should == 'value2' end it 'returns unmarshalled value' do store.store('key', 'unmarshalled value', :raw => true) store.load('key', :raw => true).should == 'unmarshalled value' end it 'might raise exception on invalid value' do store.store('key', 'unmarshalled value', :raw => true) begin store['key'].should == load_value('unmarshalled value') store.delete('key').should == load_value('unmarshalled value') rescue Exception => ex expect do store['key'] end.to raise_error expect do store.delete('key') end.to raise_error end end end #################### transform_value_expires #################### shared_examples_for 'transform_value_expires' do it 'allows to bypass transformer with :raw' do store['key'] = 'value' load_value(store.load('key', :raw => true)).should == 'value' store['key'] = [1,2,3] load_value(store.load('key', :raw => true)).should == [[1,2,3]] store['key'] = nil load_value(store.load('key', :raw => true)).should == [nil] store['key'] = false load_value(store.load('key', :raw => true)).should be_false store.store('key', 'value', :expires => 10) load_value(store.load('key', :raw => true)).first.should == 'value' load_value(store.load('key', :raw => true)).last.should respond_to(:to_int) store.store('key', 'value', :raw => true) store.load('key', :raw => true).should == 'value' store.delete('key', :raw => true).should == 'value' end it 'returns unmarshalled value' do store.store('key', 'unmarshalled value', :raw => true) store.load('key', :raw => true).should == 'unmarshalled value' end it 'might raise exception on invalid value' do store.store('key', 'unmarshalled value', :raw => true) begin store['key'].should == load_value('unmarshalled value') store.delete('key').should == load_value('unmarshalled value') rescue Exception => ex expect do store['key'] end.to raise_error expect do store.delete('key') end.to raise_error end end end #################### features #################### shared_examples_for 'features' do it 'should report correct features' do store.features.sort_by(&:to_s).should == features end it 'should have frozen features' do store.features.frozen?.should be_true end it 'should have #supports?' do features.each do |f| store.supports?(f).should be_true end store.supports?(:unknown).should be_false end end ruby-moneta-0.7.20/spec/quality_spec.rb000066400000000000000000000026571232153565500200440ustar00rootroot00000000000000if defined?(Encoding) && Encoding.default_external != "UTF-8" Encoding.default_external = "UTF-8" end describe "The library itself" do def check_for_tab_characters(filename) failing_lines = [] File.readlines(filename).each_with_index do |line,number| failing_lines << number + 1 if line =~ /\t/ end unless failing_lines.empty? "#{filename} has tab characters on lines #{failing_lines.join(', ')}" end end def check_for_extra_spaces(filename) failing_lines = [] File.readlines(filename).each_with_index do |line,number| next if line =~ /^\s+#.*\s+\n$/ failing_lines << number + 1 if line =~ /\s+\n$/ end unless failing_lines.empty? "#{filename} has spaces on the EOL on lines #{failing_lines.join(', ')}" end end RSpec::Matchers.define :be_well_formed do failure_message_for_should do |actual| actual.join("\n") end match do |actual| actual.empty? end end it "has no malformed whitespace" do exempt = /\.gitmodules|\.marshal|fixtures|vendor|ssl_certs|kill|LICENSE/ error_messages = [] Dir.chdir(File.expand_path("../..", __FILE__)) do `git ls-files`.split("\n").each do |filename| next if filename =~ exempt error_messages << check_for_tab_characters(filename) error_messages << check_for_extra_spaces(filename) end end expect(error_messages.compact).to be_well_formed end end ruby-moneta-0.7.20/spec/rack/000077500000000000000000000000001232153565500157235ustar00rootroot00000000000000ruby-moneta-0.7.20/spec/rack/cache_moneta_spec.rb000066400000000000000000000264171232153565500217020ustar00rootroot00000000000000require 'rack/cache/moneta' require 'rack/mock' require 'rack/cache' class Object def sha_like? length == 40 && self =~ /^[0-9a-z]+$/ end end describe Rack::Cache::MetaStore::Moneta do before do Rack::Cache::Moneta['meta'] = Moneta.new(:Memory, :expires => true) Rack::Cache::Moneta['entity'] = Moneta.new(:Memory, :expires => true) @store = Rack::Cache::MetaStore::Moneta.resolve uri('moneta://entity') @entity_store = Rack::Cache::EntityStore::Moneta.resolve uri('moneta://meta') @request = mock_request('/', {}) @response = mock_response(200, {}, ['hello world']) end after do Rack::Cache::Moneta['meta'].clear Rack::Cache::Moneta['entity'].clear end it "has the class referenced by homonym constant" do Rack::Cache::MetaStore::MONETA.should == Rack::Cache::MetaStore::Moneta end it "instantiates the store" do @store.should be_kind_of(Rack::Cache::MetaStore::Moneta) end it "resolves the connection uri" do Rack::Cache::MetaStore::Moneta.resolve(uri('moneta://Memory?expires=true')).should be_kind_of(Rack::Cache::MetaStore::Moneta) end # Low-level implementation methods =========================================== it 'writes a list of negotation tuples with #write' do # lambda { @store.write('/test', [[{}, {}]]) # }.should_not raise Exception end it 'reads a list of negotation tuples with #read' do @store.write('/test', [[{},{}],[{},{}]]) tuples = @store.read('/test') tuples.should == [ [{},{}], [{},{}] ] end it 'reads an empty list with #read when nothing cached at key' do @store.read('/nothing').should be_empty end it 'removes entries for key with #purge' do @store.write('/test', [[{},{}]]) @store.read('/test').should_not be_empty @store.purge('/test') @store.read('/test').should be_empty end it 'succeeds when purging non-existing entries' do @store.read('/test').should be_empty @store.purge('/test') end it 'returns nil from #purge' do @store.write('/test', [[{},{}]]) @store.purge('/test').should be_nil @store.read('/test').should == [] end %w[/test http://example.com:8080/ /test?x=y /test?x=y&p=q].each do |key| it "can read and write key: '#{key}'" do # lambda { @store.write(key, [[{},{}]]) # }.should_not raise Exception @store.read(key).should == [[{},{}]] end end it "can read and write fairly large keys" do key = "b" * 4096 # lambda { @store.write(key, [[{},{}]]) # }.should_not raise Exception @store.read(key).should == [[{},{}]] end it "allows custom cache keys from block" do request = mock_request('/test', {}) request.env['rack-cache.cache_key'] = lambda { |request| request.path_info.reverse } @store.cache_key(request).should == 'tset/' end it "allows custom cache keys from class" do request = mock_request('/test', {}) request.env['rack-cache.cache_key'] = Class.new do def self.call(request); request.path_info.reverse end end @store.cache_key(request).should == 'tset/' end it 'does not blow up when given a non-marhsalable object with an ALL_CAPS key' do store_simple_entry('/bad', { 'SOME_THING' => Proc.new {} }) end # Abstract methods =========================================================== it 'stores a cache entry' do cache_key = store_simple_entry @store.read(cache_key).should_not be_empty end it 'sets the X-Content-Digest response header before storing' do cache_key = store_simple_entry req, res = @store.read(cache_key).first res['X-Content-Digest'].should == 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3' end it 'finds a stored entry with #lookup' do store_simple_entry response = @store.lookup(@request, @entity_store) response.should_not be_nil response.should be_kind_of(Rack::Cache::Response) end it 'does not find an entry with #lookup when none exists' do req = mock_request('/test', {'HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar'}) @store.lookup(req, @entity_store).should be_nil end it "canonizes urls for cache keys" do store_simple_entry(path='/test?x=y&p=q') hits_req = mock_request(path, {}) miss_req = mock_request('/test?p=x', {}) @store.lookup(hits_req, @entity_store).should_not be_nil @store.lookup(miss_req, @entity_store).should be_nil end it 'does not find an entry with #lookup when the body does not exist' do store_simple_entry @response.headers['X-Content-Digest'].should_not be_nil @entity_store.purge(@response.headers['X-Content-Digest']) @store.lookup(@request, @entity_store).should be_nil end it 'restores response headers properly with #lookup' do store_simple_entry response = @store.lookup(@request, @entity_store) response.headers.should == @response.headers.merge('Content-Length' => '4') end it 'restores response body from entity store with #lookup' do store_simple_entry response = @store.lookup(@request, @entity_store) body = '' ; response.body.each {|p| body << p} body.should == 'test' end it 'invalidates meta and entity store entries with #invalidate' do store_simple_entry @store.invalidate(@request, @entity_store) response = @store.lookup(@request, @entity_store) response.should be_kind_of(Rack::Cache::Response) response.should_not be :fresh? end it 'succeeds quietly when #invalidate called with no matching entries' do req = mock_request('/test', {}) @store.invalidate(req, @entity_store) @store.lookup(@request, @entity_store).should be_nil end # Vary ======================================================================= it 'does not return entries that Vary with #lookup' do req1 = mock_request('/test', {'HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar'}) req2 = mock_request('/test', {'HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam'}) res = mock_response(200, {'Vary' => 'Foo Bar'}, ['test']) @store.store(req1, res, @entity_store) @store.lookup(req2, @entity_store).should be_nil end it 'stores multiple responses for each Vary combination' do req1 = mock_request('/test', {'HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar'}) res1 = mock_response(200, {'Vary' => 'Foo Bar'}, ['test 1']) key = @store.store(req1, res1, @entity_store) req2 = mock_request('/test', {'HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam'}) res2 = mock_response(200, {'Vary' => 'Foo Bar'}, ['test 2']) @store.store(req2, res2, @entity_store) req3 = mock_request('/test', {'HTTP_FOO' => 'Baz', 'HTTP_BAR' => 'Boom'}) res3 = mock_response(200, {'Vary' => 'Foo Bar'}, ['test 3']) @store.store(req3, res3, @entity_store) slurp(@store.lookup(req3, @entity_store).body).should == 'test 3' slurp(@store.lookup(req1, @entity_store).body).should == 'test 1' slurp(@store.lookup(req2, @entity_store).body).should == 'test 2' @store.read(key).length.should == 3 end it 'overwrites non-varying responses with #store' do req1 = mock_request('/test', {'HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar'}) res1 = mock_response(200, {'Vary' => 'Foo Bar'}, ['test 1']) key = @store.store(req1, res1, @entity_store) slurp(@store.lookup(req1, @entity_store).body).should == 'test 1' req2 = mock_request('/test', {'HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam'}) res2 = mock_response(200, {'Vary' => 'Foo Bar'}, ['test 2']) @store.store(req2, res2, @entity_store) slurp(@store.lookup(req2, @entity_store).body).should == 'test 2' req3 = mock_request('/test', {'HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar'}) res3 = mock_response(200, {'Vary' => 'Foo Bar'}, ['test 3']) @store.store(req3, res3, @entity_store) slurp(@store.lookup(req1, @entity_store).body).should == 'test 3' @store.read(key).length.should == 2 end private def mock_request(uri, opts) env = Rack::MockRequest.env_for(uri, opts || {}) Rack::Cache::Request.new(env) end def mock_response(status, headers, body) headers ||= {} body = Array(body).compact Rack::Cache::Response.new(status, headers, body) end def slurp(body) buf = '' body.each { |part| buf << part } buf end # Stores an entry for the given request args, returns a url encoded cache key # for the request. def store_simple_entry(*request_args) path, headers = request_args @request = mock_request(path || '/test', headers || {}) @response = mock_response(200, {'Cache-Control' => 'max-age=420'}, ['test']) body = @response.body cache_key = @store.store(@request, @response, @entity_store) @response.body.should == body cache_key end def uri(uri) URI.parse uri end end describe Rack::Cache::EntityStore::Moneta do before do @store = Rack::Cache::EntityStore::Moneta.resolve(uri('moneta://Memory?expires=true')) end it 'has the class referenced by homonym constant' do Rack::Cache::EntityStore::MONETA.should == Rack::Cache::EntityStore::Moneta end it 'resolves the connection uri' do Rack::Cache::EntityStore::Moneta.resolve(uri('moneta://Memory?expires=true')).should be_kind_of(Rack::Cache::EntityStore::Moneta) end it 'responds to all required messages' do %w[read open write exist?].each do |message| @store.should respond_to message end end it 'stores bodies with #write' do key, size = @store.write(['My wild love went riding,']) key.should_not be_nil key.should be_sha_like data = @store.read(key) data.should == 'My wild love went riding,' end it 'takes a ttl parameter for #write' do key, size = @store.write(['My wild love went riding,'], 0) key.should_not be_nil key.should be_sha_like data = @store.read(key) data.should == 'My wild love went riding,' end it 'correctly determines whether cached body exists for key with #exist?' do key, size = @store.write(['She rode to the devil,']) @store.exist?(key).should be_true @store.exist?('938jasddj83jasdh4438021ksdfjsdfjsdsf').should be_false end it 'can read data written with #write' do key, size = @store.write(['And asked him to pay.']) data = @store.read(key) data.should == 'And asked him to pay.' end it 'gives a 40 character SHA1 hex digest from #write' do key, size = @store.write(['she rode to the sea;']) key.should_not be_nil key.length.should == 40 key.should match(/^[0-9a-z]+$/) key.should == '90a4c84d51a277f3dafc34693ca264531b9f51b6' end it 'returns the entire body as a String from #read' do key, size = @store.write(['She gathered together']) @store.read(key).should == 'She gathered together' end it 'returns nil from #read when key does not exist' do @store.read('87fe0a1ae82a518592f6b12b0183e950b4541c62').should be_nil end it 'returns a Rack compatible body from #open' do key, size = @store.write(['Some shells for her hair.']) body = @store.open(key) body.should respond_to :each buf = '' body.each { |part| buf << part } buf.should == 'Some shells for her hair.' end it 'returns nil from #open when key does not exist' do @store.open('87fe0a1ae82a518592f6b12b0183e950b4541c62').should be_nil end it 'deletes stored entries with #purge' do key, size = @store.write(['My wild love went riding,']) @store.purge(key).should be_nil @store.read(key).should be_nil end private def uri(uri) URI.parse uri end end ruby-moneta-0.7.20/spec/rack/moneta_cookies_spec.rb000066400000000000000000000037221232153565500222650ustar00rootroot00000000000000require 'helper' require 'rack/mock' require 'rack/moneta_cookies' describe Rack::MonetaCookies do def config(options={},&block) @options = options @block = block end def app(&block) @app_block ||= block end def backend Rack::MockRequest.new(Rack::MonetaCookies.new(lambda do |env| @store = env['rack.request.cookie_hash'] expect(@store).to equal(env['rack.moneta_cookies']) app.call(env) if app [200,{},[]] end, @options || {}, &@block)) end def get(cookies = {}, &block) app(&block) @response = backend.get('/','HTTP_COOKIE' => Rack::Utils.build_query(cookies)) end it 'should be able to read a key' do get 'key' => 'value' do expect( @store['key'] ).to eql('value') end end it 'should be able to set a key' do get do @store['key'] = 'value' end expect( @response['Set-Cookie'] ).to eql('key=value') end it 'should be able to remove a key' do get 'key' => 'value' do @store.delete('key') end expect( @response['Set-Cookie'] ).to match(/key=;/) expect( @response['Set-Cookie'] ).to match(/\s+expires=.*?1970/) end it 'should accept a config block' do config do use :Transformer, :key => :prefix, :prefix => 'moneta.' adapter :Cookie end get 'moneta.key' => 'right', 'key' => 'wrong' do expect( @store['key'] ).to eql('right') end end it 'should accept a :domain option' do config :domain => 'example.com' get do @store['key'] = 'value' end expect(@response['Set-Cookie']).to eql('key=value; domain=example.com') end it 'should accept a :path option' do config :path => '/path' get do @store['key'] = 'value' end expect(@response['Set-Cookie']).to eql('key=value; path=/path') end it 'should be accessible via Rack::Request' do get 'key' => 'value' do |env| req = Rack::Request.new(env) expect(req.cookies['key']).to eql('value') end end end ruby-moneta-0.7.20/spec/rack/moneta_store_spec.rb000066400000000000000000000035221232153565500217630ustar00rootroot00000000000000require 'helper' require 'rack/mock' require 'rack/moneta_store' describe Rack::MonetaStore do def config(store_arg = nil, options = nil, &block) @store_arg = store_arg @options = options @block = block end def app(&block) @app_block ||= block end def middleware @middleware ||= Rack::MonetaStore.new(lambda do |env| @store = env['rack.moneta_store'] app.call(env) if app [200,{},[]] end, @store_arg, @options || {}, &@block) end def backend @backend ||= Rack::MockRequest.new(middleware) end def get(&block) app(&block) @response = backend.get('/') end def uncached_store middleware.instance_variable_get(:@store) end it 'should be able to get a key without caching' do config :Memory uncached_store['key'] = 'value' get do expect(@store['key']).to eql('value') end end it 'should be able to get a key with caching' do config :Memory, :cache => true uncached_store['key'] = 'value' get do expect(@store['key']).to eql('value') expect(@store.adapter).to equal(uncached_store) expect(@store.cache['key']).to eql('value') end end it 'should be able to set a key' do config :Memory get do @store['key'] = 'value' end expect( @store['key'] ).to eql('value') expect(uncached_store['key']).to eql('value') end it 'should be able to get a remove a key' do config :Memory uncached_store['key'] = 'value' get do expect(@store.delete('key')).to eql('value') end expect(uncached_store.key?('key')).to be_false end it 'should accept a config block' do config do use :Transformer, :key => :prefix, :prefix => 'moneta.' adapter :Memory end uncached_store['key'] = 'value' get do expect(@store['key']).to eql('value') end end end ruby-moneta-0.7.20/spec/rack/session_moneta_spec.rb000066400000000000000000000262711232153565500223200ustar00rootroot00000000000000require 'rack/session/moneta' require 'rack/lint' require 'rack/mock' require 'thread' describe Rack::Session::Moneta do session_key = Rack::Session::Moneta::DEFAULT_OPTIONS[:key] session_match = /#{session_key}=([0-9a-fA-F]+);/ incrementor = lambda do |env| env["rack.session"]["counter"] ||= 0 env["rack.session"]["counter"] += 1 Rack::Response.new(env["rack.session"].inspect).to_a end drop_session = Rack::Lint.new(proc do |env| env['rack.session.options'][:drop] = true incrementor.call(env) end) renew_session = Rack::Lint.new(proc do |env| env['rack.session.options'][:renew] = true incrementor.call(env) end) defer_session = Rack::Lint.new(proc do |env| env['rack.session.options'][:defer] = true incrementor.call(env) end) skip_session = Rack::Lint.new(proc do |env| env['rack.session.options'][:skip] = true incrementor.call(env) end) incrementor = Rack::Lint.new(incrementor) it 'supports different constructors' do Rack::Session::Moneta.new(incrementor, :store => :Memory) Rack::Session::Moneta.new(incrementor, :store => Moneta.new(:Memory, :expires => true)) Rack::Session::Moneta.new(incrementor) do use :Expires adapter :Memory end end it "creates a new cookie" do pool = Rack::Session::Moneta.new(incrementor, :store => :Memory) res = Rack::MockRequest.new(pool).get("/") res["Set-Cookie"].should include("#{session_key}=") res.body.should == '{"counter"=>1}' end it "determines session from a cookie" do pool = Rack::Session::Moneta.new(incrementor, :store => :Memory) req = Rack::MockRequest.new(pool) res = req.get("/") cookie = res["Set-Cookie"] req.get("/", "HTTP_COOKIE" => cookie). body.should == '{"counter"=>2}' req.get("/", "HTTP_COOKIE" => cookie). body.should == '{"counter"=>3}' end it "determines session only from a cookie by default" do pool = Rack::Session::Moneta.new(incrementor, :store => :Memory) req = Rack::MockRequest.new(pool) res = req.get("/") sid = res["Set-Cookie"][session_match, 1] req.get("/?rack.session=#{sid}"). body.should == '{"counter"=>1}' req.get("/?rack.session=#{sid}"). body.should == '{"counter"=>1}' end it "determines session from params" do pool = Rack::Session::Moneta.new(incrementor, :cookie_only => false, :store => :Memory) req = Rack::MockRequest.new(pool) res = req.get("/") sid = res["Set-Cookie"][session_match, 1] req.get("/?rack.session=#{sid}"). body.should == '{"counter"=>2}' req.get("/?rack.session=#{sid}"). body.should == '{"counter"=>3}' end it "survives nonexistant cookies" do bad_cookie = "rack.session=blarghfasel" pool = Rack::Session::Moneta.new(incrementor, :store => :Memory) res = Rack::MockRequest.new(pool). get("/", "HTTP_COOKIE" => bad_cookie) res.body.should == '{"counter"=>1}' cookie = res["Set-Cookie"][session_match] cookie.should_not match(/#{bad_cookie}/) end it "maintains freshness" do pool = Rack::Session::Moneta.new(incrementor, :expire_after => 3, :store => :Memory) res = Rack::MockRequest.new(pool).get('/') res.body.should include '"counter"=>1' cookie = res["Set-Cookie"] res = Rack::MockRequest.new(pool).get('/', "HTTP_COOKIE" => cookie) res["Set-Cookie"].should == cookie res.body.should include '"counter"=>2' puts 'Sleeping to expire session' if $DEBUG sleep 4 res = Rack::MockRequest.new(pool).get('/', "HTTP_COOKIE" => cookie) res["Set-Cookie"].should_not == cookie res.body.should include '"counter"=>1' end it "does not send the same session id if it did not change" do pool = Rack::Session::Moneta.new(incrementor, :store => :Memory) req = Rack::MockRequest.new(pool) res0 = req.get("/") cookie = res0["Set-Cookie"][session_match] res0.body.should == '{"counter"=>1}' res1 = req.get("/", "HTTP_COOKIE" => cookie) res1["Set-Cookie"].should be_nil res1.body.should == '{"counter"=>2}' res2 = req.get("/", "HTTP_COOKIE" => cookie) res2["Set-Cookie"].should be_nil res2.body.should == '{"counter"=>3}' end it "deletes cookies with :drop option" do pool = Rack::Session::Moneta.new(incrementor, :store => :Memory) req = Rack::MockRequest.new(pool) drop = Rack::Utils::Context.new(pool, drop_session) dreq = Rack::MockRequest.new(drop) res1 = req.get("/") session = (cookie = res1["Set-Cookie"])[session_match] res1.body.should == '{"counter"=>1}' res2 = dreq.get("/", "HTTP_COOKIE" => cookie) res2["Set-Cookie"].should == nil res2.body.should == '{"counter"=>2}' res3 = req.get("/", "HTTP_COOKIE" => cookie) res3["Set-Cookie"][session_match].should_not == session res3.body.should == '{"counter"=>1}' end it "provides new session id with :renew option" do pool = Rack::Session::Moneta.new(incrementor, :store => :Memory) req = Rack::MockRequest.new(pool) renew = Rack::Utils::Context.new(pool, renew_session) rreq = Rack::MockRequest.new(renew) res1 = req.get("/") session = (cookie = res1["Set-Cookie"])[session_match] res1.body.should == '{"counter"=>1}' res2 = rreq.get("/", "HTTP_COOKIE" => cookie) new_cookie = res2["Set-Cookie"] new_session = new_cookie[session_match] new_session.should_not == session res2.body.should == '{"counter"=>2}' res3 = req.get("/", "HTTP_COOKIE" => new_cookie) res3.body.should == '{"counter"=>3}' # Old cookie was deleted res4 = req.get("/", "HTTP_COOKIE" => cookie) res4.body.should == '{"counter"=>1}' end it "omits cookie with :defer option but still updates the state" do pool = Rack::Session::Moneta.new(incrementor, :store => :Memory) count = Rack::Utils::Context.new(pool, incrementor) defer = Rack::Utils::Context.new(pool, defer_session) dreq = Rack::MockRequest.new(defer) creq = Rack::MockRequest.new(count) res0 = dreq.get("/") res0["Set-Cookie"].should == nil res0.body.should == '{"counter"=>1}' res0 = creq.get("/") res1 = dreq.get("/", "HTTP_COOKIE" => res0["Set-Cookie"]) res1.body.should == '{"counter"=>2}' res2 = dreq.get("/", "HTTP_COOKIE" => res0["Set-Cookie"]) res2.body.should == '{"counter"=>3}' end it "omits cookie and state update with :skip option" do pool = Rack::Session::Moneta.new(incrementor, :store => :Memory) count = Rack::Utils::Context.new(pool, incrementor) skip = Rack::Utils::Context.new(pool, skip_session) sreq = Rack::MockRequest.new(skip) creq = Rack::MockRequest.new(count) res0 = sreq.get("/") res0["Set-Cookie"].should == nil res0.body.should == '{"counter"=>1}' res0 = creq.get("/") res1 = sreq.get("/", "HTTP_COOKIE" => res0["Set-Cookie"]) res1.body.should == '{"counter"=>2}' res2 = sreq.get("/", "HTTP_COOKIE" => res0["Set-Cookie"]) res2.body.should == '{"counter"=>2}' end it "updates deep hashes correctly" do hash_check = proc do |env| session = env['rack.session'] unless session.include? 'test' session.update :a => :b, :c => { :d => :e }, :f => { :g => { :h => :i} }, 'test' => true else session[:f][:g][:h] = :j end [200, {}, [session.inspect]] end pool = Rack::Session::Moneta.new(hash_check, :store => :Memory) req = Rack::MockRequest.new(pool) res0 = req.get("/") session_id = (cookie = res0["Set-Cookie"])[session_match, 1] ses0 = pool.pool[session_id] req.get("/", "HTTP_COOKIE" => cookie) ses1 = pool.pool[session_id] ses1.should_not == ses0 end # anyone know how to do this better? it "cleanly merges sessions when multithreaded" do unless $DEBUG 1.should == 1 # fake assertion to appease the mighty bacon next end warn 'Running multithread test for Session::Memcache' pool = Rack::Session::Moneta.new(incrementor, :store => :Memory) req = Rack::MockRequest.new(pool) res = req.get('/') res.body.should == '{"counter"=>1}' cookie = res["Set-Cookie"] session_id = cookie[session_match, 1] delta_incrementor = lambda do |env| # emulate disconjoinment of threading env['rack.session'] = env['rack.session'].dup Thread.stop env['rack.session'][(Time.now.usec*rand).to_i] = true incrementor.call(env) end tses = Rack::Utils::Context.new pool, delta_incrementor treq = Rack::MockRequest.new(tses) tnum = rand(7).to_i+5 r = Array.new(tnum) do Thread.new(treq) do |run| run.get('/', "HTTP_COOKIE" => cookie, 'rack.multithread' => true) end end.reverse.map{|t| t.run.join.value } r.each do |request| request['Set-Cookie'].should == cookie request.body.should include '"counter"=>2' end session = pool.pool[session_id] session.size.should == tnum+1 # counter session['counter'].should == 2 # meeeh tnum = rand(7).to_i+5 r = Array.new(tnum) do |i| app = Rack::Utils::Context.new pool, time_delta req = Rack::MockRequest.new app Thread.new(req) do |run| run.get('/', "HTTP_COOKIE" => cookie, 'rack.multithread' => true) end end.reverse.map{|t| t.run.join.value } r.each do |request| request['Set-Cookie'].should == cookie request.body.should include '"counter"=>3' end session = pool.pool[session_id] session.size.should.be tnum+1 session['counter'].should.be 3 drop_counter = proc do |env| env['rack.session'].delete 'counter' env['rack.session']['foo'] = 'bar' [200, {'Content-Type'=>'text/plain'}, env['rack.session'].inspect] end tses = Rack::Utils::Context.new pool, drop_counter treq = Rack::MockRequest.new(tses) tnum = rand(7).to_i+5 r = Array.new(tnum) do Thread.new(treq) do |run| run.get('/', "HTTP_COOKIE" => cookie, 'rack.multithread' => true) end end.reverse.map{|t| t.run.join.value } r.each do |request| request['Set-Cookie'].should == cookie request.body.should include '"foo"=>"bar"' end session = pool.pool[session_id] session.size.should.be r.size+1 session['counter'].should.be.nil? session['foo'].should == 'bar' end it "does not suffer a race-condition in get_session" do # By lying about existence of a key this proxy tricks the session # to overwrite values when it wouldn't normally. broken_key = Class.new(::Moneta::Proxy) do def key?(key, *args) false end end pool = Rack::Session::Moneta.new(incrementor) do use broken_key adapter :Memory end # Override the SID generator with one that returns predefined values. def pool.generate_sid(*) @fake_sid ||= %w(deadbeef deadbeef caffee) @fake_sid.shift || raise('Empty!') end req = Rack::MockRequest.new(pool) req.get('/') res = req.get('/') res['Set-Cookie'].should =~ /\Arack.session=caffee; / end end