Skip to content

Commit 4787491

Browse files
wangjohnrafaelfranca
authored andcommitted
Application Record tests should reset configurations.
We need to reset the configurations so that Active Record configurations are set back to their defaults.
1 parent c2fdb88 commit 4787491

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

activerecord/test/cases/application_record_test.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def test_changing_prefix_on_ar_base
2929
ActiveRecord::Base.table_name_prefix = prefix
3030
assert_equal prefix, ModelBaseInherited.table_name_prefix
3131
assert_equal prefix, ModelAppRecordInherited.table_name_prefix
32+
ActiveRecord::Base.table_name_prefix = ""
3233
end
3334

3435
def test_changing_prefix_on_ar_base_inherited_model
@@ -39,6 +40,7 @@ def test_changing_prefix_on_ar_base_inherited_model
3940

4041
assert_equal new_prefix, ModelBaseInherited.table_name_prefix
4142
assert_equal prefix, ActiveRecord::Base.table_name_prefix
43+
ActiveRecord::Base.table_name_prefix = ""
4244
end
4345

4446
def test_changing_prefix_on_application_record_inherited_model
@@ -49,6 +51,8 @@ def test_changing_prefix_on_application_record_inherited_model
4951

5052
assert_equal new_prefix, Topic.table_name_prefix
5153
assert_equal prefix, ActiveRecord::Base.table_name_prefix
54+
ActiveRecord::Base.table_name_prefix = ""
55+
Topic.table_name_prefix = ""
5256
end
5357

5458
def test_double_inheritence_rules
@@ -124,6 +128,7 @@ def test_changing_config_on_models_isolated_across_namespaces
124128
assert_equal format, ApplicationRecord.cache_timestamp_format
125129
assert_equal new_format, FirstNamespace::SomeModel.cache_timestamp_format
126130
assert_equal format, SecondNamespace::SomeModel.cache_timestamp_format
131+
ApplicationRecord.cache_timestamp_format = :nsec
127132
end
128133

129134
def test_changing_module_application_record_does_not_propogate

0 commit comments

Comments
 (0)