<commit_before>require 'test_helper'

class CacheTest < ActiveSupport::TestCase
  test 'Cache' do
    begin
      threashold_was, TurboUrls::Cache::SIMPLE_CACHE_THREASHOLD = TurboUrls::Cache::SIMPLE_CACHE_THREASHOLD, 3

      obj = ActionDispatch::Integration::Session.new(Rails.application)
      obj.extend(Rails.application.routes.url_helpers)
      obj.extend(Rails.application.routes.mounted_helpers)
      obj.conferences_path
      assert_equal '/conferences', TurboUrls.cache[:conferences_path, []]

      obj.conference_path(1)
      obj.conference_path(2)
      obj.conference_path(3)
      assert_nil TurboUrls.cache[:conference_path, ['5']]
      obj.conference_path(4)
      assert_equal '/conferences/5', TurboUrls.cache[:conference_path, ['5']]

    ensure
      TurboUrls::Cache::SIMPLE_CACHE_THREASHOLD = threashold_was
    end
  end
end<commit_msg>I know what I'm doing :no_good: :warning:<commit_after>require 'test_helper'

class CacheTest < ActiveSupport::TestCase
  test 'Cache' do
    begin
      threashold_was = TurboUrls::Cache::SIMPLE_CACHE_THREASHOLD
      suppress_warnings { TurboUrls::Cache::SIMPLE_CACHE_THREASHOLD = 3 }

      obj = ActionDispatch::Integration::Session.new(Rails.application)
      obj.extend(Rails.application.routes.url_helpers)
      obj.extend(Rails.application.routes.mounted_helpers)
      obj.conferences_path
      assert_equal '/conferences', TurboUrls.cache[:conferences_path, []]

      obj.conference_path(1)
      obj.conference_path(2)
      obj.conference_path(3)
      assert_nil TurboUrls.cache[:conference_path, ['5']]
      obj.conference_path(4)
      assert_equal '/conferences/5', TurboUrls.cache[:conference_path, ['5']]

    ensure
      suppress_warnings { TurboUrls::Cache::SIMPLE_CACHE_THREASHOLD = threashold_was }
    end
  end
end
{'fraction_non_alphanumeric': 0.10828729281767956, 'fraction_numerical': 0.008839779005524863, 'mean_word_length': 4.295321637426901, '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': '68146', 'n_tokens_mistral': 624, 'n_tokens_neox': 616, 'n_words': 83}