Sha256: 3530a39ff23c7fd7adfa3cdcf037efef8e8561e5f942e668b716ebf201dad713

Contents?: true

Size: 1.47 KB

Versions: 14

Compression:

Stored size: 1.47 KB

Contents

require File.join(File.dirname(__FILE__), 'spec_helper')

describe 'document removal', :type => :indexer do
  it 'removes an object from the index' do
    session.remove(post)
    connection.should have_delete("Post #{post.id}")
  end

  it 'removes an object by type and id' do
    session.remove_by_id(Post, 1)
    connection.should have_delete('Post 1')
  end

  it 'removes an object by type and id and immediately commits' do
    connection.should_receive(:delete_by_id).with('Post 1').ordered
    connection.should_receive(:commit).ordered
    session.remove_by_id!(Post, 1)
  end

  it 'removes an object from the index and immediately commits' do
    connection.should_receive(:delete_by_id).ordered
    connection.should_receive(:commit).ordered
    session.remove!(post)
  end

  it 'removes everything from the index' do
    session.remove_all
    connection.should have_delete_by_query("type:[* TO *]")
  end

  it 'removes everything from the index and immediately commits' do
    connection.should_receive(:delete_by_query).ordered
    connection.should_receive(:commit).ordered
    session.remove_all!
  end

  it 'removes everything of a given class from the index' do
    session.remove_all(Post)
    connection.should have_delete_by_query("type:Post")
  end

  it 'correctly escapes namespaced classes when removing everything from the index' do
    connection.should_receive(:delete_by_query).with('type:Namespaced\:\:Comment')
    session.remove_all(Namespaced::Comment)
  end
end

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
benjaminkrause-sunspot-0.9.7 spec/api/indexer/removal_spec.rb
benjaminkrause-sunspot-0.9.8 spec/api/indexer/removal_spec.rb
sunspot-0.10.9 spec/api/indexer/removal_spec.rb
sunspot-0.10.8 spec/api/indexer/removal_spec.rb
nxa-sunspot-0.10.7 spec/api/indexer/removal_spec.rb
sunspot-0.10.7 spec/api/indexer/removal_spec.rb
sunspot-0.10.6 spec/api/indexer/removal_spec.rb
sunspot-0.10.5 spec/api/indexer/removal_spec.rb
sunspot-0.10.4 spec/api/indexer/removal_spec.rb
kuahyeow-sunspot-0.10.3 spec/api/indexer/removal_spec.rb
sunspot-0.10.3 spec/api/indexer/removal_spec.rb
sunspot-0.10.2 spec/api/indexer/removal_spec.rb
sunspot-0.10.1 spec/api/indexer/removal_spec.rb
sunspot-0.10.0 spec/api/indexer/removal_spec.rb