@@ -255,33 +255,6 @@ def migrate(x)
255
255
end
256
256
end
257
257
258
- def test_options_are_not_validated
259
- migration = Class . new ( ActiveRecord ::Migration [ 4.2 ] ) {
260
- def migrate ( x )
261
- create_table :tests , wrong_id : false do |t |
262
- t . references :some_table , wrong_primary_key : true
263
- t . integer :some_id , wrong_unique : true
264
- t . string :some_string_column , wrong_null : false
265
- end
266
-
267
- add_column :tests , "last_name" , :string , wrong_precision : true
268
-
269
- change_column :tests , :some_id , :float , wrong_index : true
270
-
271
- change_table :tests do |t |
272
- t . change :some_id , :float , null : false , wrong_index : true
273
- t . integer :another_id , wrong_unique : true
274
- end
275
- end
276
- } . new
277
-
278
- ActiveRecord ::Migrator . new ( :up , [ migration ] , @schema_migration , @internal_metadata ) . migrate
279
-
280
- assert connection . table_exists? ( :tests )
281
- ensure
282
- connection . drop_table :tests , if_exists : true
283
- end
284
-
285
258
def test_create_table_allows_duplicate_column_names
286
259
migration = Class . new ( ActiveRecord ::Migration [ 5.2 ] ) {
287
260
def migrate ( x )
@@ -681,6 +654,37 @@ def precision_implicit_default
681
654
end
682
655
end
683
656
657
+ module NoOptionValidationTestCases
658
+ def test_options_are_not_validated
659
+ migration = Class . new ( migration_class ) {
660
+ def migrate ( x )
661
+ create_table :tests , wrong_id : false do |t |
662
+ t . references :some_table , wrong_primary_key : true
663
+ t . integer :some_id , wrong_unique : true
664
+ t . string :some_string_column , wrong_null : false
665
+ end
666
+
667
+ add_column :tests , "last_name" , :string , wrong_precision : true
668
+
669
+ change_column :tests , :some_id , :float , wrong_index : true
670
+
671
+ add_reference :tests , :another_table , invalid_option : :something
672
+
673
+ change_table :tests do |t |
674
+ t . change :some_id , :float , null : false , wrong_index : true
675
+ t . integer :another_id , wrong_unique : true
676
+ end
677
+ end
678
+ } . new
679
+
680
+ ActiveRecord ::Migrator . new ( :up , [ migration ] , @schema_migration , @internal_metadata ) . migrate
681
+
682
+ assert connection . table_exists? ( :tests )
683
+ ensure
684
+ connection . drop_table :tests , if_exists : true
685
+ end
686
+ end
687
+
684
688
module DefaultPrecisionImplicitTestCases
685
689
def test_datetime_doesnt_set_precision_on_change_table
686
690
create_migration = Class . new ( migration_class ) {
@@ -838,6 +842,7 @@ def teardown
838
842
839
843
class CompatibilityTest7_0 < BaseCompatibilityTest
840
844
include DefaultPrecisionSixTestCases
845
+ include NoOptionValidationTestCases
841
846
842
847
private
843
848
def migration_class
@@ -847,6 +852,7 @@ def migration_class
847
852
848
853
class CompatibilityTest6_1 < BaseCompatibilityTest
849
854
include DefaultPrecisionImplicitTestCases
855
+ include NoOptionValidationTestCases
850
856
851
857
private
852
858
def migration_class
@@ -856,6 +862,7 @@ def migration_class
856
862
857
863
class CompatibilityTest6_0 < BaseCompatibilityTest
858
864
include DefaultPrecisionImplicitTestCases
865
+ include NoOptionValidationTestCases
859
866
860
867
private
861
868
def migration_class
@@ -865,6 +872,7 @@ def migration_class
865
872
866
873
class CompatibilityTest5_2 < BaseCompatibilityTest
867
874
include DefaultPrecisionImplicitTestCases
875
+ include NoOptionValidationTestCases
868
876
869
877
private
870
878
def migration_class
@@ -874,6 +882,7 @@ def migration_class
874
882
875
883
class CompatibilityTest5_1 < BaseCompatibilityTest
876
884
include DefaultPrecisionImplicitTestCases
885
+ include NoOptionValidationTestCases
877
886
878
887
private
879
888
def migration_class
@@ -883,6 +892,7 @@ def migration_class
883
892
884
893
class CompatibilityTest5_0 < BaseCompatibilityTest
885
894
include DefaultPrecisionImplicitTestCases
895
+ include NoOptionValidationTestCases
886
896
887
897
private
888
898
def migration_class
@@ -892,6 +902,7 @@ def migration_class
892
902
893
903
class CompatibilityTest4_2 < BaseCompatibilityTest
894
904
include DefaultPrecisionImplicitTestCases
905
+ include NoOptionValidationTestCases
895
906
896
907
private
897
908
def migration_class
0 commit comments