spec/moneta_mongodb_spec.rb in dkastner-moneta-1.1.0 vs spec/moneta_mongodb_spec.rb in dkastner-moneta-1.1.1

- old
+ new

@@ -11,17 +11,25 @@ describe '#initialize' do it 'should initialize with a URI' do mock_mongo = mock(Object, :db => mock(Object, :collection => [])) Mongo::Connection.should_receive(:from_uri). - with('mongodb://a:b@localhost:27059/cache'). + with('mongodb://a:b@localhost:27059/cache', {}). and_return mock_mongo m = Moneta::Adapters::MongoDB.new :uri => 'mongodb://a:b@localhost:27059/cache' end it 'should initialize with a hash of options' do m = Moneta::Adapters::MongoDB.new m['example'] = 3.0 m['example'].should == 3.0 + end + it 'should pass any extra options to Mongo::Connection.new' do + mock_mongo = mock(Object, :db => mock(Object, :collection => nil)) + Mongo::Connection.should_receive(:new).with('localhost', 27059, + hash_including(:pool_size => 5, :timeout => 22)). + and_return(mock_mongo) + m = Moneta::Adapters::MongoDB.new :uri => 'mongodb://a:b@localhost:27059/cache', + :pool_size => 5, :timeout => 22 end end context 'initialized' do it_should_behave_like "a read/write Moneta cache"