Skip to content

Commit 2d969ba

Browse files
committed
Add a test for mutating times
1 parent d3ff790 commit 2d969ba

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

activerecord/test/cases/base_test.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,16 @@ def test_switching_default_time_zone
11721172
end
11731173
end
11741174

1175+
def test_mutating_time_objects
1176+
with_env_tz do
1177+
with_timezone_config default: :local do
1178+
assert_equal Time.local(2004, 1, 1, 0, 0, 0, 0), Default.new.fixed_time
1179+
assert_equal Time.utc(2004, 1, 1, 5, 0, 0, 0), Default.new.fixed_time.utc
1180+
assert_equal Time.local(2004, 1, 1, 0, 0, 0, 0), Default.new.fixed_time
1181+
end
1182+
end
1183+
end
1184+
11751185
unless in_memory_db?
11761186
def test_connection_in_local_time
11771187
with_timezone_config default: :utc do

0 commit comments

Comments
 (0)