diff options
author | Joshua Peek <josh@joshpeek.com> | 2008-07-15 14:41:38 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-07-15 14:43:52 -0500 |
commit | aca246ab25497bb6787d2e18680e9f73ad13d223 (patch) | |
tree | ad107ae39feb55960a4f6faf084b3ad8bc56cbec /actionpack/test | |
parent | 4f72feb84c25b54f66c7192c788b7fd965f2d493 (diff) | |
download | rails-aca246ab25497bb6787d2e18680e9f73ad13d223.tar.gz rails-aca246ab25497bb6787d2e18680e9f73ad13d223.tar.bz2 rails-aca246ab25497bb6787d2e18680e9f73ad13d223.zip |
Get buffer for fragment cache from template's @output_buffer
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/caching_test.rb | 43 | ||||
-rw-r--r-- | actionpack/test/template/javascript_helper_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/prototype_helper_test.rb | 2 |
3 files changed, 5 insertions, 42 deletions
diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index c30f7be700..8f53ecd178 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -555,7 +555,7 @@ class FragmentCachingTest < Test::Unit::TestCase fragment_computed = false buffer = 'generated till now -> ' - @controller.fragment_for(Proc.new { fragment_computed = true }, 'expensive') { buffer } + @controller.fragment_for(buffer, 'expensive') { fragment_computed = true } assert fragment_computed assert_equal 'generated till now -> ', buffer @@ -566,50 +566,11 @@ class FragmentCachingTest < Test::Unit::TestCase fragment_computed = false buffer = 'generated till now -> ' - @controller.fragment_for(Proc.new { fragment_computed = true }, 'expensive') { buffer} + @controller.fragment_for(buffer, 'expensive') { fragment_computed = true } assert !fragment_computed assert_equal 'generated till now -> fragment content', buffer end - - def test_cache_erb_fragment - @store.write('views/expensive', 'fragment content') - @controller.response.template.output_buffer = 'generated till now -> ' - - assert_equal( 'generated till now -> fragment content', - ActionView::TemplateHandlers::ERB.new(@controller).cache_fragment(Proc.new{ }, 'expensive')) - end - - def test_cache_rxml_fragment - @store.write('views/expensive', 'fragment content') - xml = 'generated till now -> ' - class << xml; def target!; to_s; end; end - - assert_equal( 'generated till now -> fragment content', - ActionView::TemplateHandlers::Builder.new(@controller).cache_fragment(Proc.new{ }, 'expensive')) - end - - def test_cache_rjs_fragment - @store.write('views/expensive', 'fragment content') - page = 'generated till now -> ' - - assert_equal( 'generated till now -> fragment content', - ActionView::TemplateHandlers::RJS.new(@controller).cache_fragment(Proc.new{ }, 'expensive')) - end - - def test_cache_rjs_fragment_debug_mode_does_not_interfere - @store.write('views/expensive', 'fragment content') - page = 'generated till now -> ' - - begin - debug_mode, ActionView::Base.debug_rjs = ActionView::Base.debug_rjs, true - assert_equal( 'generated till now -> fragment content', - ActionView::TemplateHandlers::RJS.new(@controller).cache_fragment(Proc.new{ }, 'expensive')) - assert ActionView::Base.debug_rjs - ensure - ActionView::Base.debug_rjs = debug_mode - end - end end diff --git a/actionpack/test/template/javascript_helper_test.rb b/actionpack/test/template/javascript_helper_test.rb index b2c4a130c8..36dfeba5ed 100644 --- a/actionpack/test/template/javascript_helper_test.rb +++ b/actionpack/test/template/javascript_helper_test.rb @@ -3,6 +3,8 @@ require 'abstract_unit' class JavaScriptHelperTest < ActionView::TestCase tests ActionView::Helpers::JavaScriptHelper + attr_accessor :output_buffer + def test_escape_javascript assert_equal '', escape_javascript(nil) assert_equal %(This \\"thing\\" is really\\n netos\\'), escape_javascript(%(This "thing" is really\n netos')) diff --git a/actionpack/test/template/prototype_helper_test.rb b/actionpack/test/template/prototype_helper_test.rb index 1d9bc5eb9b..5528430d80 100644 --- a/actionpack/test/template/prototype_helper_test.rb +++ b/actionpack/test/template/prototype_helper_test.rb @@ -25,7 +25,7 @@ class Author::Nested < Author; end class PrototypeHelperBaseTest < ActionView::TestCase - attr_accessor :template_format + attr_accessor :template_format, :output_buffer def setup @template = nil |