I'm writing a Rails plugin that includes some partials. I'd like to test the partials, but I'm having a hard time setting up a test that will render them. There's no associated controller, so I'm just faking one:
require 'action_controller'
require 'active_support'
require 'action_pack'
require 'action_view'
class MyTest < Test::Unit::TestCase
def setup
@renderer = ActionController::Base.new
@renderer.append_view_path File.expand_path(File.join(File.dirname(__FILE__), '..', 'views'))
end
def test_renders_link
result = @renderer.render(:partial => '/something')
assert ...
end
end
But that :render
call always blows up. I've tried using an ActionView::Base
instead of an ActionController::Base
, but that gets even less far.
Has anyone had any success?