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:
Matt Wildig 2013-06-14 23:32:20 +01:00
parent 96c755ed27
commit b6e6e523fc
1 changed files with 15 additions and 0 deletions

View File

@ -79,6 +79,21 @@ class TemplatesTest < Test::Unit::TestCase
assert_equal "Hello World!", body
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
render_app { render(:test, 'Hello World') }
assert ok?