Sha256: ebef77eee80974727f5f3979535982d4ca8951750f5b086123acc067b3e77d37

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

require File.expand_path(
    File.join(File.dirname(__FILE__), %w[.. .. lib germinate]))

module Germinate
  describe Pipeline, "given a set of processes" do
    before :each do 
      @intput   = stub("Input")
      @output1  = stub("Output 1")
      @output2  = stub("Output 2")
      @output3  = stub("Output 3")
      @process1 = stub("Process 1", :call => @output1)
      @process2 = stub("Process 2", :call => @output2)
      @process3 = stub("Process 3", :call => @output3)
      @it = Germinate::Pipeline.new([@process1, @process2, @process3])
    end

    it "should compose the processes into a pipeline" do
      @process1.should_receive(:call).with(@input).and_return(@output1)
      @process2.should_receive(:call).with(@output1).and_return(@output2)
      @process3.should_receive(:call).with(@output2).and_return(@output3)
      @it.call(@input).should == @output3
    end
  end

  describe Pipeline, "given no processes" do
    before :each do
      @it = Pipeline.new([])
     end
    
    it "should pass input through unchanged" do
      @it.call(["foo", "bar"]).should == ["foo", "bar"]
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
devver-germinate-1.2.0 spec/germinate/pipeline_spec.rb
germinate-1.2.0 spec/germinate/pipeline_spec.rb