0
@@ -13,9 +13,8 @@ describe "Config" do
0
::StrokeDB.default_config.should == @config
0
- it "should have no storages o
r indexes on creation" do
0
+ it "should have no storages o
n creation" do
0
@config.storages.should be_empty
0
- @config.indexes.should be_empty
0
it "should add known storages without specific parameters" do
0
@@ -67,19 +66,6 @@ describe "Config" do
0
@config.storages[:fs].should_not have_chained_storage(@config.storages[:mem3])
0
- it "should add an index" do
0
- @paths << (@root_path + "file_storage_index")
0
- @config.add_storage :fs, :file, :path => @paths.last
0
- @paths << (@root_path + "inverted_list_file_index")
0
- @config.add_storage :idx_st, :inverted_list_file, :path => @paths.last
0
- @config.add_index :idx, :inverted_list, :idx_st
0
- @config.indexes[:idx].should be_an_instance_of(InvertedListIndex)
0
- it "should raise the correct exception when adding an unknown index" do
0
- lambda { @config.add_index :unknown, :unknown_index_type, :idx_st }.should raise_error(StrokeDB::UnknownIndexTypeError)
0
it "should add a store" do
0
@paths << (@root_path + "file_storage")
0
@config.add_storage :fs, :file, :path => @paths.last
0
@@ -88,15 +74,11 @@ describe "Config" do
0
@config.stores[:store].storage.should == @config.storages[:fs]
0
- it "should add a default store
with default index" do
0
+ it "should add a default store
" do
0
@paths << (@root_path + "file_storage_default_index")
0
@config.add_storage :fs, :file, :path => @paths.last
0
- @paths << (@root_path + "inverted_list_file_default_index")
0
- @config.add_storage :index_storage, :inverted_list_file, :path => @paths.last
0
- @config.add_index :default, :inverted_list, :index_storage
0
@config.add_store :default, nil, :storage => :fs, :cut_level => 4, :path => @paths.last
0
@config.stores[:default].should be_an_instance_of(Store)
0
- @config.indexes[:default].document_store.should == @config.stores[:default]
0
@@ -191,38 +173,6 @@ describe "Config builder" do
0
config.storages[:chunk_3].authoritative_source.should be_nil
0
- it "should use InvertedListIndex by default" do
0
- config = StrokeDB::Config.build :base_path => @base_path
0
- config.indexes[:default].should be_a_kind_of(InvertedListIndex)
0
- it "should use specific index if told so by default" do
0
- StrokeDB.send!(:remove_const,'SomeFunnyIndex') if defined?(SomeFunnyIndex)
0
- StrokeDB::SomeFunnyIndex = Class.new(InvertedListIndex)
0
- config = StrokeDB::Config.build :index => :some_funny, :base_path => @base_path
0
- config.indexes[:default].should be_a_kind_of(SomeFunnyIndex)
0
- it "should use InvertedListFileStorage index storage by default" do
0
- config = StrokeDB::Config.build :base_path => @base_path
0
- config.storages[:inverted_list_file].should be_a_kind_of(InvertedListFileStorage)
0
- it "should use specific index storage if told so" do
0
- StrokeDB.send!(:remove_const,'SomeFunnyIndexStorage') if defined?(SomeFunnyIndexStorage)
0
- StrokeDB::SomeFunnyIndexStorage = Class.new(InvertedListFileStorage)
0
- config = StrokeDB::Config.build :index_storages => [:some_funny_index], :base_path => @base_path
0
- config.storages[:some_funny_index].should be_a_kind_of(SomeFunnyIndexStorage)
0
- it "should initialize index storage with base_path+storage_name" do
0
- StrokeDB.send!(:remove_const,'SomeFunnyIndexStorage') if defined?(SomeFunnyIndexStorage)
0
- StrokeDB::SomeFunnyIndexStorage = Class.new(InvertedListFileStorage)
0
- index_storage = StrokeDB::SomeFunnyIndexStorage.new(:path => @base_path + '/some_funny_index')
0
- SomeFunnyIndexStorage.should_receive(:new).with(:path => @base_path + '/some_funny_index').and_return(index_storage)
0
- config = StrokeDB::Config.build :index_storages => [:some_funny_index], :base_path => @base_path
0
it "should dump config in base_path (except 'default' key)" do
0
cfg = StrokeDB::Config.build :default => true, :base_path => @base_path
0
config = JSON.parse(IO.read(@base_path + '/config'))