0
@@ -7,50 +7,55 @@ TEMP_DIR = SPEC_ROOT + '/temp'
0
TEMP_STORAGES = TEMP_DIR + '/storages'
0
def setup_default_store(store=nil)
0
- StrokeDB.stub!(:default_store).and_return(store)
0
+ StrokeDB.stub!(:default_store).and_return(store)
0
-@storage = if ENV['STORAGE'].to_s.downcase == 'file'
0
- StrokeDB::FileStorage.new(:path => @path + '/file_storage')
0
- StrokeDB::MemoryStorage.new
0
+ @storage = if ENV['STORAGE'].to_s.downcase == 'file'
0
+ StrokeDB::FileStorage.new(:path => @path + '/file_storage')
0
+ StrokeDB::MemoryStorage.new
0
-$store = StrokeDB::Store.new(:storage => @storage,:index => @index, :path => @path)
0
-StrokeDB.stub!(:default_store).and_return($store)
0
+ $store = StrokeDB::Store.new(:storage => @storage,:index => @index, :path => @path)
0
+ StrokeDB.stub!(:default_store).and_return($store)
0
+ StrokeDB.default_store
0
def stub_meta_in_store(store=nil)
0
-store ||= StrokeDB.default_store
0
-meta = store.find(NIL_UUID)
0
-store.should_receive(:find).with(NIL_UUID).any_number_of_times.and_return(meta)
0
-store.should_receive(:include?).with(NIL_UUID).any_number_of_times.and_return(true)
0
+ store ||= StrokeDB.default_store
0
+ meta = store.find(NIL_UUID)
0
+ store.should_receive(:find).with(NIL_UUID).any_number_of_times.and_return(meta)
0
+ store.should_receive(:include?).with(NIL_UUID).any_number_of_times.and_return(true)
0
def setup_index(store=nil)
0
-store ||= StrokeDB.default_store
0
-index_storage = StrokeDB::InvertedListFileStorage.new(:path => TEMP_STORAGES + '/inverted_list_storage')
0
-@index = StrokeDB::InvertedListIndex.new(index_storage)
0
-@index.document_store = store
0
-store.index_store = @index
0
+ store ||= StrokeDB.default_store
0
+ index_storage = StrokeDB::InvertedListFileStorage.new(:path => TEMP_STORAGES + '/inverted_list_storage')
0
+ @index = StrokeDB::InvertedListIndex.new(index_storage)
0
+ @index.document_store = store
0
+ store.index_store = @index
0
Spec::Runner.configure do |config|
0
ObjectSpace.each_object do |obj|
0
- obj.stop_autosync! if obj.is_a?(Store) rescue nil
0
ObjectSpace.each_object do |obj|
0
obj.close if obj.is_a?(::File) rescue nil
0
\ No newline at end of file