Sha256: 4863aa0a2d62cec3b202ae31c1c5bc3b77819e7fd36a97a07c71166b6de2cae4
Contents?: true
Size: 999 Bytes
Versions: 9
Compression:
Stored size: 999 Bytes
Contents
require File.expand_path('../spec_helper', File.dirname(__FILE__)) describe 'indexing' do it 'should index non-multivalued field with newlines' do lambda do Sunspot.index!(Post.new(:title => "A\nTitle")) end.should_not raise_error end it 'should correctly remove by model instance' do post = Post.new(:title => 'test post') Sunspot.index!(post) Sunspot.remove!(post) Sunspot.search(Post) { with(:title, 'test post') }.results.should be_empty end it 'should correctly delete by ID' do post = Post.new(:title => 'test post') Sunspot.index!(post) Sunspot.remove_by_id!(Post, post.id) Sunspot.search(Post) { with(:title, 'test post') }.results.should be_empty end it 'removes documents by query' do Sunspot.remove_all! posts = [Post.new(:title => 'birds'), Post.new(:title => 'monkeys')] Sunspot.index!(posts) Sunspot.remove! do with(:title, 'birds') end Sunspot.search(Post).should have(2).results end end
Version data entries
9 entries across 9 versions & 2 rubygems