From 97dcc225201ff9652cf443c42f8abbcfd9ba86c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 5 Jan 2012 14:08:04 +0100 Subject: spec: check class level static definition --- spec/node_spec.rb | 8 ++++---- spec/spec_helper.rb | 42 +++++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/spec/node_spec.rb b/spec/node_spec.rb index 5b5d97d..6c83a13 100644 --- a/spec/node_spec.rb +++ b/spec/node_spec.rb @@ -152,16 +152,16 @@ describe Zorglub do end # it "static pages should be generated" do - r = Node0.my_call '/do_static' + r = Node6.my_call '/do_static' r.body[0].should == 'VAL 1' r.header['Content-type'].should == 'text/static' - r = Node0.my_call '/do_static' + r = Node6.my_call '/do_static' r.body[0].should == 'VAL 1' r.header['Content-type'].should == 'text/static' - r = Node0.my_call '/do_static' + r = Node6.my_call '/do_static' r.body[0].should == 'VAL 1' r.header['Content-type'].should == 'text/static' - r = Node0.my_call '/no_static' + r = Node6.my_call '/no_static' r.body[0].should == 'VAL 4' r.header['Content-type'].should == 'text/static' end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c1e6d64..8d7a9bd 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -45,10 +45,6 @@ class Temp < Zorglub::Node end # class Node0 < Zorglub::Node - @static_cpt=0 - class << self - attr_accessor :static_cpt - end # default def index html @@ -72,21 +68,6 @@ 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 @@ -144,12 +125,35 @@ class Node5 < Node4 end end # +class Node6 < Zorglub::Node + @static_cpt=0 + class << self + attr_accessor :static_cpt + end + attr_reader :value + static true + def no_static + static false + engine 'static' + view Node0.r('do_render') + Node6.static_cpt+=1 + @value = Node6.static_cpt + end + def do_static + engine 'static' + view Node0.r('do_render') + Node6.static_cpt+=1 + @value = Node6.static_cpt + end +end +# APP = Zorglub::App.new do map '/node0', Node0 map '/node1', Node1 map '/node3', Node3 map '/node4', Node4 map '/node5', Node5 + map '/node6', Node6 end class Node2 map APP, '/node2' -- cgit v1.1-2-g2b99