aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-05-07 07:52:08 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-05-07 07:52:08 +0000
commitd08d89c09285ac6c65273c935a1afbbc983f7544 (patch)
treef81cdd5bbc2539eeeb04069c44ca175d1bc86273 /activerecord/test
parentd59f3a78a423064f53dadd9f55d05b5f7b2b240e (diff)
downloadrails-d08d89c09285ac6c65273c935a1afbbc983f7544.tar.gz
rails-d08d89c09285ac6c65273c935a1afbbc983f7544.tar.bz2
rails-d08d89c09285ac6c65273c935a1afbbc983f7544.zip
Dates and times interpret empty strings as nil rather than 2000-01-01. Closes #4830.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4327 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/empty_date_time_test.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/activerecord/test/empty_date_time_test.rb b/activerecord/test/empty_date_time_test.rb
new file mode 100644
index 0000000000..0b50b0949a
--- /dev/null
+++ b/activerecord/test/empty_date_time_test.rb
@@ -0,0 +1,25 @@
+require 'abstract_unit'
+require 'fixtures/topic'
+require 'fixtures/task'
+
+class EmptyDateTimeTest < Test::Unit::TestCase
+ def test_assign_empty_date_time
+ task = Task.new
+ task.starting = ''
+ task.ending = nil
+ assert_nil task.starting
+ assert_nil task.ending
+ end
+
+ def test_assign_empty_date
+ topic = Topic.new
+ topic.last_read = ''
+ assert_nil topic.last_read
+ end
+
+ def test_assign_empty_time
+ topic = Topic.new
+ topic.bonus_time = ''
+ assert_nil topic.bonus_time
+ end
+end