mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
The magic medicine worked.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user