Sha256: c1198fcabfe4dd85ceb41e65e6c3e3c06965c206dc6bd261bb608180742ca004
Contents?: true
Size: 847 Bytes
Versions: 2
Compression:
Stored size: 847 Bytes
Contents
require 'helper' require 'flipper/adapters/mongo' require 'flipper/spec/shared_adapter_specs' describe Flipper::Adapters::Mongo do let(:collection) { Mongo::Connection.new.db('testing')['testing'] } let(:criteria) { {:_id => id} } let(:id) { described_class::DefaultId } subject { Flipper::Adapters::Mongo.new(collection) } before do collection.remove(criteria) end def read_key(key) if (doc = collection.find_one(criteria)) value = doc[key] if value.is_a?(::Array) value = value.to_set end value end end def write_key(key, value) if value.is_a?(::Set) value = value.to_a end options = {:upsert => true} updates = {'$set' => {key => value}} collection.update criteria, updates, options end it_should_behave_like 'a flipper adapter' end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
flipper-mongo-0.1.1 | spec/flipper/adapters/mongo_spec.rb |
flipper-mongo-0.1.0 | spec/flipper/adapters/mongo_spec.rb |