Sha256: 97523fb12dfcd3a949e15107db26c7ac18c32ef25760efed8bd51b1d7f73c9bc

Contents?: true

Size: 1.04 KB

Versions: 27

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

module Test
  module BuilderDependency
    class ClassDelegate
      def call( hunt, *args, &block )
        Test
      end
    end

    module ModDelegate
      module_function

      def call( hunt, *args, &block )
        Test
      end
    end
  end
end

describe Scorpion::Dependency::BuilderDependency do
  let( :scorpion ){ double }
  let( :hunt ){ Scorpion::Hunt.new( scorpion, String, nil ) }

  it "supports class hunting delegates" do
    dependency = Scorpion::Dependency::BuilderDependency.new( String, nil, Test::BuilderDependency::ClassDelegate.new )
    expect( dependency.fetch( hunt ) ).to be Test
  end

  it "supports module hunting delegates" do
    dependency = Scorpion::Dependency::BuilderDependency.new( String, nil, Test::BuilderDependency::ModDelegate )
    expect( dependency.fetch( hunt ) ).to be Test
  end

  it "supports block hunting delegates" do
    dependency = Scorpion::Dependency::BuilderDependency.new( String, nil ) do
      Test
    end
    expect( dependency.fetch( hunt ) ).to be Test
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
scorpion-ioc-0.5.6 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.5 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.4 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.2 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.1 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.0 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.4.0 spec/lib/scorpion/dependency/builder_dependency_spec.rb