Sha256: c2860075fd190000eb77bf569fa24cac23167f650c6d1159caa65a85f4432cc7

Contents?: true

Size: 1.15 KB

Versions: 5

Compression:

Stored size: 1.15 KB

Contents

require 'spec/spec_helper'

describe ThinkingSphinx::Deltas::Job do
  describe '.cancel_thinking_sphinx_jobs' do
    before :each do
      ThinkingSphinx::Deltas::Job.stub!(:delete_all => true)
    end
    
    it "should not delete any rows if the delayed_jobs table does not exist" do
      ThinkingSphinx::Deltas::Job.connection.stub!(:tables => [])
      ThinkingSphinx::Deltas::Job.should_not_receive(:delete_all)
      
      ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs
    end
    
    it "should delete rows if the delayed_jobs table does exist" do
      ThinkingSphinx::Deltas::Job.connection.stub!(:tables => ['delayed_jobs'])
      ThinkingSphinx::Deltas::Job.should_receive(:delete_all)
      
      ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs
    end
    
    it "should delete only Thinking Sphinx jobs" do
      ThinkingSphinx::Deltas::Job.connection.stub!(:tables => ['delayed_jobs'])
      ThinkingSphinx::Deltas::Job.should_receive(:delete_all) do |sql|
        sql.should match(/handler LIKE '--- !ruby\/object:ThinkingSphinx::Deltas::\%'/)
      end
      
      ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs
    end
  end
end

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
thinking-sphinx-099-1.2.13 spec/lib/thinking_sphinx/deltas/job_spec.rb
thinking-sphinx-1.2.13 spec/lib/thinking_sphinx/deltas/job_spec.rb
moneypools-thinking-sphinx-1.2.13 spec/lib/thinking_sphinx/deltas/job_spec.rb
moneypools-thinking-sphinx-1.2.12 spec/lib/thinking_sphinx/deltas/job_spec.rb
warp-thinking-sphinx-1.2.12 spec/lib/thinking_sphinx/deltas/job_spec.rb