| Class | I18nSimpleBackendTranslateTest |
| In: |
vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb
|
| Parent: | Test::Unit::TestCase |
# File vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb, line 144
144: def test_given_no_keys_it_returns_the_default
145: assert_equal 'default', @backend.translate('en', nil, :default => 'default')
146: end
# File vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb, line 162
162: def test_translate_an_array_of_keys_translates_all_of_them
163: assert_equal %w(bar baz), @backend.translate('en', [:bar, :baz], :scope => [:foo])
164: end
# File vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb, line 171
171: def test_translate_calls_interpolate
172: @backend.expects(:interpolate).with 'en', 'bar', {}
173: @backend.translate 'en', :bar, :scope => [:foo]
174: end
# File vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb, line 176
176: def test_translate_calls_interpolate_including_count_as_a_value
177: @backend.expects(:interpolate).with 'en', 'bar', {:count => 1}
178: @backend.translate 'en', :bar, :scope => [:foo], :count => 1
179: end
# File vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb, line 139
139: def test_translate_calls_lookup_with_locale_given
140: @backend.expects(:lookup).with('de', :bar, [:foo]).returns 'bar'
141: @backend.translate 'de', :bar, :scope => [:foo]
142: end
# File vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb, line 166
166: def test_translate_calls_pluralize
167: @backend.expects(:pluralize).with 'en', 'bar', 1
168: @backend.translate 'en', :bar, :scope => [:foo], :count => 1
169: end
# File vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb, line 148
148: def test_translate_given_a_symbol_as_a_default_translates_the_symbol
149: assert_equal 'bar', @backend.translate('en', nil, :scope => [:foo], :default => :bar)
150: end
# File vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb, line 152
152: def test_translate_given_an_array_as_default_uses_the_first_match
153: assert_equal 'bar', @backend.translate('en', :does_not_exist, :scope => [:foo], :default => [:does_not_exist_2, :bar])
154: end
# File vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb, line 156
156: def test_translate_given_an_array_of_inexistent_keys_it_raises_missing_translation_data
157: assert_raise I18n::MissingTranslationData do
158: @backend.translate('en', :does_not_exist, :scope => [:foo], :default => [:does_not_exist_2, :does_not_exist_3])
159: end
160: end
# File vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb, line 181
181: def test_translate_given_nil_as_a_locale_raises_an_argument_error
182: assert_raise(I18n::InvalidLocale){ @backend.translate nil, :bar }
183: end