Sha256: 6098fca12e6b0758f50ecc9e2869ea01ad2f0bcdbc4640c61db45d960d0844bb

Contents?: true

Size: 830 Bytes

Versions: 2

Compression:

Stored size: 830 Bytes

Contents

describe 'scoping with text fields', :type => :query do
  it 'should scope with a text field' do
    session.search(Post) do
      text_fields do
        with(:body, 'test')
      end
    end
    connection.should have_last_search_with(:fq => ['body_texts:test'])
  end

  it 'should raise an UnrecognizedFieldError if differently configured text field is used' do
    lambda do
      session.search(Post, Namespaced::Comment) do
        text_fields do
          with(:body, 'test')
        end
      end
    end.should raise_error(Sunspot::UnrecognizedFieldError)
  end

  it 'should raise an UnrecognizedFieldError if no field exists' do
    lambda do
      session.search(Post) do
        text_fields do
          with(:bogus, 'test')
        end
      end
    end.should raise_error(Sunspot::UnrecognizedFieldError)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
benjaminkrause-sunspot-0.9.7 spec/api/query/text_field_scoping_spec.rb
benjaminkrause-sunspot-0.9.8 spec/api/query/text_field_scoping_spec.rb