Permalink
Browse files

add a test to make sure localize does not alter stored strings

  • Loading branch information...
1 parent c9bd180 commit 2634735bff9de4c49b9c059a66677ec503928573 Clemens Kofler and Sven Fuchs committed Nov 17, 2009
Showing with 10 additions and 3 deletions.
  1. +8 −1 test/api/localization/date.rb
  2. +2 −2 test/api/localization/lambda.rb
@@ -43,6 +43,13 @@ def test_localize_given_a_format_specified_as_a_proc_with_additional_options
assert_equal '1ter März 2008 (MEZ)', I18n.backend.localize('de', date, :long_ordinalized, :timezone => 'MEZ')
end
+ def test_localize_does_not_alter_the_stored_format_string
+ first_of_jan = I18n.backend.localize(:de, ::Date.parse('2009-01-01'), :long)
+ first_of_oct = I18n.backend.localize(:de, ::Date.parse('2009-10-01'), :long)
+ assert_equal '01. Januar 2009', first_of_jan
+ assert_equal '01. Oktober 2009', first_of_oct
+ end
+
def test_localize_given_no_format_it_does_not_fail
assert_nothing_raised{ I18n.backend.localize 'de', date }
end
@@ -62,4 +69,4 @@ def test_localize_object_raises_argument_error
end
end
end
-end
+end
@@ -14,7 +14,7 @@ def test_localize_uses_lambda_month_names
assert_match /марта/, I18n.backend.localize('ru', time, "%d %B %Y")
assert_match /Март/, I18n.backend.localize('ru', time, "%B %Y")
end
-
+
def test_localize_uses_lambda_abbr_day_names
assert_match /марта/, I18n.backend.localize('ru', time, "%d %b %Y")
assert_match /март/, I18n.backend.localize('ru', time, "%b %Y")
@@ -23,4 +23,4 @@ def test_localize_uses_lambda_abbr_day_names
end
end
end
-end
+end

0 comments on commit 2634735

Please sign in to comment.