提交 d4d4a08f 编写于 作者: M Michael Koziarski

Make sure missing template exceptions actually say which template they were...

Make sure missing template exceptions actually say which template they were looking for.  Closes #8683 [dasil003]



git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7181 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 e80fabbb
*SVN*
* Make sure missing template exceptions actually say which template they were looking for. Closes #8683 [dasil003]
* Fix errors with around_filters which do not yield, restore 1.1 behaviour with after filters. Closes #8891 [skaes]
After filters will *no longer* be run if an around_filter fails to yield, users relying on
......
......@@ -1241,9 +1241,10 @@ def template_exempt_from_layout?(template_name = default_template_name)
def assert_existence_of_template_file(template_name)
unless template_exists?(template_name) || ignore_missing_templates
full_template_path = template_name.include?('.') ? template_name : @template.full_template_path(template_name, "#{@template.template_format}.erb")
full_template_path = template_name.include?('.') ? template_name : "#{template_name}.#{@template.template_format}.erb"
display_paths = view_paths.join(':')
template_type = (template_name =~ /layouts/i) ? 'layout' : 'template'
raise(MissingTemplate, "Missing #{template_type} #{full_template_path}")
raise(MissingTemplate, "Missing #{template_type} #{full_template_path} in view path #{display_paths}")
end
end
......
......@@ -15,6 +15,8 @@ def method_not_allowed
def not_implemented
raise ActionController::NotImplemented.new(:get, :put)
end
def missing_template; end
end
......@@ -116,6 +118,18 @@ def test_rescue_unknown_action_in_public_without_error_file
end
def test_rescue_missing_template_in_public
with_rails_root FIXTURE_PUBLIC do
with_all_requests_local true do
get :missing_template
end
end
assert_response :internal_server_error
assert @response.body.include?('missing_template'), "Response should include the template name."
end
def test_rescue_action_locally
get :raises
assert_response :internal_server_error
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册