Sha256: 033df254981bfb9870a81c3cebebf225bfe7266d11ff1f9d6286d1a7690389a3

Contents?: true

Size: 694 Bytes

Versions: 5

Compression:

Stored size: 694 Bytes

Contents

require 'spec_helper'

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

  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

5 entries across 5 versions & 1 rubygems

Version Path
dependor-0.0.6 spec/dependor/customized_injector_spec.rb
dependor-0.0.5 spec/dependor/customized_injector_spec.rb
dependor-0.0.4 spec/dependor/customized_injector_spec.rb
dependor-0.0.3 spec/dependor/customized_injector_spec.rb
dependor-0.0.2 spec/dependor/customized_injector_spec.rb