diff options
author | José Valim <jose.valim@gmail.com> | 2011-12-20 14:56:18 +0100 |
---|---|---|
committer | Alexey Vakhov <vakhov@gmail.com> | 2012-03-28 23:06:52 +0400 |
commit | dd0275e46314b6c4cddb1ae438ce1390d13aa53c (patch) | |
tree | 8532cceb789428c9caf4f7989a8491a79f027ed8 /actionpack | |
parent | c82fd8fc2ac9f8273825fc272a0bf17e5c583d71 (diff) | |
download | rails-dd0275e46314b6c4cddb1ae438ce1390d13aa53c.tar.gz rails-dd0275e46314b6c4cddb1ae438ce1390d13aa53c.tar.bz2 rails-dd0275e46314b6c4cddb1ae438ce1390d13aa53c.zip |
Add a test case for layout nil.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/abstract_controller/layouts.rb | 1 | ||||
-rw-r--r-- | actionpack/test/abstract/layouts_test.rb | 16 |
2 files changed, 16 insertions, 1 deletions
diff --git a/actionpack/lib/abstract_controller/layouts.rb b/actionpack/lib/abstract_controller/layouts.rb index 6f13ebe0d0..bc9f6fc3e8 100644 --- a/actionpack/lib/abstract_controller/layouts.rb +++ b/actionpack/lib/abstract_controller/layouts.rb @@ -249,6 +249,7 @@ module AbstractController # Symbol:: call the method specified by the symbol, which will return the template name # false:: There is no layout # true:: raise an ArgumentError + # nil:: Force default layout behavior with inheritance # # ==== Parameters # * <tt>layout</tt> - The layout to use. diff --git a/actionpack/test/abstract/layouts_test.rb b/actionpack/test/abstract/layouts_test.rb index 58795aa327..558a45b87f 100644 --- a/actionpack/test/abstract/layouts_test.rb +++ b/actionpack/test/abstract/layouts_test.rb @@ -14,7 +14,10 @@ module AbstractControllerTests "layouts/overwrite.erb" => "Overwrite <%= yield %>", "layouts/with_false_layout.erb" => "False Layout <%= yield %>", "abstract_controller_tests/layouts/with_string_implied_child.erb" => - "With Implied <%= yield %>" + "With Implied <%= yield %>", + "abstract_controller_tests/layouts/with_grand_child_of_implied.erb" => + "With Grand Child <%= yield %>" + )] end @@ -64,6 +67,10 @@ module AbstractControllerTests class WithChildOfImplied < WithStringImpliedChild end + class WithGrandChildOfImplied < WithStringImpliedChild + layout nil + end + class WithProc < Base layout proc { |c| "overwrite" } @@ -299,6 +306,13 @@ module AbstractControllerTests assert_equal "With Implied Hello string!", controller.response_body end + test "when a grandchild has nil layout specified, the child has an implied layout, and the " \ + "parent has specified a layout, use the child controller layout" do + controller = WithGrandChildOfImplied.new + controller.process(:index) + assert_equal "With Grand Child Hello string!", controller.response_body + end + test "raises an exception when specifying layout true" do assert_raises ArgumentError do Object.class_eval do |