Sha256: f5268cba18dc63e4919fa546e6aa961f4d5e2d73e518b56068ac6641072b8e58
Contents?: true
Size: 1.05 KB
Versions: 7
Compression:
Stored size: 1.05 KB
Contents
# encoding: utf-8 require File.expand_path(File.dirname(__FILE__) + '/../../test_helper') require 'i18n/backend/fallbacks' class I18nFallbacksBackendTest < Test::Unit::TestCase def setup I18n.backend = I18n::Backend::Simple.new I18n.backend.meta_class.send(:include, I18n::Backend::Fallbacks) backend_store_translations(:en, :foo => 'Foo') end define_method "test: fallbacks for :de are [:de, :en]" do assert_equal [:de, :en], I18n.fallbacks[:de] end define_method "test: still returns the English translation as usual" do assert_equal 'Foo', I18n.t(:foo, :locale => :en) end define_method "test: returns the English translation for a missing German translation" do assert_equal 'Foo', I18n.t(:foo, :locale => :de) end define_method "test: raises I18n::MissingTranslationData exception when no translation was found" do assert_raises(I18n::MissingTranslationData) { I18n.t(:bar, :locale => :en, :raise => true) } assert_raises(I18n::MissingTranslationData) { I18n.t(:bar, :locale => :de, :raise => true) } end end
Version data entries
7 entries across 7 versions & 3 rubygems