Sha256: 5b67a63e3f1bb53ac873181564d825a2e519a3e02d8bc8173a534ab39d79c108

Contents?: true

Size: 696 Bytes

Versions: 2

Compression:

Stored size: 696 Bytes

Contents

require 'spec_helper'

describe Dependor::CustomizedInjector do
  let(:other_injector) { double }

  it "returns the customized dependency if given" do
    injector = Dependor::CustomizedInjector.new(other_injector, foo: 'hello')

    injector.get(:foo).should == 'hello'
  end

  it "returns the customized dependency even if nil" do
    injector = Dependor::CustomizedInjector.new(other_injector, foo: nil)

    injector.get(:foo).should be_nil
  end

  it "delegates to the other injector" do
    other_injector.should_receive(:get).with(:foo).and_return(:the_foo)

    injector = Dependor::CustomizedInjector.new(other_injector, bar: 'a')

    injector.get(:foo).should == :the_foo
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dependor-1.0.1 spec/dependor/customized_injector_spec.rb
dependor-1.0.0 spec/dependor/customized_injector_spec.rb