Sha256: 63f68d074a614375c00699f2dda1b4bf78d6ead1886c25b622148696adae9787
Contents?: true
Size: 1.28 KB
Versions: 4
Compression:
Stored size: 1.28 KB
Contents
require 'spec/spec_helper' describe "Sphinx Updates" do before :each do @client = Riddle::Client.new("localhost", 9313) end it "should update a single record appropriately" do # check existing birthday result = @client.query("Ellie K Ford") result[:matches].should_not be_empty result[:matches].length.should == 1 ellie = result[:matches].first ellie[:attributes]["birthday"].should == Time.utc(1970, 1, 23).to_i # make Ellie younger by 6 years @client.update("people", ["birthday"], {ellie[:doc] => [Time.utc(1976, 1, 23).to_i]}) # check attribute's value result = @client.query("Ellie K Ford") result[:matches].should_not be_empty result[:matches].length.should == 1 ellie = result[:matches].first ellie[:attributes]["birthday"].should == Time.utc(1976, 1, 23).to_i end it "should update multiple records appropriately" do result = @client.query("Steele") pairs = {} result[:matches].each do |match| pairs[match[:doc]] = [match[:attributes]["birthday"] + (365*24*60*60)] end @client.update "people", ["birthday"], pairs result = @client.query("Steele") result[:matches].each do |match| match[:attributes]["birthday"].should == pairs[match[:doc]].first end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
riddle-1.0.10 | spec/functional/update_spec.rb |
riddle-1.0.9 | spec/functional/update_spec.rb |
riddle-1.0.8 | spec/functional/update_spec.rb |
riddle-1.0.7 | spec/functional/update_spec.rb |