aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-06-10 23:53:30 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-06-10 23:55:04 +0100
commit0ad0bdc01c4fe2d66dd2b405433186824e7ce136 (patch)
tree841fe23e7a1a0d2dbda2fa8da2d092d32693d8b3 /actionpack/test
parentb440aeb54a969ec25228881dd02eb019bbfd7c1e (diff)
downloadrails-0ad0bdc01c4fe2d66dd2b405433186824e7ce136.tar.gz
rails-0ad0bdc01c4fe2d66dd2b405433186824e7ce136.tar.bz2
rails-0ad0bdc01c4fe2d66dd2b405433186824e7ce136.zip
Delegate ActionView::Base#controller_name to controller
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/new_render_test.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/actionpack/test/controller/new_render_test.rb b/actionpack/test/controller/new_render_test.rb
index 6b83b8337e..b77b3ceffa 100644
--- a/actionpack/test/controller/new_render_test.rb
+++ b/actionpack/test/controller/new_render_test.rb
@@ -220,7 +220,7 @@ class NewRenderTestController < ActionController::Base
render :action => "test/hello_world"
end
- def render_to_string_with_partial
+ def render_to_string_with_partial
@partial_only = render_to_string :partial => "partial_only"
@partial_with_locals = render_to_string :partial => "customer", :locals => { :customer => Customer.new("david") }
render :action => "test/hello_world"
@@ -251,11 +251,15 @@ class NewRenderTestController < ActionController::Base
def accessing_logger_in_template
render :inline => "<%= logger.class %>"
end
-
+
def accessing_action_name_in_template
render :inline => "<%= action_name %>"
end
+ def accessing_controller_name_in_template
+ render :inline => "<%= controller_name %>"
+ end
+
def accessing_params_in_template_with_layout
render :layout => nil, :inline => "Hello: <%= params[:name] %>"
end
@@ -559,12 +563,17 @@ class NewRenderTest < Test::Unit::TestCase
get :accessing_logger_in_template
assert_equal "Logger", @response.body
end
-
+
def test_access_to_action_name_in_view
get :accessing_action_name_in_template
assert_equal "accessing_action_name_in_template", @response.body
end
+ def test_access_to_controller_name_in_view
+ get :accessing_controller_name_in_template
+ assert_equal "test", @response.body # name is explicitly set to 'test' inside the controller.
+ end
+
def test_render_xml
get :render_xml_hello
assert_equal "<html>\n <p>Hello David</p>\n<p>This is grand!</p>\n</html>\n", @response.body