diff options
author | José Valim <jose.valim@gmail.com> | 2011-04-16 10:31:55 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-04-16 10:31:55 +0200 |
commit | 62668cccb9a288b0cd6f6dd49df71661164be2c4 (patch) | |
tree | f83c3fa871856c5b80749f80da63909d0ab9ea89 | |
parent | e30ca001efa861cc13259ca8287837174b24e679 (diff) | |
download | rails-62668cccb9a288b0cd6f6dd49df71661164be2c4.tar.gz rails-62668cccb9a288b0cd6f6dd49df71661164be2c4.tar.bz2 rails-62668cccb9a288b0cd6f6dd49df71661164be2c4.zip |
The magic medicine worked.
-rw-r--r-- | actionpack/lib/action_view/base.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/streaming_render_test.rb (renamed from actionpack/test/template/fibered_render_test.rb) | 20 |
2 files changed, 14 insertions, 8 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 513080ae54..9e8a3c51a3 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -153,7 +153,7 @@ module ActionView #:nodoc: end end - attr_accessor :_template, :_view_flow, :magic_medicine + attr_accessor :_template, :_view_flow attr_internal :request, :controller, :config, :assigns, :lookup_context delegate :formats, :formats=, :locale, :locale=, :view_paths, :view_paths=, :to => :lookup_context diff --git a/actionpack/test/template/fibered_render_test.rb b/actionpack/test/template/streaming_render_test.rb index f62af10812..d6624149d4 100644 --- a/actionpack/test/template/fibered_render_test.rb +++ b/actionpack/test/template/streaming_render_test.rb @@ -5,23 +5,29 @@ require 'controller/fake_models' class TestController < ActionController::Base end - class FiberedTest < ActiveSupport::TestCase - def setup view_paths = ActionController::Base.view_paths @assigns = { :secret => 'in the sauce' } @view = ActionView::Base.new(view_paths, @assigns) - @view.magic_medicine = true @controller_view = TestController.new.view_context end - def test_render_template - assert_equal "Hello world!", @view.render(:template => "test/hello_world") + def buffered_render(options) + body = @view.render_body(options) + string = "" + body.each do |piece| + string << piece + end + string + end + + def test_render_template_without_layout + assert_equal "Hello world!", buffered_render(:template => "test/hello_world") end - def test_render_with_layout + def test_render_template_with_layout assert_equal %(<title></title>\nHello world!\n), - @view.render(:template => "test/hello_world.erb", :layout => "layouts/yield") + buffered_render(:template => "test/hello_world.erb", :layout => "layouts/yield") end end if defined?(Fiber)
\ No newline at end of file |