summaryrefslogtreecommitdiffstats
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-01-05 12:23:39 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2012-01-05 12:23:39 +0100
commitfc3f593b5357849891b00a453e9d778560c6049e (patch)
tree10e169564288bfed5731e839468b3790c293e7d0 /spec/spec_helper.rb
parent0827f783531b318af55a1048ad69ee4c112e0873 (diff)
downloadzorglub-fc3f593b5357849891b00a453e9d778560c6049e.zip
zorglub-fc3f593b5357849891b00a453e9d778560c6049e.tar.gz
spec: add specs for static pages generation
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index c379361..c1e6d64 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -13,6 +13,7 @@ require 'yaml'
require 'zorglub'
#
HASH_PROC = Proc.new { |path,obj| {:path=>path,:layout=>obj.layout,:view=>obj.view,:args=>obj.args,:map=>obj.map}.to_yaml }
+STATIC_PROC = Proc.new { |path,obj| ["VAL #{obj.value}",'text/static'] }
RENDER_PROC = Proc.new { |path,obj|
case obj.state
when :layout
@@ -29,6 +30,7 @@ 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.register_engine 'static', nil, STATIC_PROC
#
Zorglub::Config[:engine] = 'default'
Zorglub::Config.root = File.join Dir.pwd, 'spec', 'data'
@@ -43,6 +45,10 @@ class Temp < Zorglub::Node
end
#
class Node0 < Zorglub::Node
+ @static_cpt=0
+ class << self
+ attr_accessor :static_cpt
+ end
# default
def index
html
@@ -66,6 +72,21 @@ class Node0 < Zorglub::Node
def do_redirect
redirect r(:do_partial,1,2,3)
end
+ attr_reader :value
+ def no_static
+ static false
+ engine 'static'
+ view r('do_render')
+ Node0.static_cpt+=1
+ @value = Node0.static_cpt
+ end
+ def do_static
+ static true
+ engine 'static'
+ view r('do_render')
+ Node0.static_cpt+=1
+ @value = Node0.static_cpt
+ end
end
#
class Node1 < Zorglub::Node