module ActionText::Rendering

def action_controller_renderer

def action_controller_renderer
  @action_controller_renderer ||= Class.new(ActionController::Base).renderer
end

def render(*args, &block)

def render(*args, &block)
  (renderer || action_controller_renderer).render_to_string(*args, &block)
end

def with_renderer(renderer)

def with_renderer(renderer)
  previous_renderer = self.renderer
  self.renderer = renderer
  yield
ensure
  self.renderer = previous_renderer
end