summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/zorglub/node.rb6
-rw-r--r--spec/node_spec.rb10
-rw-r--r--spec/spec_helper.rb4
3 files changed, 16 insertions, 4 deletions
diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb
index 68e535b..c85e42d 100644
--- a/lib/zorglub/node.rb
+++ b/lib/zorglub/node.rb
@@ -121,9 +121,11 @@ module Zorglub
@content = self.send @options[:method], *@options[:args]
v, l, e = view, layout, Config.engine_proc(@options[:engine])
state (@options[:layout].nil? ? :partial : :view)
- @content, @mime = e.call v, self if e and File.exists? v
+ @content, mime = e.call v, self if e and File.exists? v
+ @mime = mime unless mime.nil?
state :layout
- @content, @mime = e.call l, self if e and File.exists? l
+ @content, mime = e.call l, self if e and File.exists? l
+ @mime = mime unless mime.nil?
state :post_cb
Node.call_after_hooks self
state :finished
diff --git a/spec/node_spec.rb b/spec/node_spec.rb
index b667338..f78eb64 100644
--- a/spec/node_spec.rb
+++ b/spec/node_spec.rb
@@ -118,6 +118,16 @@ describe Zorglub do
r.body[0].should == "layout_start view_content layout_end"
end
#
+ it "default mime-type should be text/html" do
+ r = Node0.my_call '/index'
+ r.header['Content-type'].should == 'text/html'
+ end
+ #
+ it "should be able to override mime-type" do
+ r = Node0.my_call '/do_render'
+ r.header['Content-type'].should == 'text/view'
+ end
+ #
it "partial should render correctly" do
Node0.partial(:do_partial, 1, 2).should == 'partial_content'
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 35b8e2a..c379361 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -18,9 +18,9 @@ RENDER_PROC = Proc.new { |path,obj|
when :layout
"layout_start #{obj.content} layout_end"
when :view
- "view_content"
+ ["view_content", 'text/view']
when :partial
- 'partial_content'
+ ['partial_content','text/partial']
else
raise Exception.new
end