aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/date_time_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-05-28 05:55:27 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-05-28 05:55:27 +0000
commit6f6328787cb0ba61f7af1e733826b5ffcdd6a398 (patch)
treeca776c131c607cae0bf77bc8e8855f0ae417506c /activerecord/test/date_time_test.rb
parente5b3d4b3b53178fda008fc8638f52a526e717984 (diff)
downloadrails-6f6328787cb0ba61f7af1e733826b5ffcdd6a398.tar.gz
rails-6f6328787cb0ba61f7af1e733826b5ffcdd6a398.tar.bz2
rails-6f6328787cb0ba61f7af1e733826b5ffcdd6a398.zip
Test that DateTime are quoted as DateTime not Date. Closes #8364 [chas]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6878 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/date_time_test.rb')
-rw-r--r--activerecord/test/date_time_test.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/activerecord/test/date_time_test.rb b/activerecord/test/date_time_test.rb
new file mode 100644
index 0000000000..340026ecc3
--- /dev/null
+++ b/activerecord/test/date_time_test.rb
@@ -0,0 +1,31 @@
+require 'abstract_unit'
+require 'fixtures/topic'
+require 'fixtures/task'
+
+class DateTimeTest < Test::Unit::TestCase
+ def test_saves_both_date_and_time
+ now = 200.years.ago.to_datetime
+ task = Task.create!(:starting => now)
+ assert_equal now, Task.find(task.id).starting
+ end
+
+ 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