To run tests for specific file remove/comment the respective exclude and use:
$ AR_TEST_FILES=test/cases/view_test.rb bundle exec rake test:activerecord
test/cases/adapters/postgresql/change_schema_test.rb
test/cases/adapters/postgresql/invertible_migration_test.rb
test/cases/adapters/postgresql/postgresql_rake_test.rb
test/cases/adapters/postgresql/schema_test.rb
test/cases/adapters/postgresql/timestamp_test.rb
test/cases/adapters/postgresql/uuid_test.rb
test/cases/associations_test.rb
test/cases/base_test.rb
test/cases/counter_cache_test.rb
test/cases/database_configurations/resolver_test.rb
test/cases/date_time_precision_test.rb
test/cases/finder_test.rb
test/cases/fixtures_test.rb
test/cases/marshal_serialization_test.rb
test/cases/migration_test.rb
test/cases/migration/change_schema_test.rb
test/cases/migration/compatibility_test.rb
test/cases/migration/invalid_options_test.rb
test/cases/multi_db_migrator_test.rb
test/cases/multiple_db_test.rb
test/cases/schema_dumper_test.rb
test/cases/unsafe_raw_sql_test.rb
test/cases/view_test.rb
test/cases/adapters/postgresql/change_schema_test.rb:56(test_change_type_with_symbol_using_datetime_with_timestamptz_as_default)
test/cases/adapters/postgresql/invertible_migration_test.rb:111(test_migrate_revert_add_and_validate_foreign_key)
test/cases/adapters/postgresql/postgresql_rake_test.rb:335(test_structure_dump)
test/cases/adapters/postgresql/schema_test.rb:812(test_schema_dumps_index_included_columns)
test/cases/adapters/postgresql/timestamp_test.rb:180(test_adds_column_as_timestamptz_if_datetime_type_changed)
test/cases/adapters/postgresql/timestamp_test.rb:193(test_adds_column_as_custom_type)
test/cases/adapters/postgresql/uuid_test.rb:296(test_schema_dumper_for_uuid_primary_key_default_in_legacy_migration)
test/cases/associations_test.rb:1008(test_some_already_loaded_associations)
test/cases/associations_test.rb:1062(test_preload_through)
test/cases/associations_test.rb:1078(test_preload_groups_queries_with_same_scope_at_second_level)
test/cases/associations_test.rb:1099(test_preload_groups_queries_with_same_sql_at_second_level)
test/cases/associations_test.rb:1120(test_preload_with_grouping_sets_inverse_association)
test/cases/associations_test.rb:1138(test_preload_can_group_separate_levels)
test/cases/associations_test.rb:1155(test_preload_can_group_multi_level_ping_pong_through)
test/cases/associations_test.rb:1190(test_preload_does_not_group_same_class_different_scope)
test/cases/associations_test.rb:1223(test_preload_does_not_group_same_scope_different_key_name)
test/cases/associations_test.rb:1239(test_multi_database_polymorphic_preload_with_same_table_name)
test/cases/associations_test.rb:1264(test_preload_with_available_records)
test/cases/associations_test.rb:1276(test_preload_with_available_records_sti)
test/cases/associations_test.rb:1293(test_preload_with_only_some_records_available)
test/cases/associations_test.rb:1309(test_preload_with_some_records_already_loaded)
test/cases/associations_test.rb:1328(test_preload_with_available_records_with_through_association)
test/cases/associations_test.rb:1341(test_preload_with_only_some_records_available_with_through_associations)
test/cases/associations_test.rb:1360(test_preload_with_available_records_with_multiple_classes)
test/cases/associations_test.rb:1375(test_preload_with_available_records_queries_when_scoped)
test/cases/associations_test.rb:1387(test_preload_with_available_records_queries_when_collection)
test/cases/associations_test.rb:1399(test_preload_with_available_records_queries_when_incomplete)
test/cases/associations_test.rb:1414(test_preload_with_unpersisted_records_no_ops)
test/cases/associations_test.rb:1428(test_preload_wont_set_the_wrong_target)
test/cases/associations_test.rb:1445(test_preload_has_many_association_with_composite_foreign_key)
test/cases/associations_test.rb:1455(test_preload_belongs_to_association_with_composite_foreign_key)
test/cases/associations_test.rb:1465(test_preload_loaded_belongs_to_association_with_composite_foreign_key)
test/cases/associations_test.rb:1474(test_preload_has_many_through_association_with_composite_query_constraints)
test/cases/associations_test.rb:1492(test_preloads_has_many_on_model_with_a_composite_primary_key_through_id_attribute)
test/cases/associations_test.rb:1517(test_preloads_belongs_to_a_composite_primary_key_model_through_id_attribute)
test/cases/associations_test.rb:1539(test_preload_keeps_built_has_many_records_no_ops)
test/cases/associations_test.rb:1550(test_preload_keeps_built_has_many_records_after_query)
test/cases/associations_test.rb:1562(test_preload_keeps_built_belongs_to_records_no_ops)
test/cases/associations_test.rb:1573(test_preload_keeps_built_belongs_to_records_after_query)
test/cases/associations_test.rb:808(test_preload_with_scope)
test/cases/associations_test.rb:818(test_preload_makes_correct_number_of_queries_on_array)
test/cases/associations_test.rb:827(test_preload_makes_correct_number_of_queries_on_relation)
test/cases/associations_test.rb:837(test_preload_does_not_concatenate_duplicate_records)
test/cases/associations_test.rb:848(test_preload_for_hmt_with_conditions)
test/cases/associations_test.rb:860(test_preload_groups_queries_with_same_scope)
test/cases/associations_test.rb:875(test_preload_grouped_queries_with_already_loaded_records)
test/cases/associations_test.rb:887(test_preload_grouped_queries_of_middle_records)
test/cases/associations_test.rb:898(test_preload_grouped_queries_of_through_records)
test/cases/associations_test.rb:906(test_preload_through_records_with_already_loaded_middle_record)
test/cases/associations_test.rb:921(test_preload_with_instance_dependent_scope)
test/cases/associations_test.rb:950(test_preload_with_instance_dependent_through_scope)
test/cases/associations_test.rb:971(test_preload_with_through_instance_dependent_scope)
test/cases/base_test.rb:140(test_column_names_are_escaped)
test/cases/counter_cache_test.rb:106(test_reset_multiple_counters)
test/cases/counter_cache_test.rb:113(test_reset_counters_with_string_argument)
test/cases/counter_cache_test.rb:121(test_reset_counters_with_modularized_and_camelized_classnames)
test/cases/counter_cache_test.rb:130(test_reset_counter_with_belongs_to_which_has_class_name)
test/cases/counter_cache_test.rb:140(test_reset_the_right_counter_if_two_have_the_same_class_name)
test/cases/counter_cache_test.rb:154(test_reset_counter_skips_query_for_correct_counter)
test/cases/counter_cache_test.rb:164(test_reset_counter_performs_query_for_correct_counter_with_touch:_true)
test/cases/counter_cache_test.rb:175(test_reset_counters_for_cpk_model)
test/cases/counter_cache_test.rb:186(test_update_counter_with_initial_null_value)
test/cases/counter_cache_test.rb:195(test_update_counter_for_decrement)
test/cases/counter_cache_test.rb:201(test_update_counters_of_multiple_records)
test/cases/counter_cache_test.rb:209(test_update_multiple_counters)
test/cases/counter_cache_test.rb:215(test_update_counter_for_decrement_for_cpk_model)
test/cases/counter_cache_test.rb:222(test_update_other_counters_on_parent_destroy)
test/cases/counter_cache_test.rb:231(test_reset_the_right_counter_if_two_have_the_same_foreign_key)
test/cases/counter_cache_test.rb:238(test_reset_counter_of_has_many_:through_association)
test/cases/counter_cache_test.rb:248(test_the_passed_symbol_needs_to_be_an_association_name_or_counter_name)
test/cases/counter_cache_test.rb:255(test_reset_counter_works_with_select_declared_on_association)
test/cases/counter_cache_test.rb:264(test_counters_are_updated_both_in_memory_and_in_the_database_on_create)
test/cases/counter_cache_test.rb:273(test_counter_caches_are_updated_in_memory_when_the_default_value_is_nil)
test/cases/counter_cache_test.rb:282(test_update_counters_in_a_polymorphic_relationship)
test/cases/counter_cache_test.rb:294(test_removing_association_updates_counter)
test/cases/counter_cache_test.rb:303(test_update_counters_doesn't_touch_timestamps_by_default)
test/cases/counter_cache_test.rb:312(test_update_counters_doesn't_touch_timestamps_with_touch:_[])
test/cases/counter_cache_test.rb:321(test_update_counters_with_touch:_true)
test/cases/counter_cache_test.rb:327(test_update_counters_of_multiple_records_with_touch:_true)
test/cases/counter_cache_test.rb:337(test_update_multiple_counters_with_touch:_true)
test/cases/counter_cache_test.rb:343(test_reset_counters_with_touch:_true)
test/cases/counter_cache_test.rb:349(test_reset_multiple_counters_with_touch:_true)
test/cases/counter_cache_test.rb:356(test_increment_counters_with_touch:_true)
test/cases/counter_cache_test.rb:362(test_decrement_counters_with_touch:_true)
test/cases/counter_cache_test.rb:368(test_update_counters_with_touch:_:written_on)
test/cases/counter_cache_test.rb:374(test_update_multiple_counters_with_touch:_:written_on)
test/cases/counter_cache_test.rb:380(test_reset_counters_with_touch:_:written_on)
test/cases/counter_cache_test.rb:386(test_reset_multiple_counters_with_touch:_:written_on)
test/cases/counter_cache_test.rb:393(test_increment_counters_with_touch:_:written_on)
test/cases/counter_cache_test.rb:399(test_decrement_counters_with_touch:_:written_on)
test/cases/counter_cache_test.rb:405(test_update_counters_with_touch:_%i(_updated_at_written_on_))
test/cases/counter_cache_test.rb:41(test_increment_counter)
test/cases/counter_cache_test.rb:411(test_update_multiple_counters_with_touch:_%i(_updated_at_written_on_))
test/cases/counter_cache_test.rb:417(test_reset_counters_with_touch:_%i(_updated_at_written_on_))
test/cases/counter_cache_test.rb:423(test_reset_multiple_counters_with_touch:_%i(_updated_at_written_on_))
test/cases/counter_cache_test.rb:430(test_increment_counters_with_touch:_%i(_updated_at_written_on_))
test/cases/counter_cache_test.rb:436(test_decrement_counters_with_touch:_%i(_updated_at_written_on_))
test/cases/counter_cache_test.rb:442(test_counter_cache_column?)
test/cases/counter_cache_test.rb:447(test_inactive_conter_cache)
test/cases/counter_cache_test.rb:464(test_active_conter_cache)
test/cases/counter_cache_test.rb:47(test_increment_counter_by_specific_amount)
test/cases/counter_cache_test.rb:53(test_increment_counter_for_cpk_model)
test/cases/counter_cache_test.rb:60(test_increment_counter_for_multiple_cpk_model_records)
test/cases/counter_cache_test.rb:67(test_decrement_counter)
test/cases/counter_cache_test.rb:73(test_decrement_counter_by_specific_amount)
test/cases/counter_cache_test.rb:79(test_decrement_counter_for_cpk_model)
test/cases/counter_cache_test.rb:86(test_reset_counters)
test/cases/counter_cache_test.rb:96(test_reset_counters_by_counter_name)
test/cases/database_configurations/resolver_test.rb:14(test_url_invalid_adapter)
test/cases/date_time_precision_test.rb:152(test_formatting_datetime_according_to_precision_when_time_zone_aware_using_timestamptz)
test/cases/finder_test.rb:1458(test_find_by_on_attribute_that_is_a_reserved_word)
test/cases/fixtures_test.rb:1583(test_fixtures_are_properly_loaded)
test/cases/fixtures_test.rb:705(test_resets_to_min_pk_with_specified_pk_and_sequence)
test/cases/marshal_serialization_test.rb:18(test_deserializing_rails_6_1_marshal_basic)
test/cases/marshal_serialization_test.rb:27(test_deserializing_rails_6_1_marshal_with_loaded_association_cache)
test/cases/marshal_serialization_test.rb:38(test_deserializing_rails_7_1_marshal_basic)
test/cases/marshal_serialization_test.rb:47(test_deserializing_rails_7_1_marshal_with_loaded_association_cache)
test/cases/migration_test.rb:1226(test_adding_multiple_columns)
test/cases/migration_test.rb:1323(test_adding_indexes)
test/cases/migration_test.rb:1356(test_removing_index)
test/cases/migration_test.rb:1386(test_changing_columns)
test/cases/migration_test.rb:1416(test_changing_column_null_with_default)
test/cases/migration_test.rb:1488(test_changing_index)
test/cases/migration/change_schema_test.rb:305(test_add_column_with_datetime_in_timestamptz_mode)
test/cases/migration/compatibility_test.rb:281(test_legacy_change_column_with_null_executes_update)
test/cases/migration/compatibility_test.rb:615(test_disable_extension_on_7_0)
test/cases/migration/compatibility_test.rb:631(test_legacy_add_foreign_key_with_deferrable_true)
test/cases/migration/invalid_options_test.rb:101(test_change_column_with_invalid_options)
test/cases/migration/invalid_options_test.rb:41(test_add_reference_with_invalid_options)
test/cases/migration/invalid_options_test.rb:65(test_add_column_with_invalid_options)
test/cases/multi_db_migrator_test.rb:110(test_get_all_versions)
test/cases/multi_db_migrator_test.rb:139(test_finds_pending_migrations)
test/cases/multi_db_migrator_test.rb:155(test_migrator_db_has_no_schema_migrations_table)
test/cases/multi_db_migrator_test.rb:175(test_migrator_forward)
test/cases/multiple_db_test.rb:121(test_exception_contains_correct_pool)
test/cases/schema_dumper_test.rb:617(test_schema_dump_with_timestamptz_datetime_format)
test/cases/schema_dumper_test.rb:708(test_schema_dump_when_changing_datetime_type_for_an_existing_app)
test/cases/unsafe_raw_sql_test.rb:169(test_order:_allows_valid_arguments_with_COLLATE)
test/cases/view_test.rb:127(test_views)
test/cases/view_test.rb:39(test_views)
test/cases/view_test.rb:39(test_views)