Sha256: 81b72feaf955cca263cb214ca9b75602f4854868c54aebe3ccb2487888445ed7

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

require "#{File.dirname(__FILE__)}/../test_helper"

class DeltaTest < Test::Unit::TestCase

  S = Ultrasphinx::Search
  E = Ultrasphinx::UsageError
  STRFTIME = "%b %d %Y %H:%M:%S" # Chronic can't parse the default date .to_s
  
  def test_delta_update
  
    # XXX Not really necessary?
    Dir.chdir "#{HERE}/integration/app" do    
      Echoe.silence do
        system("rake db:fixtures:load")
        system("rake ultrasphinx:index")
      end
    end

    @count = S.new.total_entries

    @new = User.new
    @new.save!
    User.find(2).update_attribute(:created_at, Time.now)
    
    Dir.chdir "#{HERE}/integration/app" do    
      Echoe.silence { system("rake ultrasphinx:index:delta") }
    end
    
    assert_equal @count + 1, S.new.total_entries
    @new.destroy

    Dir.chdir "#{HERE}/integration/app" do    
      Echoe.silence { system("rake ultrasphinx:index:delta") }
    end

    assert_equal @count, S.new.total_entries
  end
  
  def test_merge
    Dir.chdir "#{HERE}/integration/app" do    
      Echoe.silence do
        system("rake ultrasphinx:daemon:start")
      end

      output = `rake ultrasphinx:index:merge 2>&1`
      assert_match /merged 0.1 Kwords/, output
      assert_match /Index rotated ok/, output
    end
  end  
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ultrasphinx-1.11 test/integration/delta_test.rb