From 5a4814fa93452489c371427e7aee8c646615f444 Mon Sep 17 00:00:00 2001 From: Luke Melia Date: Tue, 18 Nov 2008 01:50:37 -0500 Subject: [PATCH] Failing test for calling controller action with format => 'js' when action performs an inline render which then renders an html-only partial --- actionpack/test/controller/render_test.rb | 24 +++++++++++-------- .../test/_partial_with_only_html_version.html.erb | 1 + 2 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 actionpack/test/fixtures/test/_partial_with_only_html_version.html.erb diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index bcc94bf..bec2683 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -245,6 +245,15 @@ class TestController < ActionController::Base render :inline => "<%= 'Goodbye, ' + local_name %>", :locals => { :local_name => name } end + + def helper_method_to_render_to_string(*args) + render_to_string(*args) + end + helper_method :helper_method_to_render_to_string + + def render_html_only_partial_within_inline + render :inline => "Hello world <%= helper_method_to_render_to_string :partial => 'test/partial_with_only_html_version' %>" + end def formatted_html_erb end @@ -342,11 +351,6 @@ class TestController < ActionController::Base render :template => "test/hello_world" end - def render_to_string_with_inline_and_render - render_to_string :inline => "<%= 'dlrow olleh'.reverse %>" - render :template => "test/hello_world" - end - def rendering_with_conflicting_local_vars @name = "David" def @template.name() nil end @@ -923,11 +927,6 @@ class RenderTest < Test::Unit::TestCase assert_template "test/hello_world" end - def test_render_to_string_inline - get :render_to_string_with_inline_and_render - assert_template "test/hello_world" - end - def test_nested_rendering @controller = Fun::GamesController.new get :hello_world @@ -943,6 +942,11 @@ class RenderTest < Test::Unit::TestCase get :accessing_local_assigns_in_inline_template, :local_name => "Local David" assert_equal "Goodbye, Local David", @response.body end + + def test_rendering_html_only_partial_within_inline_with_js + get :render_html_only_partial_within_inline, :format => 'js' + assert_equal "Goodbye, Local David", @response.body + end def test_should_render_formatted_template get :formatted_html_erb diff --git a/actionpack/test/fixtures/test/_partial_with_only_html_version.html.erb b/actionpack/test/fixtures/test/_partial_with_only_html_version.html.erb new file mode 100644 index 0000000..00e6b6d --- /dev/null +++ b/actionpack/test/fixtures/test/_partial_with_only_html_version.html.erb @@ -0,0 +1 @@ +partial with only html version \ No newline at end of file -- 1.5.4