repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/message_encryptor_test.rb | activesupport/test/message_encryptor_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "openssl"
require "active_support/time"
require "active_support/json"
require_relative "messages/message_codec_tests"
class MessageEncryptorTest < ActiveSupport::TestCase
include MessageCodecTests
class JSONSerializer
def dump(value)
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/configuration_file_test.rb | activesupport/test/configuration_file_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
class ConfigurationFileTest < ActiveSupport::TestCase
test "backtrace contains YAML path" do
Tempfile.create do |file|
file.write("wrong: <%= foo %>")
file.flush
error = assert_raises do
ActiveSupport::ConfigurationFile.pa... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/message_verifiers_test.rb | activesupport/test/message_verifiers_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require_relative "rotation_coordinator_tests"
class MessageVerifiersTest < ActiveSupport::TestCase
include RotationCoordinatorTests
test "can override secret generator" do
secret_generator = ->(salt) { salt + "!" }
coordinator = make_coordina... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/secure_compare_rotator_test.rb | activesupport/test/secure_compare_rotator_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/secure_compare_rotator"
class SecureCompareRotatorTest < ActiveSupport::TestCase
test "#secure_compare! works correctly after rotation" do
wrapper = ActiveSupport::SecureCompareRotator.new("old_secret")
wrapper.rotate("ne... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/xml_mini_test.rb | activesupport/test/xml_mini_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/xml_mini"
require "active_support/builder"
require "active_support/core_ext/hash"
require "active_support/core_ext/big_decimal"
require "active_support/core_ext/date/conversions"
require "active_support/core_ext/integer/time"
requir... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/benchmark_test.rb | activesupport/test/benchmark_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
class BenchmarkTest < ActiveSupport::TestCase
def test_realtime
time = ActiveSupport::Benchmark.realtime { sleep 0.01 }
assert_includes (0.01..0.02), time
end
def test_realtime_millisecond
ms = ActiveSupport::Benchmark.realtime(:float_m... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/constantize_test_cases.rb | activesupport/test/constantize_test_cases.rb | # frozen_string_literal: true
require_relative "constantize_test_helpers"
module Ace
module Base
class Case
class Dice
end
end
class Fase < Case
end
end
class Gas
include Base
end
end
class Object
module AddtlGlobalConstants
class Case
class Dice
end
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/event_reporter_test.rb | activesupport/test/event_reporter_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/event_reporter/test_helper"
require "json"
module ActiveSupport
class EventReporterTest < ActiveSupport::TestCase
include EventReporter::TestHelper
setup do
@subscriber = EventReporter::TestHelper::EventSubscriber.... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/environment_inquirer_test.rb | activesupport/test/environment_inquirer_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
class EnvironmentInquirerTest < ActiveSupport::TestCase
test "local predicate" do
assert_predicate ActiveSupport::EnvironmentInquirer.new("development"), :local?
assert_predicate ActiveSupport::EnvironmentInquirer.new("test"), :local?
assert... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/safe_buffer_test.rb | activesupport/test/safe_buffer_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/core_ext/string/inflections"
require "yaml"
class SafeBufferTest < ActiveSupport::TestCase
def setup
@buffer = ActiveSupport::SafeBuffer.new
end
def test_titleize
assert_equal "Foo", "foo".html_safe.titleize
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/isolated_execution_state_test.rb | activesupport/test/isolated_execution_state_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
class IsolatedExecutionStateTest < ActiveSupport::TestCase
setup do
ActiveSupport::IsolatedExecutionState.clear
@original_isolation_level = ActiveSupport::IsolatedExecutionState.isolation_level
end
teardown do
ActiveSupport::IsolatedExe... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/broadcast_logger_test.rb | activesupport/test/broadcast_logger_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
module ActiveSupport
class BroadcastLoggerTest < TestCase
attr_reader :logger, :log1, :log2
setup do
@log1 = FakeLogger.new
@log2 = FakeLogger.new
@logger = BroadcastLogger.new(@log1, @log2)
end
Logger::Severity.const... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/callback_inheritance_test.rb | activesupport/test/callback_inheritance_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
module CallbackInheritanceTestFixtures
class GrandParent
include ActiveSupport::Callbacks
attr_reader :log, :action_name
def initialize(action_name)
@action_name, @log = action_name, []
end
define_callbacks :dispatch
set_... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/encrypted_file_test.rb | activesupport/test/encrypted_file_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/core_ext/object/with"
require "active_support/encrypted_file"
class EncryptedFileTest < ActiveSupport::TestCase
setup do
@original_env_content_key = ENV["CONTENT_KEY"]
ENV["CONTENT_KEY"] = nil
@content = "One little ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/array_inquirer_test.rb | activesupport/test/array_inquirer_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/core_ext/array"
class ArrayInquirerTest < ActiveSupport::TestCase
def setup
@array_inquirer = ActiveSupport::ArrayInquirer.new([:mobile, :tablet, "api"])
end
def test_individual
assert_predicate @array_inquirer, :mob... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/parallelization_test.rb | activesupport/test/parallelization_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
class ParallelizationTest < ActiveSupport::TestCase
def setup
@original_worker_id = ActiveSupport::TestCase.parallel_worker_id
end
def teardown
ActiveSupport::TestCase.parallel_worker_id = @original_worker_id
end
test "parallel_worker_... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/time_zone_test.rb | activesupport/test/time_zone_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/time"
require_relative "time_zone_test_helpers"
require "yaml"
class TimeZoneTest < ActiveSupport::TestCase
include TimeZoneTestHelpers
def test_utc_to_local
zone = ActiveSupport::TimeZone["Eastern Time (US & Canada)"]
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/fork_tracker_test.rb | activesupport/test/fork_tracker_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
class ForkTrackerTest < ActiveSupport::TestCase
def test_object_fork
read, write = IO.pipe
called = false
handler = ActiveSupport::ForkTracker.after_fork do
called = true
write.write "forked"
end
assert_not respond_to?(... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/deprecation_test.rb | activesupport/test/deprecation_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "logger"
require "stringio"
require "active_support/core_ext/enumerable"
require "active_support/testing/stream"
class Deprecatee
attr_accessor :fubar, :foo_bar
def zero() 0 end
def one(a) a end
def multi(a, b, c) [a, b, c] end
end
modul... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/file_update_checker_shared_tests.rb | activesupport/test/file_update_checker_shared_tests.rb | # frozen_string_literal: true
require "fileutils"
module FileUpdateCheckerSharedTests
extend ActiveSupport::Testing::Declarative
def tmpdir
@tmpdir
end
def tmpfile(name)
File.join(tmpdir, name)
end
def tmpfiles
@tmpfiles ||= %w(foo.rb bar.rb baz.rb).map { |f| tmpfile(f) }
end
def run(*... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/subscriber_test.rb | activesupport/test/subscriber_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/subscriber"
class TestSubscriber < ActiveSupport::Subscriber
cattr_reader :events
def self.clear
@@events = []
end
def open_party(event)
events << event
end
def another_open_party(event)
events << event
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/inflector_test.rb | activesupport/test/inflector_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/inflector"
require_relative "inflector_test_cases"
require_relative "constantize_test_cases"
class InflectorTest < ActiveSupport::TestCase
include InflectorTestCases
include ConstantizeTestCases
def setup
# Dups the sin... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/test_case_test.rb | activesupport/test/test_case_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
class AssertionsTest < ActiveSupport::TestCase
def setup
@object = Class.new do
attr_accessor :num
def increment
self.num += 1
end
def decrement
self.num -= 1
end
end.new
@object.num = 0
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/share_lock_test.rb | activesupport/test/share_lock_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "concurrent/atomic/count_down_latch"
require "active_support/concurrency/share_lock"
class ShareLockTest < ActiveSupport::TestCase
def setup
@lock = ActiveSupport::Concurrency::ShareLock.new
end
def test_reentrancy
thread = Thread.n... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/dot_env_configuration_test.rb | activesupport/test/dot_env_configuration_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/dot_env_configuration"
class DotEnvConfigurationTest < ActiveSupport::TestCase
setup do
@tmpdir = Dir.mktmpdir("dotenv-")
@env_file_path = File.join(@tmpdir, ".env")
end
teardown do
FileUtils.rm_rf @tmpdir
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/env_configuration_test.rb | activesupport/test/env_configuration_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/env_configuration"
class EnvConfigurationTest < ActiveSupport::TestCase
setup do
@config = ActiveSupport::EnvConfiguration.new
end
test "require key" do
set_env("ONE" => "1") do
assert_equal "1", @config.requir... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/inflector_test_cases.rb | activesupport/test/inflector_test_cases.rb | # frozen_string_literal: true
module InflectorTestCases
SingularToPlural = {
"search" => "searches",
"switch" => "switches",
"fix" => "fixes",
"box" => "boxes",
"process" => "processes",
"address" => "addresses",
"case" => "cases",
"stack" ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/autoload_test.rb | activesupport/test/autoload_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
class TestAutoloadModule < ActiveSupport::TestCase
include ActiveSupport::Testing::Isolation
module ::Fixtures
extend ActiveSupport::Autoload
module Autoload
extend ActiveSupport::Autoload
end
end
def setup
@some_class_pat... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/rotation_coordinator_tests.rb | activesupport/test/rotation_coordinator_tests.rb | # frozen_string_literal: true
module RotationCoordinatorTests
extend ActiveSupport::Concern
included do
setup do
@coordinator = make_coordinator.rotate_defaults
end
test "builds working codecs" do
codec = @coordinator["salt"]
other_codec = @coordinator["other salt"]
assert_eq... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/lazy_load_hooks_test.rb | activesupport/test/lazy_load_hooks_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/core_ext/module/remove_method"
class LazyLoadHooksTest < ActiveSupport::TestCase
def test_basic_hook
i = 0
ActiveSupport.on_load(:basic_hook) { i += 1 }
ActiveSupport.run_load_hooks(:basic_hook)
assert_equal 1, i
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/encrypted_configuration_test.rb | activesupport/test/encrypted_configuration_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/encrypted_configuration"
class EncryptedConfigurationTest < ActiveSupport::TestCase
setup do
@tmpdir = Dir.mktmpdir("config-")
@credentials_config_path = File.join(@tmpdir, "credentials.yml.enc")
@credentials_key_pat... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/tagged_logging_test.rb | activesupport/test/tagged_logging_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/logger"
require "active_support/tagged_logging"
class TaggedLoggingTest < ActiveSupport::TestCase
class MyLogger < ::ActiveSupport::Logger
def flush(*)
info "[FLUSHED]"
end
end
setup do
@output = StringIO.n... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/security_utils_test.rb | activesupport/test/security_utils_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/security_utils"
class SecurityUtilsTest < ActiveSupport::TestCase
def test_secure_compare_should_perform_string_comparison
assert ActiveSupport::SecurityUtils.secure_compare("a", "a")
assert_not ActiveSupport::SecurityUti... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/multibyte_proxy_test.rb | activesupport/test/multibyte_proxy_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
class MultibyteProxyText < ActiveSupport::TestCase
class AsciiOnlyEncoder
attr_reader :wrapped_string
alias to_s wrapped_string
def initialize(string)
@wrapped_string = string.gsub(/[^\u0000-\u007F]/, "?")
end
end
def with_cu... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/benchmarkable_test.rb | activesupport/test/benchmarkable_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
class BenchmarkableTest < ActiveSupport::TestCase
include ActiveSupport::Benchmarkable
attr_reader :buffer, :logger
class Buffer
include Enumerable
def initialize; @lines = []; end
def each(&block); @lines.each(&block); end
def wr... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/string_inquirer_test.rb | activesupport/test/string_inquirer_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
class StringInquirerTest < ActiveSupport::TestCase
def setup
@string_inquirer = ActiveSupport::StringInquirer.new("production")
end
def test_match
assert_predicate @string_inquirer, :production?
end
def test_miss
assert_not_predica... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/reloader_test.rb | activesupport/test/reloader_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
class ReloaderTest < ActiveSupport::TestCase
def test_prepare_callback
prepared = completed = false
reloader.to_prepare { prepared = true }
reloader.to_complete { completed = true }
assert_not prepared
assert_not completed
reloa... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/backtrace_cleaner_test.rb | activesupport/test/backtrace_cleaner_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "rails/test_unit/line_filtering"
class BacktraceCleanerFilterTest < ActiveSupport::TestCase
def setup
@bc = ActiveSupport::BacktraceCleaner.new
@bc.add_filter { |line| line.gsub("/my/prefix", "") }
end
test "backtrace should filter ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/configurable_test.rb | activesupport/test/configurable_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
ActiveSupport.deprecator.silence do
require "active_support/configurable"
end
class ConfigurableActiveSupport < ActiveSupport::TestCase
class Parent
include ActiveSupport::Configurable
config_accessor :foo
config_accessor :bar, instance_r... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/i18n_test.rb | activesupport/test/i18n_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/time"
require "active_support/core_ext/array/conversions"
class I18nTest < ActiveSupport::TestCase
def setup
@date = Date.parse("2008-7-2")
@time = Time.utc(2008, 7, 2, 16, 47, 1)
end
def test_time_zone_localization_... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/notifications_test.rb | activesupport/test/notifications_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/core_ext/module/delegation"
module Notifications
class TestCase < ActiveSupport::TestCase
def setup
@old_notifier = ActiveSupport::Notifications.notifier
@notifier = ActiveSupport::Notifications::Fanout.new
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/actionable_error_test.rb | activesupport/test/actionable_error_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/actionable_error"
class ActionableErrorTest < ActiveSupport::TestCase
NonActionableError = Class.new(StandardError)
class DispatchableError < StandardError
include ActiveSupport::ActionableError
class_attribute :flip1... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/executor_test.rb | activesupport/test/executor_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
class ExecutorTest < ActiveSupport::TestCase
class DummyError < Exception
end
class ErrorSubscriber
attr_reader :events
def initialize
@events = []
end
def report(error, handled:, severity:, source:, context:)
@events ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/concern_test.rb | activesupport/test/concern_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/concern"
class ConcernTest < ActiveSupport::TestCase
module Baz
extend ActiveSupport::Concern
class_methods do
attr_accessor :included_ran, :prepended_ran
def baz
"baz"
end
end
include... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/abstract_unit.rb | activesupport/test/abstract_unit.rb | # frozen_string_literal: true
require_relative "../../tools/strict_warnings"
ORIG_ARGV = ARGV.dup
require "bundler/setup"
require "active_support/core_ext/kernel/reporting"
silence_warnings do
Encoding.default_internal = Encoding::UTF_8
Encoding.default_external = Encoding::UTF_8
end
require "active_support/te... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/multibyte_chars_test.rb | activesupport/test/multibyte_chars_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require_relative "multibyte_test_helpers"
require "active_support/core_ext/string/multibyte"
class MultibyteCharsTest < ActiveSupport::TestCase
include MultibyteTestHelpers
def run(...)
result = nil
assert_deprecated ActiveSupport.deprecator ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/number_helper_i18n_test.rb | activesupport/test/number_helper_i18n_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/number_helper"
require "active_support/core_ext/hash/keys"
module ActiveSupport
class NumberHelperI18nTest < ActiveSupport::TestCase
include ActiveSupport::NumberHelper
def setup
I18n.backend.store_translations "ts... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/deep_mergeable_test.rb | activesupport/test/deep_mergeable_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
class DeepMergeableTest < ActiveSupport::TestCase
Wrapper = Struct.new(:underlying) do
include ActiveSupport::DeepMergeable
class << self
remove_method :[]
def [](value)
if value.is_a?(Hash)
self.new(value.transfo... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/multibyte_test_helpers.rb | activesupport/test/multibyte_test_helpers.rb | # frozen_string_literal: true
module MultibyteTestHelpers
# We use Symbol#to_s to create these strings so warnings are emitted if they are mutated
UNICODE_STRING = :"こにちわ".to_s
ASCII_STRING = :"ohayo".to_s
BYTE_STRING = "\270\236\010\210\245".b.freeze
def chars(str)
assert_deprecated ActiveSupport.depre... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/message_encryptors_test.rb | activesupport/test/message_encryptors_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require_relative "rotation_coordinator_tests"
class MessageEncryptorsTest < ActiveSupport::TestCase
include RotationCoordinatorTests
test "can override secret generator" do
secret_generator = ->(salt, secret_length:) { salt[0] * secret_length }
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/execution_context_test.rb | activesupport/test/execution_context_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/execution_context/test_helper"
class ExecutionContextTest < ActiveSupport::TestCase
# ExecutionContext is automatically reset in Rails app via executor hooks set in railtie
# But not in Active Support's own test suite.
includ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/combined_configuration_test.rb | activesupport/test/combined_configuration_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/combined_configuration"
require "active_support/encrypted_configuration"
require "active_support/env_configuration"
require "active_support/dot_env_configuration"
class CombinedConfigurationTest < ActiveSupport::TestCase
setup do... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/continuous_integration_test.rb | activesupport/test/continuous_integration_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/continuous_integration"
class ContinuousIntegrationTest < ActiveSupport::TestCase
setup { @CI = ActiveSupport::ContinuousIntegration.new }
test "successful step" do
output = capture_io { @CI.step "Success!", "true" }.to_s
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/transliterate_test.rb | activesupport/test/transliterate_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/inflector/transliterate"
class TransliterateTest < ActiveSupport::TestCase
def test_transliterate_should_not_change_ascii_chars
(0..127).each do |byte|
char = [byte].pack("U")
assert_equal char, ActiveSupport::Inf... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/callbacks_test.rb | activesupport/test/callbacks_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/core_ext/kernel/singleton_class"
module CallbacksTest
class Record
include ActiveSupport::Callbacks
define_callbacks :save
def self.before_save(*filters, &blk)
set_callback(:save, :before, *filters, &blk)
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/error_reporter_test.rb | activesupport/test/error_reporter_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/execution_context/test_helper"
require "active_support/error_reporter/test_helper"
class ErrorReporterTest < ActiveSupport::TestCase
# ExecutionContext is automatically reset in Rails app via executor hooks set in railtie
# But... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/ordered_hash_test.rb | activesupport/test/ordered_hash_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
require "active_support/json"
require "active_support/core_ext/object/json"
require "active_support/core_ext/hash/indifferent_access"
require "active_support/core_ext/array/extract_options"
class OrderedHashTest < ActiveSupport::TestCase
def setup
@... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/editor_test.rb | activesupport/test/editor_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
module ActiveSupport
class EditorTest < ActiveSupport::TestCase
setup do
Editor.reset
end
teardown do
Editor.reset
end
def test_current
with_env("EDITOR" => nil, "RAILS_EDITOR" => nil) do
assert_nil Editor... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/key_generator_test.rb | activesupport/test/key_generator_test.rb | # frozen_string_literal: true
require_relative "abstract_unit"
begin
require "openssl"
OpenSSL::PKCS5
rescue LoadError, NameError
$stderr.puts "Skipping KeyGenerator test: broken OpenSSL install"
else
class KeyGeneratorTest < ActiveSupport::TestCase
class InvalidDigest; end
def setup
@secret ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/cache_store_setting_test.rb | activesupport/test/cache/cache_store_setting_test.rb | # frozen_string_literal: true
require_relative "../abstract_unit"
require "active_support/cache"
require "dalli"
class CacheStoreSettingTest < ActiveSupport::TestCase
def test_memory_store_gets_created_if_no_arguments_passed_to_lookup_store_method
store = ActiveSupport::Cache.lookup_store
assert_kind_of(Act... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/local_cache_middleware_test.rb | activesupport/test/cache/local_cache_middleware_test.rb | # frozen_string_literal: true
require_relative "../abstract_unit"
require "active_support/cache"
module ActiveSupport
module Cache
module Strategy
module LocalCache
class MiddlewareTest < ActiveSupport::TestCase
class Cache
include LocalCache
end
def test... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/cache_coder_test.rb | activesupport/test/cache/cache_coder_test.rb | # frozen_string_literal: true
require_relative "../abstract_unit"
require "active_support/core_ext/integer/time"
class CacheCoderTest < ActiveSupport::TestCase
setup do
@coder = ActiveSupport::Cache::Coder.new(Serializer, Compressor)
end
test "roundtrips entry" do
ENTRIES.each do |entry|
assert_e... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/cache_store_logger_test.rb | activesupport/test/cache/cache_store_logger_test.rb | # frozen_string_literal: true
require_relative "../abstract_unit"
require "active_support/cache"
class CacheStoreLoggerTest < ActiveSupport::TestCase
def setup
@cache = ActiveSupport::Cache.lookup_store(:memory_store)
@buffer = StringIO.new
@cache.logger = ActiveSupport::Logger.new(@buffer)
end
de... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/cache_store_namespace_test.rb | activesupport/test/cache/cache_store_namespace_test.rb | # frozen_string_literal: true
require_relative "../abstract_unit"
require "active_support/cache"
class CacheStoreNamespaceTest < ActiveSupport::TestCase
def test_static_namespace
cache = ActiveSupport::Cache.lookup_store(:memory_store, namespace: "tester")
cache.write("foo", "bar")
assert_equal "bar", c... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/cache_key_test.rb | activesupport/test/cache/cache_key_test.rb | # frozen_string_literal: true
require_relative "../abstract_unit"
require "active_support/cache"
class CacheKeyTest < ActiveSupport::TestCase
def test_entry_legacy_optional_ivars
legacy = Class.new(ActiveSupport::Cache::Entry) do
def initialize(value, **options)
@value = value
@expires_in ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/serializer_with_fallback_test.rb | activesupport/test/cache/serializer_with_fallback_test.rb | # frozen_string_literal: true
require_relative "../abstract_unit"
require "active_support/core_ext/object/with"
class CacheSerializerWithFallbackTest < ActiveSupport::TestCase
FORMATS = ActiveSupport::Cache::SerializerWithFallback::SERIALIZERS.keys
LEGACY_FORMATS = [:passthrough, :marshal_7_0]
setup do
@en... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/behaviors.rb | activesupport/test/cache/behaviors.rb | # frozen_string_literal: true
require_relative "behaviors/cache_delete_matched_behavior"
require_relative "behaviors/cache_increment_decrement_behavior"
require_relative "behaviors/cache_instrumentation_behavior"
require_relative "behaviors/cache_logging_behavior"
require_relative "behaviors/cache_store_behavior"
requ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/cache_entry_test.rb | activesupport/test/cache/cache_entry_test.rb | # frozen_string_literal: true
require_relative "../abstract_unit"
require "active_support/cache"
class CacheEntryTest < ActiveSupport::TestCase
def test_expired
entry = ActiveSupport::Cache::Entry.new("value")
assert_not entry.expired?, "entry not expired"
entry = ActiveSupport::Cache::Entry.new("value"... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/behaviors/cache_store_coder_behavior.rb | activesupport/test/cache/behaviors/cache_store_coder_behavior.rb | # frozen_string_literal: true
module CacheStoreCoderBehavior
class SpyCoder
attr_reader :dumped_entries, :loaded_entries, :dump_compressed_entries
def initialize
@dumped_entries = []
@loaded_entries = []
@dump_compressed_entries = []
end
def dump(entry)
@dumped_entries << en... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/behaviors/cache_store_serializer_behavior.rb | activesupport/test/cache/behaviors/cache_store_serializer_behavior.rb | # frozen_string_literal: true
require "active_support/core_ext/object/with"
module CacheStoreSerializerBehavior
extend ActiveSupport::Concern
included do
test "serializer can be specified" do
serializer = Module.new do
def self.dump(value)
value.class.name
end
def sel... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/behaviors/cache_store_format_version_behavior.rb | activesupport/test/cache/behaviors/cache_store_format_version_behavior.rb | # frozen_string_literal: true
require "active_support/core_ext/object/with"
module CacheStoreFormatVersionBehavior
extend ActiveSupport::Concern
FORMAT_VERSION_SIGNATURES = {
7.0 => [
"\x00\x04\x08[".b, # "\x00" + Marshal.dump(entry.pack)
"\x01\x78".b, # "\x01" + Zlib::Deflate.deflate(...)
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/behaviors/encoded_key_cache_behavior.rb | activesupport/test/cache/behaviors/encoded_key_cache_behavior.rb | # frozen_string_literal: true
# https://rails.lighthouseapp.com/projects/8994/tickets/6225-memcachestore-cant-deal-with-umlauts-and-special-characters
# The error is caused by character encodings that can't be compared with ASCII-8BIT regular expressions and by special
# characters like the umlaut in UTF-8.
module Enc... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/behaviors/cache_instrumentation_behavior.rb | activesupport/test/cache/behaviors/cache_instrumentation_behavior.rb | # frozen_string_literal: true
module CacheInstrumentationBehavior
def test_write_multi_instrumentation
key_1 = SecureRandom.uuid
key_2 = SecureRandom.uuid
value_1 = SecureRandom.alphanumeric
value_2 = SecureRandom.alphanumeric
writes = { key_1 => value_1, key_2 => value_2 }
events = capture_... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/behaviors/cache_logging_behavior.rb | activesupport/test/cache/behaviors/cache_logging_behavior.rb | # frozen_string_literal: true
require "active_support/core_ext/object/with"
module CacheLoggingBehavior
def test_fetch_logging
assert_logs(/Cache read: #{key_pattern("foo")}/) do
@cache.fetch("foo")
end
assert_logs(/Cache read: #{key_pattern("foo", namespace: "bar")}/) do
@cache.fetch("foo"... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/behaviors/cache_delete_matched_behavior.rb | activesupport/test/cache/behaviors/cache_delete_matched_behavior.rb | # frozen_string_literal: true
module CacheDeleteMatchedBehavior
def test_delete_matched
@cache.write("foo", "bar")
@cache.write("fu", "baz")
@cache.write("foo/bar", "baz")
@cache.write("fu/baz", "bar")
@cache.delete_matched(/oo/)
assert_not @cache.exist?("foo")
assert @cache.exist?("fu")
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/behaviors/failure_safety_behavior.rb | activesupport/test/cache/behaviors/failure_safety_behavior.rb | # frozen_string_literal: true
module FailureSafetyBehavior
def test_fetch_read_failure_returns_nil
key = SecureRandom.uuid
@cache.write(key, SecureRandom.alphanumeric)
emulating_unavailability do |cache|
assert_nil cache.fetch(key)
end
end
def test_fetch_read_failure_does_not_attempt_to_w... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/behaviors/connection_pool_behavior.rb | activesupport/test/cache/behaviors/connection_pool_behavior.rb | # frozen_string_literal: true
module ConnectionPoolBehavior
def test_connection_pool
Thread.report_on_exception, original_report_on_exception = false, Thread.report_on_exception
threads = []
emulating_latency do
cache = ActiveSupport::Cache.lookup_store(*store, { pool: { size: 2, timeout: 0.1 } }... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/behaviors/failure_raising_behavior.rb | activesupport/test/cache/behaviors/failure_raising_behavior.rb | # frozen_string_literal: true
module FailureRaisingBehavior
def test_fetch_read_failure_raises
key = SecureRandom.uuid
@cache.write(key, SecureRandom.alphanumeric)
assert_raise Redis::BaseError do
emulating_unavailability do |cache|
cache.fetch(key)
end
end
end
def test_fetc... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/behaviors/cache_increment_decrement_behavior.rb | activesupport/test/cache/behaviors/cache_increment_decrement_behavior.rb | # frozen_string_literal: true
module CacheIncrementDecrementBehavior
def test_increment
key = SecureRandom.uuid
@cache.write(key, 1, raw: true)
assert_equal 1, @cache.read(key, raw: true).to_i
assert_equal 2, @cache.increment(key)
assert_equal 2, @cache.read(key, raw: true).to_i
assert_equal ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/behaviors/local_cache_behavior.rb | activesupport/test/cache/behaviors/local_cache_behavior.rb | # frozen_string_literal: true
module LocalCacheBehavior
def test_instrumentation_with_local_cache
key = SecureRandom.uuid
events = capture_notifications("cache_write.active_support") do
@cache.write(key, SecureRandom.uuid)
end
assert_equal @cache.class.name, events[0].payload[:store]
@cach... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/behaviors/cache_store_version_behavior.rb | activesupport/test/cache/behaviors/cache_store_version_behavior.rb | # frozen_string_literal: true
module CacheStoreVersionBehavior
ModelWithKeyAndVersion = Struct.new(:cache_key, :cache_version)
def test_fetch_with_right_version_should_hit
key = SecureRandom.uuid
value = SecureRandom.alphanumeric
@cache.fetch(key, version: 1) { value }
assert_equal value, @cache.... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/behaviors/cache_store_behavior.rb | activesupport/test/cache/behaviors/cache_store_behavior.rb | # frozen_string_literal: true
require "active_support/core_ext/numeric/time"
require "active_support/error_reporter/test_helper"
# Tests the base functionality that should be identical across all cache stores.
module CacheStoreBehavior
def test_should_read_and_write_strings
key = SecureRandom.uuid
assert_eq... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/behaviors/cache_store_compression_behavior.rb | activesupport/test/cache/behaviors/cache_store_compression_behavior.rb | # frozen_string_literal: true
require "active_support/core_ext/numeric/bytes"
require "active_support/core_ext/object/with"
module CacheStoreCompressionBehavior
extend ActiveSupport::Concern
included do
test "compression works with cache format version 7.0 (using Marshal70WithFallback)" do
@cache = wit... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/stores/redis_cache_store_test.rb | activesupport/test/cache/stores/redis_cache_store_test.rb | # frozen_string_literal: true
require_relative "../../abstract_unit"
require "active_support/cache"
require "active_support/cache/redis_cache_store"
require_relative "../behaviors"
# Emulates a latency on Redis's back-end for the key latency to facilitate
# connection pool testing.
class SlowRedis < Redis
def get(k... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/stores/null_store_test.rb | activesupport/test/cache/stores/null_store_test.rb | # frozen_string_literal: true
require_relative "../../abstract_unit"
require "active_support/cache"
require_relative "../behaviors"
class NullStoreTest < ActiveSupport::TestCase
def setup
@cache = ActiveSupport::Cache.lookup_store(:null_store)
end
def test_clear
@cache.write("name", "value")
@cache... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/stores/file_store_test.rb | activesupport/test/cache/stores/file_store_test.rb | # frozen_string_literal: true
require_relative "../../abstract_unit"
require "active_support/cache"
require_relative "../behaviors"
require "pathname"
class FileStoreTest < ActiveSupport::TestCase
attr_reader :cache_dir
def lookup_store(options = {})
cache_dir = options.delete(:cache_dir) { @cache_dir }
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/stores/memory_store_test.rb | activesupport/test/cache/stores/memory_store_test.rb | # frozen_string_literal: true
require_relative "../../abstract_unit"
require "active_support/cache"
require_relative "../behaviors"
class StoreTest < ActiveSupport::TestCase
def lookup_store(options = {})
ActiveSupport::Cache.lookup_store(:memory_store, options)
end
end
class MemoryStoreTest < StoreTest
in... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/cache/stores/mem_cache_store_test.rb | activesupport/test/cache/stores/mem_cache_store_test.rb | # frozen_string_literal: true
require_relative "../../abstract_unit"
require "active_support/cache"
require_relative "../behaviors"
require "dalli"
class MemCacheStoreTest < ActiveSupport::TestCase
# Emulates a latency on Dalli's back-end for the key latency to facilitate
# connection pool testing.
class SlowDa... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/fixtures/autoload/another_class.rb | activesupport/test/fixtures/autoload/another_class.rb | # frozen_string_literal: true
class Fixtures::AnotherClass
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/fixtures/autoload/some_class.rb | activesupport/test/fixtures/autoload/some_class.rb | # frozen_string_literal: true
class Fixtures::Autoload::SomeClass
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/fixtures/concern/some_concern.rb | activesupport/test/fixtures/concern/some_concern.rb | # frozen_string_literal: true
require "active_support/concern"
module SomeConcern
extend ActiveSupport::Concern
included do
# shouldn't raise when module is loaded more than once
end
prepended do
# shouldn't raise when module is loaded more than once
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/parallelization/server_test.rb | activesupport/test/parallelization/server_test.rb | # frozen_string_literal: true
require_relative "../abstract_unit"
class ServerTest < ActiveSupport::TestCase
test "server tracks active workers" do
distributor = ActiveSupport::Testing::Parallelization::SharedQueueDistributor.new
server = ActiveSupport::Testing::Parallelization::Server.new(distributor: dist... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/parallelization/test_distributor_test.rb | activesupport/test/parallelization/test_distributor_test.rb | # frozen_string_literal: true
require_relative "../abstract_unit"
class TestDistributorTest < ActiveSupport::TestCase
test "distributes tests round-robin as they arrive" do
distributor = ActiveSupport::Testing::Parallelization::RoundRobinDistributor.new(
worker_count: 2
)
# Add tests and they sho... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/parallelization/thread_pool_executor_test.rb | activesupport/test/parallelization/thread_pool_executor_test.rb | # frozen_string_literal: true
require_relative "../abstract_unit"
class ThreadPoolExecutorTest < ActiveSupport::TestCase
test "executes tests in thread pool" do
results = Concurrent::Array.new
reporter = Minitest::CompositeReporter.new
# Track which tests ran
reporter.reporters << Class.new do
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/concurrency/load_interlock_aware_monitor_test.rb | activesupport/test/concurrency/load_interlock_aware_monitor_test.rb | # frozen_string_literal: true
require_relative "../abstract_unit"
require "active_support/concurrency/load_interlock_aware_monitor"
module ActiveSupport
module Concurrency
class LoadInterlockAwareMonitorTest < ActiveSupport::TestCase
def test_deprecated_constant_resolves_to_monitor
monitor = nil
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/concurrency/thread_monitor_test.rb | activesupport/test/concurrency/thread_monitor_test.rb | # frozen_string_literal: true
require_relative "../abstract_unit"
require "concurrent/atomic/count_down_latch"
require "active_support/concurrency/thread_monitor"
module ActiveSupport
module Concurrency
class ThreadMonitorTest < ActiveSupport::TestCase
def setup
@monitor = ThreadMonitor.new
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/message_pack/shared_serializer_tests.rb | activesupport/test/message_pack/shared_serializer_tests.rb | # frozen_string_literal: true
module MessagePackSharedSerializerTests
extend ActiveSupport::Concern
included do
test "enshrines type IDs" do
expected = {
0 => Symbol,
1 => Integer,
2 => BigDecimal,
3 => Rational,
4 => Complex,
5 => DateTime,
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/message_pack/cache_serializer_test.rb | activesupport/test/message_pack/cache_serializer_test.rb | # frozen_string_literal: true
require_relative "../abstract_unit"
require "active_support/message_pack"
require_relative "shared_serializer_tests"
class MessagePackCacheSerializerTest < ActiveSupport::TestCase
include MessagePackSharedSerializerTests
test "uses #to_msgpack_ext and ::from_msgpack_ext to roundtrip... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/message_pack/serializer_test.rb | activesupport/test/message_pack/serializer_test.rb | # frozen_string_literal: true
require_relative "../abstract_unit"
require "active_support/message_pack"
require_relative "shared_serializer_tests"
class MessagePackSerializerTest < ActiveSupport::TestCase
include MessagePackSharedSerializerTests
test "raises friendly error when dumping an unsupported object" do
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/test/json/decoding_test.rb | activesupport/test/json/decoding_test.rb | # frozen_string_literal: true
require_relative "../abstract_unit"
require "active_support/json"
require "active_support/time"
require_relative "../time_zone_test_helpers"
class TestJSONDecoding < ActiveSupport::TestCase
include TimeZoneTestHelpers
class Foo
def self.json_create(object)
"Foo"
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.