@@ -1117,14 +1117,16 @@ def test_default_char_types
1117
1117
end
1118
1118
1119
1119
def test_default_in_local_time
1120
- with_timezone_config default : :local do
1121
- default = Default . new
1120
+ with_env_tz do
1121
+ with_timezone_config default : :local do
1122
+ default = Default . new
1122
1123
1123
- assert_equal Date . new ( 2004 , 1 , 1 ) , default . fixed_date
1124
- assert_equal Time . local ( 2004 , 1 , 1 , 0 , 0 , 0 , 0 ) , default . fixed_time
1124
+ assert_equal Date . new ( 2004 , 1 , 1 ) , default . fixed_date
1125
+ assert_equal Time . local ( 2004 , 1 , 1 , 0 , 0 , 0 , 0 ) , default . fixed_time
1125
1126
1126
- if current_adapter? ( :PostgreSQLAdapter )
1127
- assert_equal Time . utc ( 2004 , 1 , 1 , 0 , 0 , 0 , 0 ) , default . fixed_time_with_time_zone
1127
+ if current_adapter? ( :PostgreSQLAdapter )
1128
+ assert_equal Time . utc ( 2004 , 1 , 1 , 0 , 0 , 0 , 0 ) , default . fixed_time_with_time_zone
1129
+ end
1128
1130
end
1129
1131
end
1130
1132
end
@@ -1157,6 +1159,19 @@ def test_default_in_utc_with_time_zone
1157
1159
end
1158
1160
end
1159
1161
1162
+ def test_switching_default_time_zone
1163
+ with_env_tz do
1164
+ 2 . times do
1165
+ with_timezone_config default : :local do
1166
+ assert_equal Time . local ( 2004 , 1 , 1 , 0 , 0 , 0 , 0 ) , Default . new . fixed_time
1167
+ end
1168
+ with_timezone_config default : :utc do
1169
+ assert_equal Time . utc ( 2004 , 1 , 1 , 0 , 0 , 0 , 0 ) , Default . new . fixed_time
1170
+ end
1171
+ end
1172
+ end
1173
+ end
1174
+
1160
1175
unless in_memory_db?
1161
1176
def test_connection_in_local_time
1162
1177
with_timezone_config default : :utc do
0 commit comments