Sha256: 497aeb10728f21b175a645b8de65ab9da298bbcc48eb01ce43ebb84227047227

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe Itiel::Load::ChainedStep do
  before :each do
    klass = Class.new
    klass.send :include, Itiel::Load::ChainedStep

    @step = klass.new
  end

  it "defines next_step" do
    expect(@step).to respond_to(:next_step)
    expect(@step).to respond_to(:next_step=)
  end

  describe :persist do
    it "raises an error if undefined" do
      expect { @step.persist([]) }.to raise_error Itiel::MethodNotImplementedException
    end
  end

  describe :input= do
    before :each do
      @next_step      = double
      @input          = [ double ]
      @step.next_step = @next_step

      expect(Itiel::Logger).to receive(:log_received).with(@step, @input.size)
      expect(Itiel::Logger).to receive(:log_processed).with(@step, @input.size)
    end

    it "calls persist with the stream received through input= and sends it to next_step" do
      expect(@step).to receive(:persist).with @input
      expect(@next_step).to receive(:input=).with @input
      @step.input = @input
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
itiel-0.1.2 spec/loader/chained_step_spec.rb
itiel-0.1.1 spec/loader/chained_step_spec.rb
itiel-0.1.0 spec/loader/chained_step_spec.rb