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.6.2 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.6.1 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.6.0 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.23 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.22 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.21 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.20 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.19 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.18 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.17 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.16 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.15 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.14 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.13 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.12 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.11 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.10 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.9 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.8 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-0.5.7 spec/lib/scorpion/dependency/builder_dependency_spec.rb