Sha256: a48e03f5ca20daf917010b53a70023538f555b4532925f7c67c2706b68be568d

Contents?: true

Size: 791 Bytes

Versions: 7

Compression:

Stored size: 791 Bytes

Contents

shared_examples_for 'query with text field scoping' do
  it 'should scope with a text field' do
    search do
      text_fields do
        with(:body, 'test')
      end
    end
    expect(connection).to have_last_search_including(:fq, 'body_textsv:test')
  end

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sunspot-2.7.1 spec/api/query/text_field_scoping_examples.rb
sunspot-2.7.0 spec/api/query/text_field_scoping_examples.rb
sunspot-2.6.0 spec/api/query/text_field_scoping_examples.rb
sunspot-2.5.0 spec/api/query/text_field_scoping_examples.rb
sunspot-2.4.0 spec/api/query/text_field_scoping_examples.rb
sunspot-2.3.0 spec/api/query/text_field_scoping_examples.rb
sunspot-2.2.8 spec/api/query/text_field_scoping_examples.rb