Sha256: ba0d0d91c537fd4f52a449192ce0e54679da1badb5c4998d65cc39d8dbdf1310
Contents?: true
Size: 1.72 KB
Versions: 1
Compression:
Stored size: 1.72 KB
Contents
require 'spec_helper' describe ThinkingSphinx::Deltas::Job do describe '.enqueue' do before :each do ThinkingSphinx::Deltas::Job.stub!(:count => 0) end it "should enqueue if there's no existing jobs for the same index" do Delayed::Job.should_receive(:enqueue) ThinkingSphinx::Deltas::Job.enqueue(stub('object')) end it "should not enqueue the job if there's an existing job already" do ThinkingSphinx::Deltas::Job.stub!(:count => 1) Delayed::Job.should_not_receive(:enqueue) ThinkingSphinx::Deltas::Job.enqueue(stub('object')) end end describe '.cancel_thinking_sphinx_jobs' do before :each do ThinkingSphinx::Deltas::Job.stub!(:connection => double('connection')) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ts-delayed-delta-1.1.3 | spec/thinking_sphinx/deltas/delayed_delta/job_spec.rb |