summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-16 20:26:36 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-16 20:26:36 +0000
commite4ce95c3a18496e8bc20787331d8f11c6b6b6e25 (patch)
treebf0895012fc2058c0b583c69295af8da76534f46 /test
parent4951676172b2545f409c0ff677c873338bc80be5 (diff)
downloadredmine-e4ce95c3a18496e8bc20787331d8f11c6b6b6e25.tar.gz
redmine-e4ce95c3a18496e8bc20787331d8f11c6b6b6e25.zip
Added a couple of new formats for the 'date format' setting.
Added a 'time format' setting. git-svn-id: http://redmine.rubyforge.org/svn/trunk@905 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/helpers/application_helper_test.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb
index b3ed9102e..06446d15e 100644
--- a/test/unit/helpers/application_helper_test.rb
+++ b/test/unit/helpers/application_helper_test.rb
@@ -75,4 +75,32 @@ class ApplicationHelperTest < HelperTestCase
text = "{{hello_world}}"
assert textilizable(text).match(/Hello world!/)
end
+
+ def test_date_format_default
+ today = Date.today
+ Setting.date_format = ''
+ assert_equal l_date(today), format_date(today)
+ end
+
+ def test_date_format
+ today = Date.today
+ Setting.date_format = '%d %m %Y'
+ assert_equal today.strftime('%d %m %Y'), format_date(today)
+ end
+
+ def test_time_format_default
+ now = Time.now
+ Setting.date_format = ''
+ Setting.time_format = ''
+ assert_equal l_datetime(now), format_time(now)
+ assert_equal l_time(now), format_time(now, false)
+ end
+
+ def test_time_format
+ now = Time.now
+ Setting.date_format = '%d %m %Y'
+ Setting.time_format = '%H %M'
+ assert_equal now.strftime('%d %m %Y %H %M'), format_time(now)
+ assert_equal now.strftime('%H %M'), format_time(now, false)
+ end
end