<commit_before># frozen_string_literal: true

require 'test_helper'
require 'simple_drilldown/helper'

module SimpleDrilldown
  class HelperTest < ActiveSupport::TestCase
    include Helper

    test 'subcaption blank' do
      @search = Search.new({})
      assert_equal 'Simple Drilldown/Application Record Count', caption
      assert_equal '', subcaption
    end

    test 'subcaption with filter text' do
      @search = Search.new({})
      @filter_text = 'Subcaption'
      assert_equal 'Simple Drilldown/Application Record Count', caption
      assert_equal 'for Subcaption', subcaption
    end

    test 'subcaption with title and filter text' do
      @search = Search.new({ title: 'My Title' })
      @filter_text = 'Subcaption'
      assert_equal 'My Title', caption
      assert_equal '', subcaption
    end

    private

    def controller
      return @controller if @controller

      Controller.target_class ApplicationRecord
      @controller = Controller.new
    end
  end
end
<commit_msg>Use dummy app ApplicationRecord in test<commit_after># frozen_string_literal: true

require 'test_helper'
require 'simple_drilldown/helper'

module SimpleDrilldown
  class HelperTest < ActiveSupport::TestCase
    include Helper

    test 'subcaption blank' do
      @search = Search.new({})
      assert_equal 'Application Record Count', caption
      assert_equal '', subcaption
    end

    test 'subcaption with filter text' do
      @search = Search.new({})
      @filter_text = 'Subcaption'
      assert_equal 'Application Record Count', caption
      assert_equal 'for Subcaption', subcaption
    end

    test 'subcaption with title and filter text' do
      @search = Search.new({ title: 'My Title' })
      @filter_text = 'Subcaption'
      assert_equal 'My Title', caption
      assert_equal '', subcaption
    end

    private

    def controller
      return @controller if @controller

      Controller.target_class ::ApplicationRecord
      @controller = Controller.new
    end
  end
end

{'fraction_non_alphanumeric': 0.07661691542288557, 'fraction_numerical': 0.0, 'mean_word_length': 3.172199170124481, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5378973', 'n_tokens_mistral': 560, 'n_tokens_neox': 541, 'n_words': 175}