Test for explitily setting layout true
See #727 If the default options for a template include :layout => false, it should be possible to override this in the explicit options to the rendering method. e.g. set :slim, :layout => false get '/' do slim :index, :layout => true # should render with layout end
This commit is contained in:
parent
96c755ed27
commit
b6e6e523fc
|
@ -79,6 +79,21 @@ class TemplatesTest < Test::Unit::TestCase
|
||||||
assert_equal "Hello World!", body
|
assert_equal "Hello World!", body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'allows overriding false default layout with explicit true' do
|
||||||
|
mock_app do
|
||||||
|
template(:layout) { 'Layout!!! <%= yield %>' }
|
||||||
|
set :erb, :layout => false
|
||||||
|
|
||||||
|
get('/') do
|
||||||
|
erb('Hello World!', { :layout => true })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
get '/'
|
||||||
|
assert ok?
|
||||||
|
assert_equal "Layout!!! Hello World!", body
|
||||||
|
end
|
||||||
|
|
||||||
it 'renders String templates directly' do
|
it 'renders String templates directly' do
|
||||||
render_app { render(:test, 'Hello World') }
|
render_app { render(:test, 'Hello World') }
|
||||||
assert ok?
|
assert ok?
|
||||||
|
|
Loading…
Reference in New Issue