From e274eb1df1dcf526febb7c3a1a8dc2c02325d68c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 26 Jan 2010 16:34:25 +0100 Subject: Bring layouts with proc back alive. --- actionpack/test/abstract/layouts_test.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'actionpack/test') diff --git a/actionpack/test/abstract/layouts_test.rb b/actionpack/test/abstract/layouts_test.rb index df73d948f0..8cbb72dc83 100644 --- a/actionpack/test/abstract/layouts_test.rb +++ b/actionpack/test/abstract/layouts_test.rb @@ -67,7 +67,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 @@ -198,6 +206,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 -- cgit v1.2.3