spec/dress_spec.rb in dress-0.0.1 vs spec/dress_spec.rb in dress-0.0.2
- old
+ new
@@ -107,5 +107,41 @@
node.xpath("foo/@b").map(&:value).should == ["2"]
node.xpath("//bar/@a").map(&:value).should == ["1"]
node.xpath("//bar/@b").map(&:value).should == ["2"]
end
end
+
+describe "Dress::Maker" do
+ it "renders" do
+ d = DressMaker {
+ layout { n(wrapper_helper) }
+ layout(:foo) { foo { content }}
+
+ def content1
+ some_stuff(:a => "10", :b => "20") { inside }
+ end
+
+ def wrapper_helper
+ wrap1 { wrap2 { content }}
+ end
+ }
+ d.render(:content1).to_s.should == '<wrap1><wrap2><some_stuff a="10" b="20"><inside></inside></some_stuff></wrap2></wrap1>'
+ d.render_with(:foo,:content1).to_s.should == '<foo><some_stuff a="10" b="20"><inside></inside></some_stuff></foo>'
+ end
+
+ class D1 < Dress::Maker
+ layout { foo { content }}
+ end
+
+ class D2 < D1
+ def bar
+ "bar"
+ end
+ end
+
+ it "inherit layouts" do
+ #p D1.layout_defs
+ #p D2.layout_defs
+ D2.layouts.should_not be_empty
+ #D1.render(:bar)
+ end
+end