2
2
3
3
require "cases/helper_sqlserver"
4
4
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"
5
14
require "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
+
6
21
class UniquenessValidationTest < ActiveRecord ::TestCase
7
22
# So sp_executesql swallows this exception. Run without prepared to see it.
8
23
coerce_tests! :test_validate_uniqueness_with_limit
@@ -62,7 +77,6 @@ def test_partial_index_coerced
62
77
end
63
78
end
64
79
65
- require "models/event"
66
80
module ActiveRecord
67
81
class AdapterTest < ActiveRecord ::TestCase
68
82
# Legacy binds are not supported.
@@ -174,7 +188,6 @@ def test_truncate_tables_with_query_cache
174
188
end
175
189
end
176
190
177
- require "models/topic"
178
191
class AttributeMethodsTest < ActiveRecord ::TestCase
179
192
# Use IFF for boolean statement in SELECT
180
193
coerce_tests! %r{typecast attribute from select to false}
@@ -1015,9 +1028,6 @@ def test_count_with_include_coerced
1015
1028
coerce_tests! %r{including association based on sql condition and no database column}
1016
1029
end
1017
1030
1018
- require "models/topic"
1019
- require "models/customer"
1020
- require "models/non_primary_key"
1021
1031
class FinderTest < ActiveRecord ::TestCase
1022
1032
fixtures :customers , :topics , :authors
1023
1033
@@ -1291,8 +1301,6 @@ class LeftOuterJoinAssociationTest < ActiveRecord::TestCase
1291
1301
coerce_tests! :test_does_not_override_select
1292
1302
end
1293
1303
1294
- require "models/developer"
1295
- require "models/computer"
1296
1304
class NestedRelationScopingTest < ActiveRecord ::TestCase
1297
1305
# Assert SQL Server limit implementation
1298
1306
coerce_tests! :test_merge_options
@@ -1308,7 +1316,6 @@ def test_merge_options_coerced
1308
1316
end
1309
1317
end
1310
1318
1311
- require "models/topic"
1312
1319
class PersistenceTest < ActiveRecord ::TestCase
1313
1320
# Rails test required updating a identity column.
1314
1321
coerce_tests! :test_update_columns_changing_id
@@ -1335,7 +1342,6 @@ def test_update_coerced
1335
1342
coerce_tests! :test_model_with_no_auto_populated_fields_still_returns_primary_key_after_insert
1336
1343
end
1337
1344
1338
- require "models/author"
1339
1345
class UpdateAllTest < ActiveRecord ::TestCase
1340
1346
# Regular expression slightly different.
1341
1347
coerce_tests! :test_update_all_doesnt_ignore_order
@@ -1393,7 +1399,6 @@ def test_delete_all_with_group_by_and_having_coerced
1393
1399
end
1394
1400
end
1395
1401
1396
- require "models/topic"
1397
1402
module ActiveRecord
1398
1403
class PredicateBuilderTest < ActiveRecord ::TestCase
1399
1404
# Same as original test except string has `N` prefix to indicate unicode string.
@@ -1424,7 +1429,6 @@ def topic_title
1424
1429
end
1425
1430
end
1426
1431
1427
- require "models/task"
1428
1432
class QueryCacheTest < ActiveRecord ::TestCase
1429
1433
# SQL Server adapter not in list of supported adapters in original test.
1430
1434
coerce_tests! :test_cache_does_not_wrap_results_in_arrays
@@ -1435,7 +1439,6 @@ def test_cache_does_not_wrap_results_in_arrays_coerced
1435
1439
end
1436
1440
end
1437
1441
1438
- require "models/post"
1439
1442
class RelationTest < ActiveRecord ::TestCase
1440
1443
# Use LEN() instead of LENGTH() function.
1441
1444
coerce_tests! :test_reverse_order_with_function
@@ -1579,7 +1582,6 @@ def test_does_not_duplicate_optimizer_hints_on_merge_coerced
1579
1582
end
1580
1583
end
1581
1584
1582
- require "models/post"
1583
1585
class SanitizeTest < ActiveRecord ::TestCase
1584
1586
# Use nvarchar string (N'') in assert
1585
1587
coerce_tests! :test_sanitize_sql_like_example_use_case
@@ -1706,7 +1708,6 @@ class TestAdapterWithInvalidConnection < ActiveRecord::TestCase
1706
1708
coerce_tests! %r{inspect on Model class does not raise}
1707
1709
end
1708
1710
1709
- require "models/topic"
1710
1711
class TransactionTest < ActiveRecord ::TestCase
1711
1712
# SQL Server does not have query for release_savepoint.
1712
1713
coerce_tests! :test_releasing_named_savepoints
@@ -1798,7 +1799,6 @@ def test_nested_transactions_skip_excess_savepoints_coerced
1798
1799
end
1799
1800
end
1800
1801
1801
- require "models/tag"
1802
1802
class TransactionIsolationTest < ActiveRecord ::TestCase
1803
1803
# SQL Server will lock the table for counts even when both
1804
1804
# connections are `READ COMMITTED`. So we bypass with `READPAST`.
@@ -1818,7 +1818,6 @@ class TransactionIsolationTest < ActiveRecord::TestCase
1818
1818
coerce_tests! %r{repeatable read}
1819
1819
end
1820
1820
1821
- require "models/book"
1822
1821
class ViewWithPrimaryKeyTest < ActiveRecord ::TestCase
1823
1822
# We have a few view tables. use includes vs equality.
1824
1823
coerce_tests! :test_views
@@ -1842,7 +1841,6 @@ def test_views_coerced
1842
1841
end
1843
1842
end
1844
1843
1845
- require "models/author"
1846
1844
class YamlSerializationTest < ActiveRecord ::TestCase
1847
1845
coerce_tests! :test_types_of_virtual_columns_are_not_changed_on_round_trip
1848
1846
def test_types_of_virtual_columns_are_not_changed_on_round_trip_coerced
@@ -1957,7 +1955,6 @@ class CacheKeyTest < ActiveRecord::TestCase
1957
1955
end
1958
1956
end
1959
1957
1960
- require "models/book"
1961
1958
module ActiveRecord
1962
1959
class StatementCacheTest < ActiveRecord ::TestCase
1963
1960
# Getting random failures.
@@ -2012,8 +2009,6 @@ def schema_dump_8_0_path
2012
2009
end
2013
2010
end
2014
2011
2015
- require "models/post"
2016
- require "models/comment"
2017
2012
class UnsafeRawSqlTest < ActiveRecord ::TestCase
2018
2013
fixtures :posts
2019
2014
@@ -2210,7 +2205,6 @@ class DatabaseTasksTruncateAllTest < ActiveRecord::TestCase
2210
2205
end
2211
2206
end
2212
2207
2213
- require "models/book"
2214
2208
class EnumTest < ActiveRecord ::TestCase
2215
2209
# Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
2216
2210
coerce_tests! %r{enums are distinct per class}
@@ -2257,7 +2251,6 @@ class EnumTest < ActiveRecord::TestCase
2257
2251
end
2258
2252
end
2259
2253
2260
- require "models/citation"
2261
2254
class EagerLoadingTooManyIdsTest < ActiveRecord ::TestCase
2262
2255
fixtures :citations
2263
2256
@@ -2396,7 +2389,6 @@ class MultiDbMigratorTest < ActiveRecord::TestCase
2396
2389
coerce_tests! :test_migrator_db_has_no_schema_migrations_table if /mswin|mingw/ . match? ( RbConfig ::CONFIG [ "host_os" ] )
2397
2390
end
2398
2391
2399
- require "models/book"
2400
2392
class FieldOrderedValuesTest < ActiveRecord ::TestCase
2401
2393
# Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
2402
2394
coerce_tests! :test_in_order_of_with_enums_values
@@ -2443,7 +2435,6 @@ def test_in_order_of_with_nil_coerced
2443
2435
end
2444
2436
end
2445
2437
2446
- require "models/dashboard"
2447
2438
class QueryLogsTest < ActiveRecord ::TestCase
2448
2439
# SQL requires double single-quotes.
2449
2440
coerce_tests! :test_sql_commenter_format
@@ -2750,7 +2741,6 @@ def type_for_attribute_is_not_aware_of_custom_types_coerced
2750
2741
end
2751
2742
end
2752
2743
2753
- require "models/car"
2754
2744
class ExplainTest < ActiveRecord ::TestCase
2755
2745
# Expected query slightly different from because of 'sp_executesql' and query parameters.
2756
2746
coerce_tests! :test_relation_explain_with_first
0 commit comments