2009-09-19 13:10:41 -04:00
|
|
|
require 'abstract_unit'
|
2009-05-14 18:30:35 -04:00
|
|
|
|
|
|
|
module RenderPartial
|
|
|
|
|
|
|
|
class BasicController < ActionController::Base
|
|
|
|
|
2009-06-17 18:32:55 -04:00
|
|
|
self.view_paths = [ActionView::FixtureResolver.new(
|
2010-01-31 00:27:24 -05:00
|
|
|
"render_partial/basic/_basic.html.erb" => "BasicPartial!",
|
2009-05-14 18:30:35 -04:00
|
|
|
"render_partial/basic/basic.html.erb" => "<%= @test_unchanged = 'goodbye' %><%= render :partial => 'basic' %><%= @test_unchanged %>"
|
|
|
|
)]
|
|
|
|
|
|
|
|
def changing
|
|
|
|
@test_unchanged = 'hello'
|
|
|
|
render :action => "basic"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-10-04 00:18:32 -04:00
|
|
|
class TestPartial < Rack::TestCase
|
2009-05-14 18:30:35 -04:00
|
|
|
testing BasicController
|
|
|
|
|
|
|
|
test "rendering a partial in ActionView doesn't pull the ivars again from the controller" do
|
|
|
|
get :changing
|
2010-01-31 00:27:24 -05:00
|
|
|
assert_response("goodbyeBasicPartial!goodbye")
|
2009-05-14 18:30:35 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-09-13 17:30:27 -04:00
|
|
|
end
|