Sha256: 06f3b4014b6a921c49c45c0b2a2ee34358a3c49a3ffbeb88765fe09d2614b2ff

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

require 'acceptance/spec_helper'

describe 'Indexing', :live => true do
  it "does not index files where the temp file exists" do
    path = Rails.root.join('db/sphinx/test/ts-article_core.tmp')
    FileUtils.mkdir_p Rails.root.join('db/sphinx/test')
    FileUtils.touch path

    article = Article.create! :title => 'Pancakes'
    index 'article_core'
    Article.search.should be_empty

    FileUtils.rm path
  end

  it "indexes files when other indices are already being processed" do
    path = Rails.root.join('db/sphinx/test/ts-book_core.tmp')
    FileUtils.mkdir_p Rails.root.join('db/sphinx/test')
    FileUtils.touch path

    article = Article.create! :title => 'Pancakes'
    index 'article_core'
    Article.search.should_not be_empty

    FileUtils.rm path
  end

  it "cleans up temp files even when an exception is raised" do
    FileUtils.mkdir_p Rails.root.join('db/sphinx/test')

    index 'article_core'

    file = Rails.root.join('db/sphinx/test/ts-article_core.tmp')
    File.exist?(file).should be_false
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thinking-sphinx-3.2.0 spec/acceptance/indexing_spec.rb
thinking-sphinx-3.1.4 spec/acceptance/indexing_spec.rb
thinking-sphinx-3.1.3 spec/acceptance/indexing_spec.rb
thinking-sphinx-3.1.2 spec/acceptance/indexing_spec.rb