vendor/riddle/spec/unit/client_spec.rb in ultrasphinx-1.8 vs vendor/riddle/spec/unit/client_spec.rb in ultrasphinx-1.9
- old
+ new
@@ -13,16 +13,16 @@
Riddle::Client.new.port.should == 3312
end
it "should translate anchor arguments correctly" do
client = Riddle::Client.new
- client.set_anchor "latitude", 10.0, "longtitude", 95.0
+ client.set_anchor "latitude", 10.0, "longitude", 95.0
client.anchor.should == {
:latitude_attribute => "latitude",
:latitude => 10.0,
- :longtitude_attribute => "longtitude",
- :longtitude => 95.0
+ :longitude_attribute => "longitude",
+ :longitude => 95.0
}
end
it "should add queries to the queue" do
client = Riddle::Client.new
@@ -102,12 +102,26 @@
client.queue.first.should == query_contents(:weights)
end
it "should build a message with an anchor correctly" do
client = Riddle::Client.new
- client.set_anchor "latitude", 10.0, "longtitude", 95.0
+ client.set_anchor "latitude", 10.0, "longitude", 95.0
client.append_query "test "
client.queue.first.should == query_contents(:anchor)
+ end
+
+ it "should build a message with index weights correctly" do
+ client = Riddle::Client.new
+ client.index_weights = {"people" => 101}
+ client.append_query "test "
+ client.queue.first.should == query_contents(:index_weights)
+ end
+
+ it "should build a message with field weights correctly" do
+ client = Riddle::Client.new
+ client.field_weights = {"city" => 101}
+ client.append_query "test "
+ client.queue.first.should == query_contents(:field_weights)
end
it "should keep multiple messages in the queue" do
client = Riddle::Client.new
client.weights = [100, 1]
\ No newline at end of file