diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-02-01 10:59:17 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2013-02-01 10:59:17 +0100 |
commit | e02cbcfae357acd51811b9ee0ddb353b7b4bb48c (patch) | |
tree | cbf08138aed507d29d61c1220a8e010d894ea97d /spec | |
parent | 8bbadf7b348a41855c557b2bf923b72851c83b98 (diff) | |
download | zorglub-e02cbcfae357acd51811b9ee0ddb353b7b4bb48c.zip zorglub-e02cbcfae357acd51811b9ee0ddb353b7b4bb48c.tar.gz |
Node#partial: add first param env, allow by passing hooks
Diffstat (limited to 'spec')
-rw-r--r-- | spec/node_spec.rb | 20 | ||||
-rw-r--r-- | spec/spec_helper.rb | 4 |
2 files changed, 22 insertions, 2 deletions
diff --git a/spec/node_spec.rb b/spec/node_spec.rb index 654966f..021aea5 100644 --- a/spec/node_spec.rb +++ b/spec/node_spec.rb @@ -167,11 +167,27 @@ describe Zorglub do end # it "partial should render correctly" do - Node0.partial(:do_partial, 1, 2).should == 'partial_content' + Node0.partial({},:do_partial, 1, 2).should == 'partial_content' end # it "method level view should work" do - Node0.partial(:other_view).should == 'partial_content' + Node0.partial({},:other_view).should == 'partial_content' + end + # + it "partial with hooks should be default" do + Node3.before = 0 + Node3.after = 0 + Node3.partial({},:do_partial,1,2).should == 'partial_content' + Node3.before.should == 1 + Node3.after.should == 1 + end + # + it "partial without hooks should work" do + Node3.before = 0 + Node3.after = 0 + Node3.partial({:no_hooks=>true},:do_partial,1,2).should == 'partial_content' + Node3.before.should == 0 + Node3.after.should == 0 end # it "static pages should be generated" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4d6740d..3347cf6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -116,6 +116,10 @@ class Node3 < Zorglub::Node def index (Node3.before-Node3.after).should == 1 end + def do_partial a1, a2 + view! Node0.r('do_partial') + engine! 'real' + end end # class Node8 < Node3 |