Sha256: b17dfdd4efdf0e1a40e716a4fb311559810b7e8eec5728c80069a50c47227a2f

Contents?: true

Size: 1.49 KB

Versions: 11

Compression:

Stored size: 1.49 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

11 entries across 11 versions & 1 rubygems

Version Path
riddle-2.1.0 spec/unit/configuration/realtime_index_spec.rb
riddle-2.0.0 spec/unit/configuration/realtime_index_spec.rb
riddle-1.5.12 spec/unit/configuration/realtime_index_spec.rb
riddle-1.5.11 spec/unit/configuration/realtime_index_spec.rb
riddle-1.5.10 spec/unit/configuration/realtime_index_spec.rb
riddle-1.5.9 spec/unit/configuration/realtime_index_spec.rb
riddle-1.5.8 spec/unit/configuration/realtime_index_spec.rb
riddle-1.5.7 spec/unit/configuration/realtime_index_spec.rb
riddle-1.5.6 spec/unit/configuration/realtime_index_spec.rb
riddle-1.5.5 spec/unit/configuration/realtime_index_spec.rb
riddle-1.5.4 spec/unit/configuration/realtime_index_spec.rb