<commit_before>require 'cases/helper'
require 'models/company'
require 'models/developer'
require 'models/car'
require 'models/bulb'

class IntegrationTest < ActiveRecord::TestCase
  fixtures :companies, :developers

  def test_to_param_should_return_string
    assert_kind_of String, Client.first.to_param
  end

  def test_to_param_returns_id_even_if_not_persisted
    client = Client.new
    client.id = 1
    assert_equal '1', client.to_param
  end

  def test_cache_key_for_existing_record_is_not_timezone_dependent
    ActiveRecord::Base.time_zone_aware_attributes = true

    Time.zone = 'UTC'
    utc_key = Developer.first.cache_key

    Time.zone = 'EST'
    est_key = Developer.first.cache_key

    assert_equal utc_key, est_key<commit_msg>Add test for `AR::Base#to_param`<commit_after>require 'cases/helper'
require 'models/company'
require 'models/developer'
require 'models/car'
require 'models/bulb'

class IntegrationTest < ActiveRecord::TestCase
  fixtures :companies, :developers

  def test_to_param_should_return_string
    assert_kind_of String, Client.first.to_param
  end

  def test_to_param_returns_nil_if_not_persisted
    client = Client.new
    assert_equal nil, client.to_param
  end

  def test_to_param_returns_id_if_not_persisted_but_id_is_set
    client = Client.new
    client.id = 1
    assert_equal '1', client.to_param
  end

  def test_cache_key_for_existing_record_is_not_timezone_dependent
    ActiveRecord::Base.time_zone_aware_attributes = true

    Time.zone = 'UTC'
    utc_key = Developer.first.cache_key

    Time.zone = 'EST'
    est_key = Developer.first.cache_key

    assert_equal utc_key, est_key
{'fraction_non_alphanumeric': 0.07108140947752126, 'fraction_numerical': 0.002430133657351154, 'mean_word_length': 4.71875, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1549986', 'n_tokens_mistral': 574, 'n_tokens_neox': 548, 'n_words': 104}