Sha256: 0ee297929fd4982ff6c5b88a171008b81ca5e85d7d7285bfb33f663dfdcd3acd
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
# encoding: utf-8 # require 'spec_helper' describe "Array IDs" do # This tests the weights option. # it 'can use Arrays as IDs' do index = Picky::Index.new :arrays do key_format :to_a category :text1 end require 'ostruct' thing = OpenStruct.new id: ['id1', 'thing1'], text1: "ohai" other = OpenStruct.new id: ['id2', 'thing2'], text1: "ohai kthxbye" index.add thing index.add other try = Picky::Search.new index try.search("text1:ohai").ids.should == [ ["id2", "thing2"], ["id1", "thing1"] ] # WAT end # This tests the weights option. # it 'can use split as key_format' do index = Picky::Index.new :arrays do key_format :split category :text1 end require 'ostruct' thing = OpenStruct.new id: "id1 thing1", text1: "ohai" other = OpenStruct.new id: "id2 thing2", text1: "ohai kthxbye" index.add thing index.add other try = Picky::Search.new index try.search("text1:ohai").ids.should == [ ["id2", "thing2"], ["id1", "thing1"] ] # WAT end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
picky-4.16.0 | spec/functional/arrays_as_ids_spec.rb |
picky-4.15.1 | spec/functional/arrays_as_ids_spec.rb |