Sha256: 174a151a6fdfc926644e56568b17e1449c1dd40726fce11575a0a0c96a1c42bb

Contents?: true

Size: 667 Bytes

Versions: 1

Compression:

Stored size: 667 Bytes

Contents

require "spec_helper"

describe Spank::IOC do
  after :each do
    Spank::IOC.unbind
  end

  context "when bound to a container" do
    let(:container) { double }
    let(:component) { double }

    before :each do
      container.stub(:resolve).with(:idbconnection).and_return(component)
      Spank::IOC.bind_to(container)
    end

    let(:result) { Spank::IOC.resolve(:idbconnection) }

    it "resolves the item from the container" do
      result.should == component
    end
  end

  context "when nothing is bound" do
    it "raises a meaningful exception" do
      expect { Spank::IOC.resolve(:food) }.to raise_error(Spank::ContainerError)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spank-0.0.1393558686 spec/unit/ioc_spec.rb