Permalink
Browse files

Don't try to strip out the controller name if default_action_name is nil

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3321 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
Marcel Molina
Marcel Molina committed Dec 20, 2005
1 parent 3c01e01 commit 233208b8bb638bab3ee7f8f88e227fa7d8ee9c7e
@@ -937,8 +937,10 @@ def assert_existance_of_template_file(template_name)
end
def default_template_name(default_action_name = action_name)
- default_action_name = default_action_name.dup
- strip_out_controller!(default_action_name) if template_path_includes_controller?(default_action_name)
+ if default_action_name
+ default_action_name = default_action_name.dup
+ strip_out_controller!(default_action_name) if template_path_includes_controller?(default_action_name)
+ end
"#{self.class.controller_path}/#{default_action_name}"
end
@@ -40,6 +40,10 @@ def render_text_hello_world_with_layout
render :text => "hello world", :layout => true
end
+ def hello_world_with_layout_false
+ render :layout => false
+ end
+
def render_custom_code
render :text => "hello world", :status => "404 Moved"
end
@@ -205,6 +209,7 @@ def determine_layout
when "hello_world", "layout_test", "rendering_without_layout",
"rendering_nothing_on_layout", "render_text_hello_world",
"render_text_hello_world_with_layout",
+ "hello_world_with_layout_false",
"partial_only", "partial_only_with_layout",
"accessing_params_in_template",
"accessing_params_in_template_with_layout",
@@ -271,6 +276,11 @@ def test_do_with_render_text_and_layout
assert_equal "<html>hello world, I'm here!</html>", @response.body
end
+ def test_do_with_render_action_and_layout_false
+ get :hello_world_with_layout_false
+ assert_equal 'Hello world!', @response.body
+ end
+
def test_do_with_render_custom_code
get :render_custom_code
assert_response :missing
@@ -0,0 +1 @@
+Hello world!

0 comments on commit 233208b

Please sign in to comment.