Sha256: c1367a2eac8a794b23c390ab7317a3b9eb772cf1f03ddb5d39940ff684bfc1d7

Contents?: true

Size: 786 Bytes

Versions: 5

Compression:

Stored size: 786 Bytes

Contents

require "spec_helper"

describe Massive::FileJob do
  let(:process)  { Massive::FileProcess.new file_attributes: { url: 'http://someurl.com' } }
  let(:step)     { Massive::FileStep.new process: process }
  let(:job)      { Massive::FileJob.new step: step, offset: 1000, limit: 300 }

  it "delegates file to step" do
    step.file.should eq(step.file)
  end

  describe "when running through each item" do
    let(:file) { process.file }
    let(:block) { Proc.new { } }

    it "yields the process range of the file processor, with its offset and limit" do
      file.stub_chain(:processor, :process_range)
          .with({ offset: job.offset, limit: job.limit })
          .and_yield(block)

      expect { |block| job.each_item(&block) }.to yield_control(&block)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
massive-0.4.0 spec/models/massive/file_job_spec.rb
massive-0.3.0 spec/models/massive/file_job_spec.rb
massive-0.2.0 spec/models/massive/file_job_spec.rb
massive-0.1.1 spec/models/massive/file_job_spec.rb
massive-0.1.0 spec/models/massive/file_job_spec.rb