Sha256: bb640ac9501c22768981c2c6c7a1f52d1379992d475d5f77d79df1b9992a2ee8

Contents?: true

Size: 1.36 KB

Versions: 17

Compression:

Stored size: 1.36 KB

Contents

require 'spec/spec_helper'

describe ThinkingSphinx::Index do
  describe "prefix_fields method" do
    before :each do
      @index = ThinkingSphinx::Index.new(Person)
      
      @field_a = stub('field', :prefixes => true)
      @field_b = stub('field', :prefixes => false)
      @field_c = stub('field', :prefixes => true)
      
      @index.stub!(:fields => [@field_a, @field_b, @field_c])
    end
    
    it "should return fields that are flagged as prefixed" do
      @index.prefix_fields.should include(@field_a)
      @index.prefix_fields.should include(@field_c)
    end
    
    it "should not return fields that aren't flagged as prefixed" do
      @index.prefix_fields.should_not include(@field_b)
    end
  end
  
  describe "infix_fields method" do
    before :each do
      @index = ThinkingSphinx::Index.new(Person)
      
      @field_a = stub('field', :infixes => true)
      @field_b = stub('field', :infixes => false)
      @field_c = stub('field', :infixes => true)
      
      @index.stub!(:fields => [@field_a, @field_b, @field_c])
    end
    
    it "should return fields that are flagged as infixed" do
      @index.infix_fields.should include(@field_a)
      @index.infix_fields.should include(@field_c)
    end
    
    it "should not return fields that aren't flagged as infixed" do
      @index.infix_fields.should_not include(@field_b)
    end
  end
end

Version data entries

17 entries across 17 versions & 4 rubygems

Version Path
thinking-sphinx-1.3.4 spec/lib/thinking_sphinx/index_spec.rb
thinking-sphinx-1.3.3 spec/lib/thinking_sphinx/index_spec.rb
thinking-sphinx-099-1.3.2 spec/lib/thinking_sphinx/index_spec.rb
thinking-sphinx-1.3.2 spec/lib/thinking_sphinx/index_spec.rb
moneypools-thinking-sphinx-1.3.1 spec/lib/thinking_sphinx/index_spec.rb
thinking-sphinx-1.3.1 spec/lib/thinking_sphinx/index_spec.rb
thinking-sphinx-099-1.3.1 spec/lib/thinking_sphinx/index_spec.rb
thinking-sphinx-099-1.3.0 spec/lib/thinking_sphinx/index_spec.rb
thinking-sphinx-1.3.0 spec/lib/thinking_sphinx/index_spec.rb
thinking-sphinx-099-1.2.13 spec/lib/thinking_sphinx/index_spec.rb
thinking-sphinx-1.2.13 spec/lib/thinking_sphinx/index_spec.rb
moneypools-thinking-sphinx-1.2.13 spec/lib/thinking_sphinx/index_spec.rb
moneypools-thinking-sphinx-1.2.12 spec/lib/thinking_sphinx/index_spec.rb
moneypools-thinking-sphinx-1.2.11 spec/lib/thinking_sphinx/index_spec.rb
warp-thinking-sphinx-1.2.12 spec/lib/thinking_sphinx/index_spec.rb
thinking-sphinx-099-1.2.12 spec/lib/thinking_sphinx/index_spec.rb
thinking-sphinx-1.2.12 spec/lib/thinking_sphinx/index_spec.rb