Sha256: 89434a8a306f4b9fdd01d377936dbccbced45ca919df916889c54c463e369287

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 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, Test::BuilderDependency::ClassDelegate.new )
    expect( dependency.fetch( hunt ) ).to be Test
  end

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
scorpion-ioc-1.0.10 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-1.0.8 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-1.0.7 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-1.0.6 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-1.0.4 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-1.0.3 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-1.0.2 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-1.0.1 spec/lib/scorpion/dependency/builder_dependency_spec.rb
scorpion-ioc-1.0.0 spec/lib/scorpion/dependency/builder_dependency_spec.rb