<commit_before>require 'active_record_unit'
require 'active_record/railties/controller_runtime'
require 'fixtures/project'
require 'active_support/log_subscriber/test_helper'
require 'action_controller/log_subscriber'

ActionController::Base.send :include, ActiveRecord::Railties::ControllerRuntime

class ControllerRuntimeLogSubscriberTest < ActionController::TestCase
  class LogSubscriberController < ActionController::Base
    respond_to :html

    def show
      render :inline => "<%= Project.all %>"
    end

    def zero
      render :inline => "Zero DB runtime"
    end

    def create
      ActiveRecord::LogSubscriber.runtime += 100
      project = Project.last
      respond_with(project, location: url_for(action: :show))
    end

    def redirect
      Project.all
      redirect_to :action => 'show'
    end

    def db_after_render
      render :inline => "Hello world"
      Project.all
      ActiveRecord::LogSubscriber.runtime += 100
    end
  end

  include ActiveSupport::LogSubscriber::TestHelper<commit_msg>Remove usafe of respond_to in ActionView tests<commit_after>require 'active_record_unit'
require 'active_record/railties/controller_runtime'
require 'fixtures/project'
require 'active_support/log_subscriber/test_helper'
require 'action_controller/log_subscriber'

ActionController::Base.send :include, ActiveRecord::Railties::ControllerRuntime

class ControllerRuntimeLogSubscriberTest < ActionController::TestCase
  class LogSubscriberController < ActionController::Base
    def show
      render :inline => "<%= Project.all %>"
    end

    def zero
      render :inline => "Zero DB runtime"
    end

    def create
      ActiveRecord::LogSubscriber.runtime += 100
      project = Project.last
      redirect_to "/"
    end

    def redirect
      Project.all
      redirect_to :action => 'show'
    end

    def db_after_render
      render :inline => "Hello world"
      Project.all
      ActiveRecord::LogSubscriber.runtime += 100
    end
  end

  include ActiveSupport::LogSubscriber::TestHelper
{'fraction_non_alphanumeric': 0.0827178729689808, 'fraction_numerical': 0.005908419497784343, 'mean_word_length': 3.920096852300242, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '3398006', 'n_tokens_mistral': 576, 'n_tokens_neox': 547, 'n_words': 132}