Sha256: c75ff0f1dc6ce227cc2314aabe4016d006c31c3b71570365ad56714d3d43470f

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'

describe ThinkingSphinx::Deltas::DeltaJob do
  describe '#perform' do
    before :each do
      ThinkingSphinx.suppress_delta_output = false

      @delta_job = ThinkingSphinx::Deltas::DeltaJob.new(['foo_core'])
      @delta_job.stub! :`    => true
      @delta_job.stub! :puts => nil
    end

    it "should output the delta indexing by default" do
      @delta_job.should_receive(:puts)

      @delta_job.perform
    end

    it "should not output the delta indexing if requested" do
      ThinkingSphinx.suppress_delta_output = true
      @delta_job.should_not_receive(:puts)

      @delta_job.perform
    end

    it "should process just the requested indices" do
      @delta_job.should_receive(:`) do |command|
        command.should match(/foo_core/)
        command.should_not match(/--all/)
      end

      @delta_job.perform
    end

    context 'multiple indices' do
      it "should process all requested indices" do
        @delta_job.indices = ['foo_core', 'bar_core']
        @delta_job.should_receive(:`) do |command|
          command.should match(/foo_core bar_core/)
        end

        @delta_job.perform
      end
    end
  end

  describe "#display_name" do
    it "should display class name with all indices" do
      @delta_job = ThinkingSphinx::Deltas::DeltaJob.new(['foo_core', 'bar_core'])
      @delta_job.display_name.should == "ThinkingSphinx::Deltas::DeltaJob for foo_core, bar_core"
    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/delta_job_spec.rb