aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/new_base/render_partial_test.rb
diff options
context:
space:
mode:
authorartemave <artemave@gmail.com>2010-09-17 20:39:14 +0000
committerwycats <wycats@gmail.com>2010-12-26 22:32:15 -0800
commitddd85ef9c6a6297a8ff28816d907bbbf2eae5856 (patch)
treeb2ff8ede17f042e8e007c6103b4063ce7ac75383 /actionpack/test/controller/new_base/render_partial_test.rb
parent9bac649fa4ca6f05795e7cab8d30049aa2410cb8 (diff)
downloadrails-ddd85ef9c6a6297a8ff28816d907bbbf2eae5856.tar.gz
rails-ddd85ef9c6a6297a8ff28816d907bbbf2eae5856.tar.bz2
rails-ddd85ef9c6a6297a8ff28816d907bbbf2eae5856.zip
#948 template_inheritance
Diffstat (limited to 'actionpack/test/controller/new_base/render_partial_test.rb')
-rw-r--r--actionpack/test/controller/new_base/render_partial_test.rb25
1 files changed, 24 insertions, 1 deletions
diff --git a/actionpack/test/controller/new_base/render_partial_test.rb b/actionpack/test/controller/new_base/render_partial_test.rb
index d800ea264d..83b0d039ad 100644
--- a/actionpack/test/controller/new_base/render_partial_test.rb
+++ b/actionpack/test/controller/new_base/render_partial_test.rb
@@ -9,7 +9,10 @@ module RenderPartial
"render_partial/basic/basic.html.erb" => "<%= @test_unchanged = 'goodbye' %><%= render :partial => 'basic' %><%= @test_unchanged %>",
"render_partial/basic/with_json.html.erb" => "<%= render 'with_json.json' %>",
"render_partial/basic/_with_json.json.erb" => "<%= render 'final' %>",
- "render_partial/basic/_final.json.erb" => "{ final: json }"
+ "render_partial/basic/_final.json.erb" => "{ final: json }",
+ "render_partial/basic/overriden.html.erb" => "<%= @test_unchanged = 'goodbye' %><%= render :partial => 'overriden' %><%= @test_unchanged %>",
+ "render_partial/basic/_overriden.html.erb" => "ParentPartial!",
+ "render_partial/child/_overriden.html.erb" => "OverridenPartial!"
)]
def html_with_json_inside_json
@@ -20,7 +23,13 @@ module RenderPartial
@test_unchanged = 'hello'
render :action => "basic"
end
+
+ def overriden
+ @test_unchanged = 'hello'
+ end
end
+
+ class ChildController < BasicController; end
class TestPartial < Rack::TestCase
testing BasicController
@@ -37,4 +46,18 @@ module RenderPartial
end
end
+ class TestInheritedPartial < Rack::TestCase
+ testing ChildController
+
+ test "partial from parent controller gets picked if missing in child one" do
+ get :changing
+ assert_response("goodbyeBasicPartial!goodbye")
+ end
+
+ test "partial from child controller gets picked" do
+ get :overriden
+ assert_response("goodbyeOverridenPartial!goodbye")
+ end
+ end
+
end