Use the default layout when calling :layout => true
This helps to write things like: haml :template, :layout => !request.xhr?
This commit is contained in:
parent
67906d391d
commit
b26df9ae95
|
@ -210,6 +210,7 @@ module Sinatra
|
|||
|
||||
def lookup_layout(engine, options)
|
||||
return if options[:layout] == false
|
||||
options.delete(:layout) if options[:layout] == true
|
||||
template = options[:layout] || :layout
|
||||
data = lookup_template(engine, template, options)
|
||||
[template, data]
|
||||
|
|
|
@ -52,6 +52,14 @@ describe 'Templating' do
|
|||
end
|
||||
end
|
||||
|
||||
it 'uses the default layout template if not really overriden' do
|
||||
with_default_layout do
|
||||
render_app { render :test, :hello, :layout => true }
|
||||
should.be.ok
|
||||
body.should.equal "Layout!\nHello World!\n"
|
||||
end
|
||||
end
|
||||
|
||||
it 'uses the layout template specified' do
|
||||
render_app { render :test, :hello, :layout => :layout2 }
|
||||
should.be.ok
|
||||
|
|
Loading…
Reference in New Issue