Sha256: 4d8dbbedad27d0644a5918bead94d46706c7c0bb2c935065ab1b0a4a2b74fc43

Contents?: true

Size: 1.52 KB

Versions: 9

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

describe Riddle::Configuration::RealtimeIndex do
  let(:index) { Riddle::Configuration::RealtimeIndex.new('rt1') }
  
  describe '#valid?' do
    it "should not be valid without a name" do
      index.name = nil
      index.path = 'foo'
      index.should_not be_valid
    end
    
    it "should not be valid without a path" do
      index.path = nil
      index.should_not be_valid
    end
    
    it "should be valid with a name and path" do
      index.path = 'foo'
      index.should be_valid
    end
  end
  
  describe '#type' do
    it "should be 'rt'" do
      index.type.should == 'rt'
    end
  end
  
  describe '#render' do
    it "should raise a ConfigurationError if rendering when not valid" do
      lambda {
        index.render
      }.should raise_error(Riddle::Configuration::ConfigurationError)
    end
  
    it "should render correctly if supplied settings are valid" do
      index.path = '/var/data/rt'
      index.rt_mem_limit = '512M'
      index.rt_field << 'title' << 'content'
      
      index.rt_attr_uint      << 'gid'
      index.rt_attr_bigint    << 'guid'
      index.rt_attr_float     << 'gpa'
      index.rt_attr_timestamp << 'ts_added'
      index.rt_attr_string    << 'author'
          
      index.render.should == <<-RTINDEX
index rt1
{
  type = rt
  path = /var/data/rt
  rt_mem_limit = 512M
  rt_field = title
  rt_field = content
  rt_attr_uint = gid
  rt_attr_bigint = guid
  rt_attr_float = gpa
  rt_attr_timestamp = ts_added
  rt_attr_string = author
}
      RTINDEX
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
riddle-1.5.3 spec/unit/configuration/realtime_index_spec.rb
riddle-1.5.2 spec/unit/configuration/realtime_index_spec.rb
riddle-1.5.1 spec/unit/configuration/realtime_index_spec.rb
riddle-1.5.0 spec/unit/configuration/realtime_index_spec.rb
riddle-1.4.0 spec/unit/configuration/realtime_index_spec.rb
riddle-1.3.3 spec/unit/configuration/realtime_index_spec.rb
riddle-1.3.2 spec/unit/configuration/realtime_index_spec.rb
riddle-1.3.1 spec/unit/configuration/realtime_index_spec.rb
riddle-1.3.0 spec/unit/configuration/realtime_index_spec.rb