From 46bb883d1bf7ff5b7a10f84510a2afc8d86697fb Mon Sep 17 00:00:00 2001 From: Simon Rozet Date: Fri, 29 Jan 2010 18:18:19 +0100 Subject: [PATCH] add more test around inline_templates --- test/templates_test.rb | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test/templates_test.rb b/test/templates_test.rb index 98560705..ba98d5d0 100644 --- a/test/templates_test.rb +++ b/test/templates_test.rb @@ -76,21 +76,18 @@ class TemplatesTest < Test::Unit::TestCase assert_equal "Layout 3!\nHello World!\n", body end - it 'loads templates from source file with inline_templates enabled' do - mock_app { - enable :inline_templates - } + it 'loads templates from source file' do + mock_app { enable :inline_templates } assert_equal "this is foo\n\n", @app.templates[:foo][0] assert_equal "X\n= yield\nX\n", @app.templates[:layout][0] 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 + it 'loads templates from given source file' do + mock_app { set :inline_templates, __FILE__ } + assert_equal "this is foo\n\n", @app.templates[:foo][0] end - test 'use_in_file_templates simply ignores IO errors' do + test 'inline_templates ignores IO errors' do assert_nothing_raised { mock_app { set :inline_templates, '/foo/bar' @@ -100,6 +97,12 @@ class TemplatesTest < Test::Unit::TestCase assert @app.templates.empty? 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 mock_app { template :my_layout do