<commit_before>require 'action_controller'
require 'active_support/dependencies'

module RendersTemplates

  class DummyController < AbstractController::Base
    include AbstractController::Rendering
    include AbstractController::Layouts
    include AbstractController::Helpers
    include AbstractController::Translation
    include AbstractController::AssetPaths
    include ActionDispatch::Routing
    include Rails.application.routes.url_helpers

    helper ApplicationHelper

    self.view_paths = ["app/views"].tap do |paths|
      ActiveSupport::Dependencies.plugins_loader.engine_paths.each do |path|
          paths << "#{path}/app/views"
      end
    end
    self.assets_dir = "#{Rails.root}/public"
    self.javascripts_dir = "#{self.assets_dir}/javascripts"
    self.javascripts_dir = "#{self.assets_dir}/stylesheets"

    def _render(args=nil)
      render_to_string args
    end
  end

  def get_renderer
    @@controller ||= DummyController.new
  end

  def render_to_string(args=nil)
    get_renderer._render(args)
  end<commit_msg>use the rails root as the base dummy renderer path so engines can be tested<commit_after>require 'action_controller'
require 'active_support/dependencies'

module RendersTemplates

  class DummyController < AbstractController::Base
    include AbstractController::Rendering
    include AbstractController::Layouts
    include AbstractController::Helpers
    include AbstractController::Translation
    include AbstractController::AssetPaths
    include ActionDispatch::Routing
    include Rails.application.routes.url_helpers

    helper ApplicationHelper

    self.view_paths = ["#{Rails.root}/app/views"].tap do |paths|
      ActiveSupport::Dependencies.plugins_loader.engine_paths.each do |path|
          paths << "#{path}/app/views"
      end
    end
    self.assets_dir = "#{Rails.root}/public"
    self.javascripts_dir = "#{self.assets_dir}/javascripts"
    self.javascripts_dir = "#{self.assets_dir}/stylesheets"

    def _render(args=nil)
      render_to_string args
    end
  end

  def get_renderer
    @@controller ||= DummyController.new
  end

  def render_to_string(args=nil)
    get_renderer._render(args)
  end
{'fraction_non_alphanumeric': 0.08861340679522497, 'fraction_numerical': 0.0, 'mean_word_length': 4.200477326968974, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4789557', 'n_tokens_mistral': 617, 'n_tokens_neox': 606, 'n_words': 127}