Sha256: f9fe4f13061b57078bf3e383fcc2e6d94426155bfe518d9afa2a1697f631d8d1

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Chain::DSL, '#processors' do
  subject { object.processors }

  let(:env)       { Spec::FAKE_ENV }
  let(:processor) { Spec::FAKE_PROCESSOR }

  context "and a block is given" do
    let(:object) { described_class.new(env, chain, &block) }
    let(:chain)  { Chain::EMPTY }
    let(:block)  { lambda { |_| use(Spec::FAKE_PROCESSOR) } }

    it { should include(processor) }

    its(:length) { should == 1 }
  end

  context "and no block is given" do
    let(:object) { described_class.new(env, chain) }
    let(:chain)  { Chain.new([ processor ]) }

    it { should include(processor) }

    its(:length) { should == 1 }
  end

  # TODO move this elsewhere once mutant supports it
  context "test DSL#initialize" do
    let(:object) { described_class.new(env, chain, &block) }
    let(:chain)  { Chain::EMPTY }
    let(:block)  { lambda { |_| use(Spec::FAKE_PROCESSOR) } }

    it { should include(processor) }

    it "passes down the env to registered processors" do
      subject.first.env.should be(env)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
substation-0.0.10.beta2 spec/unit/substation/chain/dsl/processors_spec.rb