diff --git a/actionpack/test/controller/layout_test.rb b/actionpack/test/controller/layout_test.rb index 7bed963..e5c1f45 100644 --- a/actionpack/test/controller/layout_test.rb +++ b/actionpack/test/controller/layout_test.rb @@ -92,6 +92,14 @@ class HasOwnLayoutController < LayoutTest layout 'item' end +class HasOwnLayoutWithConditionsController < LayoutTest + layout 'item', :only => 'show' +end + +class HasOwnInheritedLayoutWithConditionsController < HasOwnLayoutController + layout 'inherited', :only => 'show' +end + class PrependsViewPathController < LayoutTest def hello prepend_view_path File.dirname(__FILE__) + '/../fixtures/layout_tests/alt/' @@ -118,6 +126,22 @@ class LayoutSetInResponseTest < ActionController::TestCase assert_equal 'layouts/layout_test', @response.layout end + def test_layout_set_with_conditions_when_set_in_controller + @controller = HasOwnLayoutWithConditionsController.new + get :hello + assert_equal 'layouts/layout_test', @response.layout + get :show + assert_equal 'layouts/item', @response.layout + end + + def test_inherited_layout_set_with_conditions_when_set_in_controller + @controller = HasOwnInheritedLayoutWithConditionsController.new + get :hello + assert_equal 'layouts/item', @response.layout + get :show + assert_equal 'layouts/inherited', @response.layout + end + def test_layout_set_when_set_in_controller @controller = HasOwnLayoutController.new get :hello