Sha256: 79473baf17650bda80d1a16ce5e450c7021b01a3970496b65a86dea675c8567d

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe "Sphinx Keywords" do
  before :each do
    @client = Riddle::Client.new("localhost", 9313)
  end
  
  it "should return an array of hashes" do
    results = @client.keywords("pat", "people")
    results.should be_kind_of(Array)
    
    results.each do |result|
      result.should be_kind_of(Hash)
    end
  end
  
  it "should have keys for normalised and tokenised versions of the keywords" do
    results = @client.keywords("pat", "people")
    results.each do |result|
      result.keys.should include(:normalised)
      result.keys.should include(:tokenised)
    end
  end
  
  it "shouldn't have docs or hits keys if not requested" do
    results = @client.keywords("pat", "people")
    results.each do |result|
      result.keys.should_not include(:docs)
      result.keys.should_not include(:hits)
    end
  end
  
  it "should have docs and hits keys if requested" do
    results = @client.keywords("pat", "people", true)
    results.each do |result|
      result.keys.should include(:docs)
      result.keys.should include(:hits)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
riddle-1.4.0 spec/functional/keywords_spec.rb
riddle-1.3.3 spec/functional/keywords_spec.rb
riddle-1.3.2 spec/functional/keywords_spec.rb
riddle-1.3.1 spec/functional/keywords_spec.rb
riddle-1.3.0 spec/functional/keywords_spec.rb