1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

The magic medicine worked.

This commit is contained in:
José Valim 2011-04-16 10:31:55 +02:00
parent e30ca001ef
commit 62668cccb9
2 changed files with 14 additions and 8 deletions

View file

@ -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

View file

@ -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_with_layout
def test_render_template_without_layout
assert_equal "Hello world!", buffered_render(:template => "test/hello_world")
end
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)