Skip to content

Commit

Permalink
Share ActionView::TestCase's output_buffer with view for concat support.
Browse files Browse the repository at this point in the history
[#3467 state:resolved]

Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
  • Loading branch information
cch1 authored and alloy committed Nov 6, 2009
1 parent b43964d commit c2cfb20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions actionpack/lib/action_view/test_case.rb
Expand Up @@ -120,6 +120,7 @@ def make_test_case_available_to_view!
def _view
view = ActionView::Base.new(ActionController::Base.view_paths, _assigns, @controller)
view.class.send :include, _helpers
view.output_buffer = self.output_buffer
view
end

Expand Down
5 changes: 5 additions & 0 deletions actionpack/test/template/test_case_test.rb
Expand Up @@ -38,6 +38,11 @@ class GeneralViewTest < ActionView::TestCase
assert_equal 'Eloy', render('developers/developer', :developer => stub(:name => 'Eloy'))
end

test "can render a layout with block" do
assert_equal "Before (ChrisCruft)\n!\nAfter",
render(:layout => "test/layout_for_partial", :locals => {:name => "ChrisCruft"}) {"!"}
end

helper AnotherTestHelper
test "additional helper classes can be specified as in a controller" do
assert test_case.ancestors.include?(AnotherTestHelper)
Expand Down

0 comments on commit c2cfb20

Please sign in to comment.