summaryrefslogtreecommitdiffstats
path: root/test/unit/time_entry_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-14 18:04:16 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-14 18:04:16 +0000
commit88d847a1d51249236a57a2a5ddf2019e448b42c2 (patch)
treefc5993331669700f22877d310d517a60a466d678 /test/unit/time_entry_test.rb
parent7a35682cd9aca946ad37efc5e902d47f60536929 (diff)
downloadredmine-88d847a1d51249236a57a2a5ddf2019e448b42c2.tar.gz
redmine-88d847a1d51249236a57a2a5ddf2019e448b42c2.zip
Fixes TimeEntry#spent_on= so that datetimes don't get stored in SQLite3 (#7258).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4708 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/time_entry_test.rb')
-rw-r--r--test/unit/time_entry_test.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/unit/time_entry_test.rb b/test/unit/time_entry_test.rb
index ef4ad81b2..70774567e 100644
--- a/test/unit/time_entry_test.rb
+++ b/test/unit/time_entry_test.rb
@@ -48,6 +48,36 @@ class TimeEntryTest < ActiveSupport::TestCase
def test_hours_should_default_to_nil
assert_nil TimeEntry.new.hours
end
+
+ def test_spent_on_with_blank
+ c = TimeEntry.new
+ c.spent_on = ''
+ assert_nil c.spent_on
+ end
+
+ def test_spent_on_with_nil
+ c = TimeEntry.new
+ c.spent_on = nil
+ assert_nil c.spent_on
+ end
+
+ def test_spent_on_with_string
+ c = TimeEntry.new
+ c.spent_on = "2011-01-14"
+ assert_equal Date.parse("2011-01-14"), c.spent_on
+ end
+
+ def test_spent_on_with_date
+ c = TimeEntry.new
+ c.spent_on = Date.today
+ assert_equal Date.today, c.spent_on
+ end
+
+ def test_spent_on_with_time
+ c = TimeEntry.new
+ c.spent_on = Time.now
+ assert_equal Date.today, c.spent_on
+ end
context "#earilest_date_for_project" do
setup do