Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4550

Show
Ignore:
Timestamp:
07/05/06 02:38:55 (2 years ago)
Author:
david
Message:

Added exception handling of missing layouts (closes #5373) [chris@ozmm.org]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r4546 r4550  
    11*SVN* 
     2 
     3* Added exception handling of missing layouts #5373 [chris@ozmm.org] 
    24 
    35* Fixed that real files and symlinks should be treated the same when compiling templates #5438 [zachary@panandscan.com] 
  • trunk/actionpack/lib/action_controller/layout.rb

    r4346 r4550  
    237237 
    238238      if apply_layout?(template_with_options, options) && (layout = pick_layout(template_with_options, options, deprecated_layout)) 
     239        assert_existence_of_template_file(layout) 
     240 
    239241        options = options.merge :layout => false if template_with_options 
    240242        logger.info("Rendering #{options} within #{layout}") if logger 
  • trunk/actionpack/test/controller/layout_test.rb

    r4346 r4550  
    123123  end 
    124124end 
     125 
     126 
     127class SetsNonExistentLayoutFile < LayoutTest 
     128  layout "nofile.rhtml" 
     129end 
     130 
     131class LayoutExceptionRaised < Test::Unit::TestCase 
     132  def setup 
     133    @request    = ActionController::TestRequest.new 
     134    @response   = ActionController::TestResponse.new 
     135  end 
     136 
     137  def test_exception_raised_when_layout_file_not_found 
     138    @controller = SetsNonExistentLayoutFile.new 
     139    get :hello 
     140    @response.template.class.module_eval { attr_accessor :exception } 
     141    assert_equal ActionController::MissingTemplate, @response.template.exception.class 
     142  end 
     143end