File: customized_injector_spec.rb

package info (click to toggle)
ruby-dependor 1.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 264 kB
  • sloc: ruby: 557; makefile: 2; sh: 1
file content (25 lines) | stat: -rw-r--r-- 696 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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