22
33require "cases/helper_sqlserver"
44
5+ require "models/author"
6+ require "models/book"
7+ require "models/car"
8+ require "models/citation"
9+ require "models/comment"
10+ require "models/computer"
11+ require "models/customer"
12+ require "models/dashboard"
13+ require "models/developer"
514require "models/event"
15+ require "models/non_primary_key"
16+ require "models/post"
17+ require "models/tag"
18+ require "models/task"
19+ require "models/topic"
20+
621class UniquenessValidationTest < ActiveRecord ::TestCase
722 # So sp_executesql swallows this exception. Run without prepared to see it.
823 coerce_tests! :test_validate_uniqueness_with_limit
@@ -62,7 +77,6 @@ def test_partial_index_coerced
6277 end
6378end
6479
65- require "models/event"
6680module ActiveRecord
6781 class AdapterTest < ActiveRecord ::TestCase
6882 # Legacy binds are not supported.
@@ -174,7 +188,6 @@ def test_truncate_tables_with_query_cache
174188 end
175189end
176190
177- require "models/topic"
178191class AttributeMethodsTest < ActiveRecord ::TestCase
179192 # Use IFF for boolean statement in SELECT
180193 coerce_tests! %r{typecast attribute from select to false}
@@ -1015,9 +1028,6 @@ def test_count_with_include_coerced
10151028 coerce_tests! %r{including association based on sql condition and no database column}
10161029end
10171030
1018- require "models/topic"
1019- require "models/customer"
1020- require "models/non_primary_key"
10211031class FinderTest < ActiveRecord ::TestCase
10221032 fixtures :customers , :topics , :authors
10231033
@@ -1291,8 +1301,6 @@ class LeftOuterJoinAssociationTest < ActiveRecord::TestCase
12911301 coerce_tests! :test_does_not_override_select
12921302end
12931303
1294- require "models/developer"
1295- require "models/computer"
12961304class NestedRelationScopingTest < ActiveRecord ::TestCase
12971305 # Assert SQL Server limit implementation
12981306 coerce_tests! :test_merge_options
@@ -1308,7 +1316,6 @@ def test_merge_options_coerced
13081316 end
13091317end
13101318
1311- require "models/topic"
13121319class PersistenceTest < ActiveRecord ::TestCase
13131320 # Rails test required updating a identity column.
13141321 coerce_tests! :test_update_columns_changing_id
@@ -1335,7 +1342,6 @@ def test_update_coerced
13351342 coerce_tests! :test_model_with_no_auto_populated_fields_still_returns_primary_key_after_insert
13361343end
13371344
1338- require "models/author"
13391345class UpdateAllTest < ActiveRecord ::TestCase
13401346 # Regular expression slightly different.
13411347 coerce_tests! :test_update_all_doesnt_ignore_order
@@ -1393,7 +1399,6 @@ def test_delete_all_with_group_by_and_having_coerced
13931399 end
13941400end
13951401
1396- require "models/topic"
13971402module ActiveRecord
13981403 class PredicateBuilderTest < ActiveRecord ::TestCase
13991404 # Same as original test except string has `N` prefix to indicate unicode string.
@@ -1424,7 +1429,6 @@ def topic_title
14241429 end
14251430end
14261431
1427- require "models/task"
14281432class QueryCacheTest < ActiveRecord ::TestCase
14291433 # SQL Server adapter not in list of supported adapters in original test.
14301434 coerce_tests! :test_cache_does_not_wrap_results_in_arrays
@@ -1435,7 +1439,6 @@ def test_cache_does_not_wrap_results_in_arrays_coerced
14351439 end
14361440end
14371441
1438- require "models/post"
14391442class RelationTest < ActiveRecord ::TestCase
14401443 # Use LEN() instead of LENGTH() function.
14411444 coerce_tests! :test_reverse_order_with_function
@@ -1579,7 +1582,6 @@ def test_does_not_duplicate_optimizer_hints_on_merge_coerced
15791582 end
15801583end
15811584
1582- require "models/post"
15831585class SanitizeTest < ActiveRecord ::TestCase
15841586 # Use nvarchar string (N'') in assert
15851587 coerce_tests! :test_sanitize_sql_like_example_use_case
@@ -1706,7 +1708,6 @@ class TestAdapterWithInvalidConnection < ActiveRecord::TestCase
17061708 coerce_tests! %r{inspect on Model class does not raise}
17071709end
17081710
1709- require "models/topic"
17101711class TransactionTest < ActiveRecord ::TestCase
17111712 # SQL Server does not have query for release_savepoint.
17121713 coerce_tests! :test_releasing_named_savepoints
@@ -1798,7 +1799,6 @@ def test_nested_transactions_skip_excess_savepoints_coerced
17981799 end
17991800end
18001801
1801- require "models/tag"
18021802class TransactionIsolationTest < ActiveRecord ::TestCase
18031803 # SQL Server will lock the table for counts even when both
18041804 # connections are `READ COMMITTED`. So we bypass with `READPAST`.
@@ -1818,7 +1818,6 @@ class TransactionIsolationTest < ActiveRecord::TestCase
18181818 coerce_tests! %r{repeatable read}
18191819end
18201820
1821- require "models/book"
18221821class ViewWithPrimaryKeyTest < ActiveRecord ::TestCase
18231822 # We have a few view tables. use includes vs equality.
18241823 coerce_tests! :test_views
@@ -1842,7 +1841,6 @@ def test_views_coerced
18421841 end
18431842end
18441843
1845- require "models/author"
18461844class YamlSerializationTest < ActiveRecord ::TestCase
18471845 coerce_tests! :test_types_of_virtual_columns_are_not_changed_on_round_trip
18481846 def test_types_of_virtual_columns_are_not_changed_on_round_trip_coerced
@@ -1957,7 +1955,6 @@ class CacheKeyTest < ActiveRecord::TestCase
19571955 end
19581956end
19591957
1960- require "models/book"
19611958module ActiveRecord
19621959 class StatementCacheTest < ActiveRecord ::TestCase
19631960 # Getting random failures.
@@ -2012,8 +2009,6 @@ def schema_dump_8_0_path
20122009 end
20132010end
20142011
2015- require "models/post"
2016- require "models/comment"
20172012class UnsafeRawSqlTest < ActiveRecord ::TestCase
20182013 fixtures :posts
20192014
@@ -2210,7 +2205,6 @@ class DatabaseTasksTruncateAllTest < ActiveRecord::TestCase
22102205 end
22112206end
22122207
2213- require "models/book"
22142208class EnumTest < ActiveRecord ::TestCase
22152209 # Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
22162210 coerce_tests! %r{enums are distinct per class}
@@ -2257,7 +2251,6 @@ class EnumTest < ActiveRecord::TestCase
22572251 end
22582252end
22592253
2260- require "models/citation"
22612254class EagerLoadingTooManyIdsTest < ActiveRecord ::TestCase
22622255 fixtures :citations
22632256
@@ -2396,7 +2389,6 @@ class MultiDbMigratorTest < ActiveRecord::TestCase
23962389 coerce_tests! :test_migrator_db_has_no_schema_migrations_table if /mswin|mingw/ . match? ( RbConfig ::CONFIG [ "host_os" ] )
23972390end
23982391
2399- require "models/book"
24002392class FieldOrderedValuesTest < ActiveRecord ::TestCase
24012393 # Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
24022394 coerce_tests! :test_in_order_of_with_enums_values
@@ -2443,7 +2435,6 @@ def test_in_order_of_with_nil_coerced
24432435 end
24442436end
24452437
2446- require "models/dashboard"
24472438class QueryLogsTest < ActiveRecord ::TestCase
24482439 # SQL requires double single-quotes.
24492440 coerce_tests! :test_sql_commenter_format
@@ -2750,7 +2741,6 @@ def type_for_attribute_is_not_aware_of_custom_types_coerced
27502741 end
27512742end
27522743
2753- require "models/car"
27542744class ExplainTest < ActiveRecord ::TestCase
27552745 # Expected query slightly different from because of 'sp_executesql' and query parameters.
27562746 coerce_tests! :test_relation_explain_with_first
0 commit comments