From 11c715a53fd6309c37883b7d44462cc0a66f3bba Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 5 Jul 2006 02:38:55 +0000 Subject: 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 --- actionpack/test/controller/layout_test.rb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'actionpack/test/controller') diff --git a/actionpack/test/controller/layout_test.rb b/actionpack/test/controller/layout_test.rb index 9dc0cdcfe9..bbb13d0320 100644 --- a/actionpack/test/controller/layout_test.rb +++ b/actionpack/test/controller/layout_test.rb @@ -121,4 +121,23 @@ class LayoutSetInResponseTest < Test::Unit::TestCase get :hello assert_nil @response.layout end -end \ No newline at end of file +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 -- cgit v1.2.3