spec/lib/indexed/bundle_realtime_spec.rb in picky-3.2.0 vs spec/lib/indexed/bundle_realtime_spec.rb in picky-3.3.0
- old
+ new
@@ -1,19 +1,19 @@
require 'spec_helper'
-describe Picky::Indexed::Bundle do
+describe Picky::Bundle do
before(:each) do
@index = Picky::Index.new :some_index
@category = Picky::Category.new :some_category, @index
-
+
@weights = Picky::Generators::Weights::Default
@partial = Picky::Generators::Partial::Default
@similarity = Picky::Generators::Similarity::DoubleMetaphone.new 3
@bundle = described_class.new :some_name, @category, Picky::Backends::Memory.new, @weights, @partial, @similarity
end
-
+
it 'is by default empty' do
@bundle.realtime_mapping.should == {}
end
it 'is by default empty' do
@bundle.weights.should == {}
@@ -22,94 +22,94 @@
@bundle.inverted.should == {}
end
it 'is by default empty' do
@bundle.similarity.should == {}
end
-
+
describe 'combined' do
it 'works correctly' do
@bundle.add 1, :title
@bundle.add 2, :title
-
+
@bundle.realtime_mapping.should == { 1 => [:title], 2 => [:title] }
@bundle.inverted.should == { :title => [2,1] }
@bundle.weights.should == { :title => 0.6931471805599453 }
@bundle.similarity.should == { :TTL => [:title] }
end
it 'works correctly' do
@bundle.add 1, :title
@bundle.add 2, :title
@bundle.remove 1
@bundle.remove 2
-
+
@bundle.realtime_mapping.should == {}
@bundle.weights.should == {}
@bundle.inverted.should == {}
@bundle.similarity.should == {}
end
it 'works correctly' do
@bundle.add 1, :title
@bundle.add 1, :other
@bundle.add 1, :whatever
@bundle.remove 1
-
+
@bundle.realtime_mapping.should == {}
@bundle.weights.should == {}
@bundle.inverted.should == {}
@bundle.similarity.should == {}
end
it 'works correctly' do
@bundle.add 1, :title
@bundle.add 2, :thing
@bundle.add 1, :other
@bundle.remove 1
-
+
@bundle.realtime_mapping.should == { 2 => [:thing] }
@bundle.weights.should == { :thing => 0.0 }
@bundle.inverted.should == { :thing => [2] }
@bundle.similarity.should == { :"0NK" => [:thing] }
end
it 'works correctly' do
@bundle.add 1, :title
@bundle.add 1, :title
-
+
@bundle.realtime_mapping.should == { 1 => [:title] }
@bundle.weights.should == { :title => 0.0 }
@bundle.inverted.should == { :title => [1] }
@bundle.similarity.should == { :TTL => [:title] }
end
it 'works correctly' do
@bundle.add 1, :title
@bundle.remove 1
@bundle.remove 1
-
+
@bundle.realtime_mapping.should == {}
@bundle.weights.should == {}
@bundle.inverted.should == {}
@bundle.similarity.should == {}
end
end
-
+
describe 'add' do
it 'works correctly' do
@bundle.add 1, :title
-
+
@bundle.realtime_mapping.should == { 1 => [:title] }
-
+
@bundle.add 2, :other
-
+
@bundle.realtime_mapping.should == { 1 => [:title], 2 => [:other] }
-
+
@bundle.add 1, :thing
-
+
@bundle.realtime_mapping.should == { 1 => [:title, :thing], 2 => [:other] }
end
it 'works correctly' do
@bundle.add 1, :title
-
+
@bundle.weights.should == { :title => 0.0 }
@bundle.inverted.should == { :title => [1] }
@bundle.similarity.should == { :TTL => [:title] }
end
end
-
+
end
\ No newline at end of file