Sha256: 27313ca49bc5abfa9e08ec633313cf3539607e32448873e01d835df5b430d1dc

Contents?: true

Size: 1.44 KB

Versions: 6

Compression:

Stored size: 1.44 KB

Contents

require 'spec_helper'

describe ThinkingSphinx::Deltas::ResqueDelta::DeltaJob do
  describe '.perform' do
    before :each do
      ThinkingSphinx.suppress_delta_output = false
      ThinkingSphinx::Deltas::ResqueDelta::DeltaJob.stub(:` => true)
      ThinkingSphinx::Deltas::ResqueDelta::DeltaJob.stub(:puts => nil)
    end

    it "should output the delta indexing by default" do
      ThinkingSphinx::Deltas::ResqueDelta::DeltaJob.should_receive(:puts)
      ThinkingSphinx::Deltas::ResqueDelta::DeltaJob.perform(['foo_core'])
    end

    it "should not output the delta indexing if requested" do
      ThinkingSphinx.suppress_delta_output = true
      ThinkingSphinx::Deltas::ResqueDelta::DeltaJob.should_not_receive(:puts)
      ThinkingSphinx::Deltas::ResqueDelta::DeltaJob.perform(['foo_core'])
    end

    it "should process just the requested indexes" do
      ThinkingSphinx::Deltas::ResqueDelta::DeltaJob.should_receive(:`) do |command|
        command.should match(/foo_core/)
        command.should_not match(/--all/)
      end
      ThinkingSphinx::Deltas::ResqueDelta::DeltaJob.perform(['foo_core'])
    end

    context 'multiple indexes' do
      it "should process all requested indexes" do
        ThinkingSphinx::Deltas::ResqueDelta::DeltaJob.should_receive(:`) do |command|
          command.should match(/foo_core bar_core/)
        end
        ThinkingSphinx::Deltas::ResqueDelta::DeltaJob.perform(['foo_core', 'bar_core'])
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ts-resque-delta-0.0.6 spec/thinking_sphinx/deltas/resque_delta/delta_job_spec.rb
ts-resque-delta-0.0.5 spec/thinking_sphinx/deltas/resque_delta/delta_job_spec.rb
ts-resque-delta-0.0.4 spec/thinking_sphinx/deltas/resque_delta/delta_job_spec.rb
ts-resque-delta-0.0.3 spec/thinking_sphinx/deltas/resque_delta/delta_job_spec.rb
ts-resque-delta-0.0.2 spec/thinking_sphinx/deltas/resque_delta/delta_job_spec.rb
ts-resque-delta-0.0.1 spec/thinking_sphinx/deltas/resque_delta/delta_job_spec.rb