aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorAndrew White <pixeltrix@users.noreply.github.com>2019-01-21 20:26:45 +0000
committerGitHub <noreply@github.com>2019-01-21 20:26:45 +0000
commit4f62e757caf608d30d46ee745f4f666fb8eba2a7 (patch)
treefe09316da3912e930f9cf512c5d8b35bc91a075a /activerecord/test
parentfeb97dfabd027a73a41ca8bd2ab7c3196ab76d3d (diff)
parentccdedeb9d5e1b2b74f03baef65aa8198b456e3b0 (diff)
downloadrails-4f62e757caf608d30d46ee745f4f666fb8eba2a7.tar.gz
rails-4f62e757caf608d30d46ee745f4f666fb8eba2a7.tar.bz2
rails-4f62e757caf608d30d46ee745f4f666fb8eba2a7.zip
Merge pull request #34990 from rails/fix-time-multiparameter-casting
Fix year value when casting a multiparameter time hash
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/type/time_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/activerecord/test/cases/type/time_test.rb b/activerecord/test/cases/type/time_test.rb
new file mode 100644
index 0000000000..1a2c47479f
--- /dev/null
+++ b/activerecord/test/cases/type/time_test.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+require "cases/helper"
+require "models/topic"
+
+module ActiveRecord
+ module Type
+ class TimeTest < ActiveRecord::TestCase
+ def test_default_year_is_correct
+ expected_time = ::Time.utc(2000, 1, 1, 10, 30, 0)
+ topic = Topic.new(bonus_time: { 4 => 10, 5 => 30 })
+
+ assert_equal expected_time, topic.bonus_time
+
+ topic.save!
+ topic.reload
+
+ assert_equal expected_time, topic.bonus_time
+ end
+ end
+ end
+end