diff options
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/acts_as_xapian_spec.rb | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/spec/lib/acts_as_xapian_spec.rb b/spec/lib/acts_as_xapian_spec.rb index d411bf856..1d9256441 100644 --- a/spec/lib/acts_as_xapian_spec.rb +++ b/spec/lib/acts_as_xapian_spec.rb @@ -3,13 +3,19 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe ActsAsXapian::Search do - before :all do - # make sure an index exists - ActsAsXapian.update_index - end - describe "#words_to_highlight" do + before :all do + # make sure an index exists + @alice = FactoryGirl.create(:public_body, :name => 'alice') + ActsAsXapian.update_index + end + + after :all do + @alice.destroy + ActsAsXapian.update_index + end + it "should return a list of words used in the search" do s = ActsAsXapian::Search.new([PublicBody], "albatross words", :limit => 100) s.words_to_highlight.should == ["albatross", "word"] @@ -80,6 +86,12 @@ describe ActsAsXapian::Search do ActsAsXapian.update_index end + after :all do + @alice.destroy + @bob.destroy + ActsAsXapian.update_index + end + it 'returns a UTF-8 encoded string' do s = ActsAsXapian::Search.new([PublicBody], "alece", :limit => 100) s.spelling_correction.should == "alice" @@ -93,12 +105,6 @@ describe ActsAsXapian::Search do s.spelling_correction.should == "bôbby" end - after :all do - @alice.destroy - @bob.destroy - ActsAsXapian.update_index - end - end end
\ No newline at end of file |