diff options
author | Tarmo Tänav <tarmo@itech.ee> | 2008-10-07 14:23:05 +0300 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-10-09 01:19:02 +0100 |
commit | d69b4b7bea28fcab04f61afe381e06fa8e37b429 (patch) | |
tree | eb58b3068cbe3a76e79a0c373f1458e4d05ab083 /activesupport/test | |
parent | 0dea211f44d85e9c28963784286838bfa6c343f9 (diff) | |
download | rails-d69b4b7bea28fcab04f61afe381e06fa8e37b429.tar.gz rails-d69b4b7bea28fcab04f61afe381e06fa8e37b429.tar.bz2 rails-d69b4b7bea28fcab04f61afe381e06fa8e37b429.zip |
Made i18n simple backend able to store false values (and not confuse them with nil or lack of value)
Implemented support.array.skip_last_comma i18n key for
Array#to_sentence, this also tests the ability to store false.
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/i18n_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activesupport/test/i18n_test.rb b/activesupport/test/i18n_test.rb index 4b17e3c523..db5bd5e088 100644 --- a/activesupport/test/i18n_test.rb +++ b/activesupport/test/i18n_test.rb @@ -72,4 +72,20 @@ class I18nTest < Test::Unit::TestCase def test_time_pm assert_equal 'pm', I18n.translate(:'time.pm') end + + def test_sentence_connector + assert_equal 'and', I18n.translate(:'support.array.sentence_connector') + end + + def test_skip_last_comma + assert_equal false, I18n.translate(:'support.array.skip_last_comma') + end + + def test_to_sentence + assert_equal 'a, b, and c', %w[a b c].to_sentence + I18n.backend.store_translations 'en-US', :support => { :array => { :skip_last_comma => true } } + assert_equal 'a, b and c', %w[a b c].to_sentence + ensure + I18n.backend.store_translations 'en-US', :support => { :array => { :skip_last_comma => false } } + end end |