require 'spec_helper' describe ThinkingSphinx::Deltas::ResqueDelta::DeltaJob do subject do ThinkingSphinx::Deltas::ResqueDelta::DeltaJob end describe '.perform' do let(:job) { double 'Job', :perform => true } before :each do allow(ThinkingSphinx::Deltas::ResqueDelta).to receive(:locked?).and_return(false) allow(ThinkingSphinx::Deltas::IndexJob).to receive(:new).and_return(job) end it "sets up the internal Thinking Sphinx job with the provided index" do subject.perform 'foo_delta' expect(ThinkingSphinx::Deltas::IndexJob).to have_received(:new).with('foo_delta') end it "executes the internal job" do allow(job).to receive(:perform) subject.perform 'foo_delta' expect(job).to have_received(:perform) end end end