aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/abstract/layouts_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/abstract/layouts_test.rb')
-rw-r--r--actionpack/test/abstract/layouts_test.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/actionpack/test/abstract/layouts_test.rb b/actionpack/test/abstract/layouts_test.rb
index 5c96d1cfff..bf02e5a864 100644
--- a/actionpack/test/abstract/layouts_test.rb
+++ b/actionpack/test/abstract/layouts_test.rb
@@ -66,7 +66,15 @@ module AbstractControllerTests
class WithChildOfImplied < WithStringImpliedChild
end
-
+
+ class WithProc < Base
+ layout proc { |c| "omg" }
+
+ def index
+ render :_template => ActionView::Template::Text.new("Hello proc!")
+ end
+ end
+
class WithSymbol < Base
layout :hello
@@ -197,6 +205,12 @@ module AbstractControllerTests
controller.process(:index)
assert_equal "Hello nil!", controller.response_body
end
+
+ test "when layout is specified as a proc, call it and use the layout returned" do
+ controller = WithProc.new
+ controller.process(:index)
+ assert_equal "OMGHI2U Hello proc!", controller.response_body
+ end
test "when layout is specified as a symbol, call the requested method and use the layout returned" do
controller = WithSymbol.new