Sha256: 95c33bd4e8c82185e00ada34310c4e6df767897e86c41bd9b743f9b8c007c098

Contents?: true

Size: 919 Bytes

Versions: 1

Compression:

Stored size: 919 Bytes

Contents

require 'spec_helper'

module Test
  module BuilderPrey
    class ClassDelegate
      def call( scorpion, *args, &block )
        Test
      end
    end

    module ModDelegate
      module_function

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

describe Scorpion::Prey::BuilderPrey do
  let( :scorpion ){ double }

  it "supports class hunting delegates" do
    prey = Scorpion::Prey::BuilderPrey.new( String, nil, Test::BuilderPrey::ClassDelegate.new )
    expect( prey.fetch( scorpion ) ).to be Test
  end

  it "supports module hunting delegates" do
    prey = Scorpion::Prey::BuilderPrey.new( String, nil, Test::BuilderPrey::ModDelegate )
    expect( prey.fetch( scorpion ) ).to be Test
  end

  it "supports block hunting delegates" do
    prey = Scorpion::Prey::BuilderPrey.new( String, nil ) do
      Test
    end
    expect( prey.fetch( scorpion ) ).to be Test
  end


end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scorpion-ioc-0.3.1 spec/lib/scorpion/prey/builder_prey_spec.rb