Permalink
Browse files

add more test around inline_templates

  • Loading branch information...
1 parent 1b8fda8 commit 46bb883d1bf7ff5b7a10f84510a2afc8d86697fb @sr sr committed Jan 29, 2010
Showing with 12 additions and 9 deletions.
  1. +12 −9 test/templates_test.rb
View
@@ -76,21 +76,18 @@ def with_default_layout
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 @@ def with_default_layout
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

0 comments on commit 46bb883

Please sign in to comment.