aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/new_render_test.rb27
-rw-r--r--actionpack/test/fixtures/layouts/block_with_layout.erb3
-rw-r--r--actionpack/test/fixtures/layouts/partial_with_layout.erb3
3 files changed, 31 insertions, 2 deletions
diff --git a/actionpack/test/controller/new_render_test.rb b/actionpack/test/controller/new_render_test.rb
index 4c0b9d0c9c..d8364a6a0b 100644
--- a/actionpack/test/controller/new_render_test.rb
+++ b/actionpack/test/controller/new_render_test.rb
@@ -361,10 +361,18 @@ class NewRenderTestController < ActionController::Base
render :action => "calling_partial_with_layout"
end
+ def render_call_to_partial_with_layout_in_main_layout_and_within_content_for_layout
+ render :action => "calling_partial_with_layout"
+ end
+
def render_using_layout_around_block
render :action => "using_layout_around_block"
end
+ def render_using_layout_around_block_in_main_layout_and_within_content_for_layout
+ render :action => "using_layout_around_block"
+ end
+
def rescue_action(e) raise end
private
@@ -387,6 +395,10 @@ class NewRenderTestController < ActionController::Base
"layouts/builder"
when "action_talk_to_layout", "layout_overriding_layout"
"layouts/talk_from_action"
+ when "render_call_to_partial_with_layout_in_main_layout_and_within_content_for_layout"
+ "layouts/partial_with_layout"
+ when "render_using_layout_around_block_in_main_layout_and_within_content_for_layout"
+ "layouts/block_with_layout"
end
end
end
@@ -825,9 +837,20 @@ EOS
get :render_call_to_partial_with_layout
assert_equal "Before (David)\nInside from partial (David)\nAfter", @response.body
end
-
+
+ def test_render_call_to_partial_with_layout_in_main_layout_and_within_content_for_layout
+ get :render_call_to_partial_with_layout_in_main_layout_and_within_content_for_layout
+ assert_equal "Before (Anthony)\nInside from partial (Anthony)\nAfter\nBefore (David)\nInside from partial (David)\nAfter\nBefore (Ramm)\nInside from partial (Ramm)\nAfter", @response.body
+ end
+
def test_using_layout_around_block
- get :using_layout_around_block
+ get :render_using_layout_around_block
assert_equal "Before (David)\nInside from block\nAfter", @response.body
end
+
+ def test_using_layout_around_block_in_main_layout_and_within_content_for_layout
+ get :render_using_layout_around_block_in_main_layout_and_within_content_for_layout
+ assert_equal "Before (Anthony)\nInside from first block in layout\nAfter\nBefore (David)\nInside from block\nAfter\nBefore (Ramm)\nInside from second block in layout\nAfter\n", @response.body
+ end
+
end
diff --git a/actionpack/test/fixtures/layouts/block_with_layout.erb b/actionpack/test/fixtures/layouts/block_with_layout.erb
new file mode 100644
index 0000000000..6a8b41914b
--- /dev/null
+++ b/actionpack/test/fixtures/layouts/block_with_layout.erb
@@ -0,0 +1,3 @@
+<% render(:layout => "layout_for_partial", :locals => { :name => "Anthony" }) do %>Inside from first block in layout<% end %>
+<%= yield %>
+<% render(:layout => "layout_for_partial", :locals => { :name => "Ramm" }) do %>Inside from second block in layout<% end %>
diff --git a/actionpack/test/fixtures/layouts/partial_with_layout.erb b/actionpack/test/fixtures/layouts/partial_with_layout.erb
new file mode 100644
index 0000000000..a0349d731e
--- /dev/null
+++ b/actionpack/test/fixtures/layouts/partial_with_layout.erb
@@ -0,0 +1,3 @@
+<%= render( :layout => "layout_for_partial", :partial => "partial_for_use_in_layout", :locals => {:name => 'Anthony' } ) %>
+<%= yield %>
+<%= render( :layout => "layout_for_partial", :partial => "partial_for_use_in_layout", :locals => {:name => 'Ramm' } ) %> \ No newline at end of file