summaryrefslogtreecommitdiffstats
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-01-03 23:16:36 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2012-01-03 23:16:36 +0100
commitdba8a2aad7ae72c73e5629b49e782e235eb404b6 (patch)
tree052ff919f0fd9bfaf02ce10cb238d7eeaf644890 /spec/spec_helper.rb
parent069ab960ad7afcfbcabc35dcaa904c5940ee1b5c (diff)
downloadzorglub-dba8a2aad7ae72c73e5629b49e782e235eb404b6.zip
zorglub-dba8a2aad7ae72c73e5629b49e782e235eb404b6.tar.gz
spec: add view and layout rendering spec
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb15
1 files changed, 15 insertions, 0 deletions
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