spec/unit/ioc_spec.rb in spank-0.0.1385937112 vs spec/unit/ioc_spec.rb in spank-0.0.1393558686
- old
+ new
@@ -1,8 +1,12 @@
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
@@ -10,10 +14,16 @@
Spank::IOC.bind_to(container)
end
let(:result) { Spank::IOC.resolve(:idbconnection) }
- it "should resove items from that container" do
+ 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