Sha256: b00fed33d3ef9dc665aed6f296d3aa008a36ecd0cb42b194f60441b21683da57

Contents?: true

Size: 1.06 KB

Versions: 17

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

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'
    expect(Article.search).to 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'
    expect(Article.search).not_to 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')
    expect(File.exist?(file)).to be_falsey
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
thinking-sphinx-5.6.0 spec/acceptance/indexing_spec.rb
thinking-sphinx-5.5.1 spec/acceptance/indexing_spec.rb
thinking-sphinx-5.5.0 spec/acceptance/indexing_spec.rb
thinking-sphinx-5.4.0 spec/acceptance/indexing_spec.rb
thinking-sphinx-5.3.0 spec/acceptance/indexing_spec.rb
thinking-sphinx-5.2.1 spec/acceptance/indexing_spec.rb
thinking-sphinx-5.2.0 spec/acceptance/indexing_spec.rb
thinking-sphinx-5.1.0 spec/acceptance/indexing_spec.rb
thinking-sphinx-5.0.0 spec/acceptance/indexing_spec.rb
thinking-sphinx-4.4.1 spec/acceptance/indexing_spec.rb
thinking-sphinx-4.4.0 spec/acceptance/indexing_spec.rb
thinking-sphinx-4.3.2 spec/acceptance/indexing_spec.rb
thinking-sphinx-4.3.1 spec/acceptance/indexing_spec.rb
thinking-sphinx-4.3.0 spec/acceptance/indexing_spec.rb
thinking-sphinx-4.2.0 spec/acceptance/indexing_spec.rb
thinking-sphinx-4.1.0 spec/acceptance/indexing_spec.rb
thinking-sphinx-4.0.0 spec/acceptance/indexing_spec.rb