Sha256: 69cb118c5816e1d71fb5df8c598aea35fec3d85f409c79f11fa5553bfaf4a21d

Contents?: true

Size: 1.5 KB

Versions: 32

Compression:

Stored size: 1.5 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 = ThinkingSphinx::Field.stub_instance(:prefixes => true)
      @field_b = ThinkingSphinx::Field.stub_instance(:prefixes => false)
      @field_c = ThinkingSphinx::Field.stub_instance(:prefixes => true)
      
      @index.stub_method(: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 = ThinkingSphinx::Field.stub_instance(:infixes => true)
      @field_b = ThinkingSphinx::Field.stub_instance(:infixes => false)
      @field_c = ThinkingSphinx::Field.stub_instance(:infixes => true)
      
      @index.stub_method(: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

32 entries across 32 versions & 9 rubygems

Version Path
DrMark-thinking-sphinx-1.2.5 spec/lib/thinking_sphinx/index_spec.rb
DrMark-thinking-sphinx-1.2.6 spec/lib/thinking_sphinx/index_spec.rb
bterlson-thinking-sphinx-1.2.8 spec/lib/thinking_sphinx/index_spec.rb
dpickett-thinking-sphinx-1.1.23 spec/unit/thinking_sphinx/index_spec.rb
ebeigarts-thinking-sphinx-1.1.21 spec/unit/thinking_sphinx/index_spec.rb
ebeigarts-thinking-sphinx-1.1.22 spec/unit/thinking_sphinx/index_spec.rb
ebeigarts-thinking-sphinx-1.2.10 spec/lib/thinking_sphinx/index_spec.rb
factorylabs-thinking-sphinx-1.2.7 spec/lib/thinking_sphinx/index_spec.rb
freelancing-god-thinking-sphinx-1.1.19 spec/unit/thinking_sphinx/index_spec.rb
freelancing-god-thinking-sphinx-1.1.20 spec/unit/thinking_sphinx/index_spec.rb
freelancing-god-thinking-sphinx-1.1.21 spec/unit/thinking_sphinx/index_spec.rb
freelancing-god-thinking-sphinx-1.1.22 spec/unit/thinking_sphinx/index_spec.rb
freelancing-god-thinking-sphinx-1.1.23 spec/unit/thinking_sphinx/index_spec.rb
freelancing-god-thinking-sphinx-1.1.24 spec/unit/thinking_sphinx/index_spec.rb
freelancing-god-thinking-sphinx-1.2.0 spec/lib/thinking_sphinx/index_spec.rb
freelancing-god-thinking-sphinx-1.2.1 spec/lib/thinking_sphinx/index_spec.rb
freelancing-god-thinking-sphinx-1.2.10 spec/lib/thinking_sphinx/index_spec.rb
freelancing-god-thinking-sphinx-1.2.11 spec/lib/thinking_sphinx/index_spec.rb
freelancing-god-thinking-sphinx-1.2.2 spec/lib/thinking_sphinx/index_spec.rb
freelancing-god-thinking-sphinx-1.2.3 spec/lib/thinking_sphinx/index_spec.rb