spec/unit/context_spec.rb in blueprints-0.9.0 vs spec/unit/context_spec.rb in blueprints-1.0.0
- old
+ new
@@ -44,10 +44,11 @@
Blueprints::Context.eval_within_context(:dependencies => [:within_dep]) do
method(1)
Blueprints::Context.current.dependencies.should == [:within_dep]
end
Blueprints::Context.current.should == context
+ Blueprints::Context.send(:class_variable_get, :@@chain).pop
end
end
describe "child contexts" do
it "should yield and return child context with attributes" do
@@ -82,19 +83,25 @@
it "should allow creating blueprint inside namespace" do
bp = nil
namespace = subject.namespace(:namespace) { bp = self.blueprint :blueprint }
bp.namespace.should == namespace
- namespace.children.should == {:blueprint => bp}
+ namespace.children.should == [bp]
end
it "should allow creating blueprint with inferred name" do
blueprint = subject.attributes(:name => 'bp').blueprint
blueprint.name.should == :bp
end
it "should allow setting dependency" do
dep = context.d(:bp, :option => 'val')
dep.should be_instance_of(Blueprints::Dependency)
+ end
+
+ it "should allow finding blueprint you define" do
+ blueprint = subject.blueprint :blueprint
+ subject.find(:blueprint).should == blueprint
+ subject[:blueprint].should == blueprint
end
end
end