spec/lib/indexed/bundle/memory_spec.rb in picky-2.6.0 vs spec/lib/indexed/bundle/memory_spec.rb in picky-2.7.0
- old
+ new
@@ -10,32 +10,25 @@
@bundle = described_class.new :some_name, @category, @similarity
end
describe 'to_s' do
it 'does something' do
- @bundle.to_s.should == <<-TO_S
-Memory
- Files:
- Index: spec/test_directory/index/test/some_index/some_category_some_name_index.json
- Weights: spec/test_directory/index/test/some_index/some_category_some_name_weights.json
- Similarity: spec/test_directory/index/test/some_index/some_category_some_name_similarity.dump
- Config: spec/test_directory/index/test/some_index/some_category_some_name_configuration.json
- TO_S
+ @bundle.to_s.should == "Indexed::Bundle::Memory(test:some_index:some_category:some_name, Backend::Files(Backend::File::Text(spec/test_directory/index/test/some_index/prepared_some_category_index.txt), Backend::File::JSON(spec/test_directory/index/test/some_index/some_category_some_name_inverted.json), Backend::File::JSON(spec/test_directory/index/test/some_index/some_category_some_name_weights.json), Backend::File::Marshal(spec/test_directory/index/test/some_index/some_category_some_name_similarity.dump), Backend::File::JSON(spec/test_directory/index/test/some_index/some_category_some_name_configuration.json)))"
end
end
describe 'clear_index' do
before(:each) do
- @bundle.instance_variable_set(:@index, :not_empty)
+ @bundle.instance_variable_set(:@inverted, :not_empty)
end
- it 'has not cleared the index' do
- @bundle.index.should == :not_empty
+ it 'has not cleared the inverted index' do
+ @bundle.inverted.should == :not_empty
end
- it 'clears the index' do
- @bundle.clear_index
+ it 'clears the inverted index' do
+ @bundle.clear_inverted
- @bundle.index.should be_empty
+ @bundle.inverted.should be_empty
end
end
describe 'clear_weights' do
before(:each) do
@bundle.instance_variable_set(:@weights, :not_empty)
@@ -76,17 +69,17 @@
end
end
describe 'identifier' do
it 'should return a specific identifier' do
- @bundle.identifier.should == 'some_index:some_category:some_name'
+ @bundle.identifier.should == 'test:some_index:some_category:some_name'
end
end
describe 'ids' do
before(:each) do
- @bundle.instance_variable_set :@index, { :existing => :some_ids }
+ @bundle.instance_variable_set :@inverted, { :existing => :some_ids }
end
it 'should return an empty array if not found' do
@bundle.ids(:non_existing).should == []
end
it 'should return the ids if found' do
@@ -106,11 +99,11 @@
end
end
describe 'load' do
it 'should trigger loads' do
- @bundle.should_receive(:load_index).once.with
+ @bundle.should_receive(:load_inverted).once.with
@bundle.should_receive(:load_weights).once.with
@bundle.should_receive(:load_similarity).once.with
@bundle.should_receive(:load_configuration).once.with
@bundle.load
@@ -122,13 +115,13 @@
end
describe "load_index" do
it "uses the right file" do
Yajl::Parser.stub! :parse
- File.should_receive(:open).once.with 'spec/test_directory/index/test/some_index/some_category_some_name_index.json', 'r'
+ File.should_receive(:open).once.with 'spec/test_directory/index/test/some_index/some_category_some_name_inverted.json', 'r'
- @bundle.load_index
+ @bundle.load_inverted
end
end
describe "load_weights" do
it "uses the right file" do
Yajl::Parser.stub! :parse
@@ -164,10 +157,10 @@
@category = Category.new :some_category, @index
@bundle = described_class.new :some_name, @category, :similarity
end
it 'should initialize the index correctly' do
- @bundle.index.should == {}
+ @bundle.inverted.should == {}
end
it 'should initialize the weights index correctly' do
@bundle.weights.should == {}
end
it 'should initialize the similarity index correctly' do
\ No newline at end of file