提交 4c44f046 编写于 作者: N Nick Sutterer 提交者: Piotr Sarnacki

added tests for the MissingTemplate exception message.

上级 65d38995
......@@ -251,3 +251,24 @@ def setup
assert_equal "Foo", template.source
end
end
class TestMissingTemplate < ActiveSupport::TestCase
def setup
@lookup_context = ActionView::LookupContext.new("/Path/to/views", {})
@details = "{:handlers=>[:erb, :rjs, :builder], :formats=>[:html, :text, :js, :css, :ics, :csv, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json], :locale=>[:en, :en]}"
end
test "if no template was found we get a helpful error message including the inheritance chain" do
e = assert_raise ActionView::MissingTemplate do
@lookup_context.find("foo", %w(parent child))
end
assert_equal "Missing template parent/foo, child/foo with #{@details}. Searched in:\n * \"/Path/to/views\"\n", e.message
end
test "if no partial was found we get a helpful error message including the inheritance chain" do
e = assert_raise ActionView::MissingTemplate do
@lookup_context.find("foo", %w(parent child), true)
end
assert_equal "Missing partial parent/foo, child/foo with #{@details}. Searched in:\n * \"/Path/to/views\"\n", e.message
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册