diff options
author | Nick Sutterer <apotonick@gmail.com> | 2010-12-30 14:11:14 +0100 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-12-31 10:41:19 +0100 |
commit | 4c44f0468a0b6d2dd9b67d801da4336ad9a169a0 (patch) | |
tree | 7c9227a2ffa7df3249e3b5c92ec1d0da23b410a0 /actionpack | |
parent | 65d389955f164714cd6567918c25385e17c5b844 (diff) | |
download | rails-4c44f0468a0b6d2dd9b67d801da4336ad9a169a0.tar.gz rails-4c44f0468a0b6d2dd9b67d801da4336ad9a169a0.tar.bz2 rails-4c44f0468a0b6d2dd9b67d801da4336ad9a169a0.zip |
added tests for the MissingTemplate exception message.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/test/template/lookup_context_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/template/lookup_context_test.rb b/actionpack/test/template/lookup_context_test.rb index a629b3c046..4258f88071 100644 --- a/actionpack/test/template/lookup_context_test.rb +++ b/actionpack/test/template/lookup_context_test.rb @@ -251,3 +251,24 @@ class LookupContextWithFalseCaching < ActiveSupport::TestCase 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 |