From 66501cb0e23f40ea5ae1fe6185b23ffcb3d55de4 Mon Sep 17 00:00:00 2001 From: Jérémy Zurcher Date: Mon, 16 Jan 2012 15:40:34 +0100 Subject: add view_base_path! specs --- spec/node_spec.rb | 6 ++++++ spec/spec_helper.rb | 10 ++++++++++ 2 files changed, 16 insertions(+) (limited to 'spec') diff --git a/spec/node_spec.rb b/spec/node_spec.rb index 5c3e2e2..66ff114 100644 --- a/spec/node_spec.rb +++ b/spec/node_spec.rb @@ -209,6 +209,12 @@ describe Zorglub do r.body[0].should == "

Hello world

\n" end # + it "view_base_path! should work" do + r = Node7.my_call '/view_path' + h = YAML.load r.body[0] + h[:view].should == File.join(Zorglub::Config.root, 'alt/do_render') + end + # end # end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6a71ef4..4a5a9b2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -164,6 +164,15 @@ class Node6 < Zorglub::Node @value = Node6.static_cpt end end +# +class Node7 < Zorglub::Node + Zorglub::Config.debug=true + view_base_path! File.join Zorglub::Config.root, 'alt' + def view_path + view! 'do_render' + end +end + # APP = Zorglub::App.new do map '/node0', Node0 @@ -172,6 +181,7 @@ APP = Zorglub::App.new do map '/node4', Node4 map '/node5', Node5 map '/node6', Node6 + map '/node7', Node7 end class Node2 map APP, '/node2' -- cgit v1.2.3