Sha256: 4ed4d7c098d077e95d1debbe737df70f4f5d957e1947650ecb1d8adb773e9488

Contents?: true

Size: 1.83 KB

Versions: 8

Compression:

Stored size: 1.83 KB

Contents

require 'spec/spec_helper'

describe Riddle::Configuration::DistributedIndex do
  it "should not be valid without any indexes" do
    index = Riddle::Configuration::DistributedIndex.new("dist1")
    index.should_not be_valid
  end
  
  it "should be valid with just local indexes" do
    index = Riddle::Configuration::DistributedIndex.new("dist1")
    index.local_indexes << "local_one"
    index.should be_valid
  end
  
  it "should be valid with just remote indexes" do
    index = Riddle::Configuration::DistributedIndex.new("dist1")
    index.remote_indexes << Riddle::Configuration::RemoteIndex.new("local", 3312, "remote_one")
    index.should be_valid
  end
  
  it "should be of type 'distributed'" do
    index = Riddle::Configuration::DistributedIndex.new("dist1")
    index.type.should == 'distributed'
  end
  
  it "should raise a ConfigurationError if rendering when not valid" do
    index = Riddle::Configuration::DistributedIndex.new("dist1")
    lambda { index.render }.should raise_error(Riddle::Configuration::ConfigurationError)
  end
  
  it "should render correctly if supplied settings are valid" do
    index = Riddle::Configuration::DistributedIndex.new("dist1")
    
    index.local_indexes << "test1" << "test1stemmed"
    index.remote_indexes <<
      Riddle::Configuration::RemoteIndex.new("localhost", 3313, "remote1") <<
      Riddle::Configuration::RemoteIndex.new("localhost", 3314, "remote2") <<
      Riddle::Configuration::RemoteIndex.new("localhost", 3314, "remote3")
    
    index.agent_connect_timeout = 1000
    index.agent_query_timeout   = 3000
    
    index.render.should == <<-DISTINDEX
index dist1
{
  type = distributed
  local = test1
  local = test1stemmed
  agent = localhost:3313:remote1
  agent = localhost:3314:remote2,remote3
  agent_connect_timeout = 1000
  agent_query_timeout = 3000
}
    DISTINDEX
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
freelancing-god-riddle-0.9.8.1533.2 spec/unit/configuration/distributed_index_spec.rb
freelancing-god-riddle-0.9.8.1533.3 spec/unit/configuration/distributed_index_spec.rb
freelancing-god-riddle-0.9.8.1533.4 spec/unit/configuration/distributed_index_spec.rb
freelancing-god-riddle-0.9.8.1533.5 spec/unit/configuration/distributed_index_spec.rb
freelancing-god-riddle-0.9.8.1533.7 spec/unit/configuration/distributed_index_spec.rb
freelancing-god-riddle-0.9.8.1533.8 spec/unit/configuration/distributed_index_spec.rb
freelancing-god-riddle-0.9.8.1533.9 spec/unit/configuration/distributed_index_spec.rb
riddle-0.9.8.1533.10 spec/unit/configuration/distributed_index_spec.rb