@@ -90,6 +90,28 @@ def test_column_names_are_escaped_coerced
9090 # Caused in Rails v4.2.5 by adding `firm_id` column in this http://git.io/vBfMs
9191 # commit. Trust Rails has this covered.
9292 coerce_tests! :test_find_keeps_multiple_group_values
93+
94+ def test_update_date_time_attributes
95+ Time . use_zone ( "Eastern Time (US & Canada)" ) do
96+ topic = Topic . find ( 1 )
97+ time = Time . zone . parse ( "2017-07-17 10:56" )
98+ topic . update_attributes! ( written_on : time )
99+ assert_equal ( time , topic . written_on )
100+ end
101+ end
102+
103+ def test_update_date_time_attributes_with_default_timezone_local
104+ with_env_tz 'America/New_York' do
105+ with_timezone_config default : :local do
106+ Time . use_zone ( "Eastern Time (US & Canada)" ) do
107+ topic = Topic . find ( 1 )
108+ time = Time . zone . parse ( "2017-07-17 10:56" )
109+ topic . update_attributes! ( written_on : time )
110+ assert_equal ( time , topic . written_on )
111+ end
112+ end
113+ end
114+ end
93115end
94116
95117
@@ -586,28 +608,6 @@ def test_update_attributes_coerced
586608 # assert_nothing_raised { topic.reload }
587609 # assert_equal topic.title, Topic.find(1234).title
588610 end
589-
590- def test_update_date_time_attributes
591- Time . use_zone ( "Eastern Time (US & Canada)" ) do
592- topic = Topic . find ( 1 )
593- time = Time . zone . parse ( "2017-07-17 10:56" )
594- topic . update_attributes! ( written_on : time )
595- assert_equal ( time , topic . written_on )
596- end
597- end
598-
599- def test_update_date_time_attributes_with_default_timezone_local
600- with_env_tz 'America/New_York' do
601- with_timezone_config default : :local do
602- Time . use_zone ( "Eastern Time (US & Canada)" ) do
603- topic = Topic . find ( 1 )
604- time = Time . zone . parse ( "2017-07-17 10:56" )
605- topic . update_attributes! ( written_on : time )
606- assert_equal ( time , topic . written_on )
607- end
608- end
609- end
610- end
611611end
612612
613613
0 commit comments