summaryrefslogtreecommitdiffstats
path: root/test/unit/journal_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-01-04 15:38:52 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-01-04 15:38:52 +0000
commit9adb0c61a903eae9930a84510b25a8ed156ed4f8 (patch)
tree23387cb547c98f57ca28f3f31e473e007300c0f5 /test/unit/journal_test.rb
parent9a66463ff8464e5780923f0f9476524fdbc6d978 (diff)
downloadredmine-9adb0c61a903eae9930a84510b25a8ed156ed4f8.tar.gz
redmine-9adb0c61a903eae9930a84510b25a8ed156ed4f8.zip
Make sure that dates are stored as YYYY-MM-DD in journal details (#12713).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11117 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/journal_test.rb')
-rw-r--r--test/unit/journal_test.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/unit/journal_test.rb b/test/unit/journal_test.rb
index bec497f46..a331c7e0f 100644
--- a/test/unit/journal_test.rb
+++ b/test/unit/journal_test.rb
@@ -154,4 +154,25 @@ class JournalTest < ActiveSupport::TestCase
# Admin should see issues on private projects that he does not belong to
assert journals.detect {|journal| !journal.issue.project.is_public?}
end
+
+ def test_details_should_normalize_dates
+ j = JournalDetail.create!(:old_value => Date.parse('2012-11-03'), :value => Date.parse('2013-01-02'))
+ j.reload
+ assert_equal '2012-11-03', j.old_value
+ assert_equal '2013-01-02', j.value
+ end
+
+ def test_details_should_normalize_true_values
+ j = JournalDetail.create!(:old_value => true, :value => true)
+ j.reload
+ assert_equal '1', j.old_value
+ assert_equal '1', j.value
+ end
+
+ def test_details_should_normalize_false_values
+ j = JournalDetail.create!(:old_value => false, :value => false)
+ j.reload
+ assert_equal '0', j.old_value
+ assert_equal '0', j.value
+ end
end