diff options
-rw-r--r-- | spec/data/view/node0/do_render | 0 | ||||
-rw-r--r-- | spec/node_spec.rb | 7 | ||||
-rw-r--r-- | spec/spec_helper.rb | 15 |
3 files changed, 22 insertions, 0 deletions
diff --git a/spec/data/view/node0/do_render b/spec/data/view/node0/do_render new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/spec/data/view/node0/do_render diff --git a/spec/node_spec.rb b/spec/node_spec.rb index 40ea901..cc665b7 100644 --- a/spec/node_spec.rb +++ b/spec/node_spec.rb @@ -105,6 +105,13 @@ describe Zorglub do Node3.call( {'PATH_INFO'=>'/index'} ) Node3.after.should == 3 end + # + it "should find view and layout and render them" do + r = Node0.call( {'PATH_INFO'=>'/do_render'} ) + r.status.should == 200 + r.body[0].should == "layout_start view_content layout_end" + end + # end # end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index aa096e7..5763a8c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,9 +13,21 @@ require 'yaml' require 'zorglub' # HASH_PROC = Proc.new { |path,obj| {:path=>path,:layout=>obj.layout,:view=>obj.view,:args=>obj.args}.to_yaml } +RENDER_PROC = Proc.new { |path,obj| + m = obj.action[:mode] + case m + when :layout + "layout_start #{obj.content} layout_end" + when :view + "view_content" + else + raise Exception.new + end +} Zorglub::Config.register_engine 'default', nil, HASH_PROC Zorglub::Config.register_engine 'engine-1', 'spec', HASH_PROC Zorglub::Config.register_engine 'engine-2', 'spec', HASH_PROC +Zorglub::Config.register_engine 'real', nil, RENDER_PROC # Zorglub::Config[:engine] = 'default' Zorglub::Config.root = File.join Dir.pwd, 'spec', 'data' @@ -34,6 +46,9 @@ class Node0 < Zorglub::Node end def with_2args a1, a2 end + def do_render + engine 'real' + end end # class Node1 < Zorglub::Node |