diff options
author | José Valim <jose.valim@gmail.com> | 2010-03-19 17:20:15 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-03-19 17:20:20 +0100 |
commit | f28d856cece877d1b2f306f54aeb12cce1db1023 (patch) | |
tree | f2ca547068d20558acc80433ef5f667f61f78737 /actionpack/test/controller/new_base/render_rjs_test.rb | |
parent | fbe35656a95228f760a2cd09676423ba41fe70ab (diff) | |
download | rails-f28d856cece877d1b2f306f54aeb12cce1db1023.tar.gz rails-f28d856cece877d1b2f306f54aeb12cce1db1023.tar.bz2 rails-f28d856cece877d1b2f306f54aeb12cce1db1023.zip |
Improve performance of the rendering stack by freezing formats as a sign that they shouldn't be further modified.
Diffstat (limited to 'actionpack/test/controller/new_base/render_rjs_test.rb')
-rw-r--r-- | actionpack/test/controller/new_base/render_rjs_test.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/actionpack/test/controller/new_base/render_rjs_test.rb b/actionpack/test/controller/new_base/render_rjs_test.rb index 7c8f1cb869..b602b9f8e9 100644 --- a/actionpack/test/controller/new_base/render_rjs_test.rb +++ b/actionpack/test/controller/new_base/render_rjs_test.rb @@ -5,7 +5,7 @@ module RenderRjs self.view_paths = [ActionView::FixtureResolver.new( "render_rjs/basic/index.js.rjs" => "page[:customer].replace_html render(:partial => 'customer')", "render_rjs/basic/index_html.js.rjs" => "page[:customer].replace_html :partial => 'customer'", - "render_rjs/basic/index_no_js.js.rjs" => "page[:developer].replace_html render(:partial => 'developer')", + "render_rjs/basic/index_no_js.js.erb" => "<%= render(:partial => 'developer') %>", "render_rjs/basic/_customer.js.erb" => "JS Partial", "render_rjs/basic/_customer.html.erb" => "HTML Partial", "render_rjs/basic/_developer.html.erb" => "HTML Partial", @@ -18,6 +18,12 @@ module RenderRjs render end + def index_respond_to + respond_to do |format| + format.js { render :action => "index_no_js" } + end + end + def index_locale self.locale = :da end @@ -41,7 +47,12 @@ module RenderRjs test "rendering a partial in an RJS template should pick the HTML one if no JS is available" do get :index_no_js, "format" => "js" - assert_response("$(\"developer\").update(\"HTML Partial\");") + assert_response("HTML Partial") + end + + test "rendering a partial in an RJS template should pick the HTML one if no JS is available on respond_to" do + get :index_respond_to, "format" => "js" + assert_response("HTML Partial") end test "replacing an element with a partial in an RJS template should pick the HTML template over the JS one" do |