add more test around inline_templates
This commit is contained in:
parent
1b8fda825e
commit
46bb883d1b
|
@ -76,21 +76,18 @@ class TemplatesTest < Test::Unit::TestCase
|
||||||
assert_equal "Layout 3!\nHello World!\n", body
|
assert_equal "Layout 3!\nHello World!\n", body
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'loads templates from source file with inline_templates enabled' do
|
it 'loads templates from source file' do
|
||||||
mock_app {
|
mock_app { enable :inline_templates }
|
||||||
enable :inline_templates
|
|
||||||
}
|
|
||||||
assert_equal "this is foo\n\n", @app.templates[:foo][0]
|
assert_equal "this is foo\n\n", @app.templates[:foo][0]
|
||||||
assert_equal "X\n= yield\nX\n", @app.templates[:layout][0]
|
assert_equal "X\n= yield\nX\n", @app.templates[:layout][0]
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'loads templates from specified views directory' do
|
it 'loads templates from given source file' do
|
||||||
render_app { render :test, :hello, :views => options.views + '/foo' }
|
mock_app { set :inline_templates, __FILE__ }
|
||||||
|
assert_equal "this is foo\n\n", @app.templates[:foo][0]
|
||||||
assert_equal "from another views directory\n", body
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'use_in_file_templates simply ignores IO errors' do
|
test 'inline_templates ignores IO errors' do
|
||||||
assert_nothing_raised {
|
assert_nothing_raised {
|
||||||
mock_app {
|
mock_app {
|
||||||
set :inline_templates, '/foo/bar'
|
set :inline_templates, '/foo/bar'
|
||||||
|
@ -100,6 +97,12 @@ class TemplatesTest < Test::Unit::TestCase
|
||||||
assert @app.templates.empty?
|
assert @app.templates.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'loads templates from specified views directory' do
|
||||||
|
render_app { render :test, :hello, :views => options.views + '/foo' }
|
||||||
|
|
||||||
|
assert_equal "from another views directory\n", body
|
||||||
|
end
|
||||||
|
|
||||||
it 'passes locals to the layout' do
|
it 'passes locals to the layout' do
|
||||||
mock_app {
|
mock_app {
|
||||||
template :my_layout do
|
template :my_layout do
|
||||||
|
|
Loading…
Reference in New Issue