Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (30 sloc) 809 Bytes
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(:id) { 'flipper' }
subject { described_class.new(collection) }
before do
collection.remove
end
def read_key(key)
if (doc = collection.find_one(:_id => key))
value = doc['v']
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
criteria = {:_id => key}
updates = {'$set' => {'v' => value}}
options = {:upsert => true}
collection.update criteria, updates, options
end
it_should_behave_like 'a flipper adapter'
end
Jump to Line
Something went wrong with that request. Please try again.