Skip to content
Browse files

added tests for the MissingTemplate exception message.

  • Loading branch information...
1 parent 65d3899 commit 4c44f0468a0b6d2dd9b67d801da4336ad9a169a0 @apotonick apotonick committed with drogus Dec 30, 2010
Showing with 21 additions and 0 deletions.
  1. +21 −0 actionpack/test/template/lookup_context_test.rb
View
21 actionpack/test/template/lookup_context_test.rb
@@ -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

0 comments on commit 4c44f04

Please sign in to comment.
Something went wrong with that request. Please try again.