mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Added exception handling of missing layouts (closes #5373) [chris@ozmm.org]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4550 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
73c80169c8
commit
11c715a53f
3 changed files with 24 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Added exception handling of missing layouts #5373 [chris@ozmm.org]
|
||||||
|
|
||||||
* Fixed that real files and symlinks should be treated the same when compiling templates #5438 [zachary@panandscan.com]
|
* Fixed that real files and symlinks should be treated the same when compiling templates #5438 [zachary@panandscan.com]
|
||||||
|
|
||||||
* Fixed that the flash should be reset when reset_session is called #5584 [shugo@ruby-lang.org]
|
* Fixed that the flash should be reset when reset_session is called #5584 [shugo@ruby-lang.org]
|
||||||
|
|
|
@ -236,6 +236,8 @@ module ActionController #:nodoc:
|
||||||
template_with_options = options.is_a?(Hash)
|
template_with_options = options.is_a?(Hash)
|
||||||
|
|
||||||
if apply_layout?(template_with_options, options) && (layout = pick_layout(template_with_options, options, deprecated_layout))
|
if apply_layout?(template_with_options, options) && (layout = pick_layout(template_with_options, options, deprecated_layout))
|
||||||
|
assert_existence_of_template_file(layout)
|
||||||
|
|
||||||
options = options.merge :layout => false if template_with_options
|
options = options.merge :layout => false if template_with_options
|
||||||
logger.info("Rendering #{options} within #{layout}") if logger
|
logger.info("Rendering #{options} within #{layout}") if logger
|
||||||
|
|
||||||
|
|
|
@ -121,4 +121,23 @@ class LayoutSetInResponseTest < Test::Unit::TestCase
|
||||||
get :hello
|
get :hello
|
||||||
assert_nil @response.layout
|
assert_nil @response.layout
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
class SetsNonExistentLayoutFile < LayoutTest
|
||||||
|
layout "nofile.rhtml"
|
||||||
|
end
|
||||||
|
|
||||||
|
class LayoutExceptionRaised < Test::Unit::TestCase
|
||||||
|
def setup
|
||||||
|
@request = ActionController::TestRequest.new
|
||||||
|
@response = ActionController::TestResponse.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_exception_raised_when_layout_file_not_found
|
||||||
|
@controller = SetsNonExistentLayoutFile.new
|
||||||
|
get :hello
|
||||||
|
@response.template.class.module_eval { attr_accessor :exception }
|
||||||
|
assert_equal ActionController::MissingTemplate, @response.template.exception.class
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in a new issue