Sha256: 8a7518f6c6540ba199515f14a7a352bc2e6d4e423b879133075e02611817ac0d

Contents?: true

Size: 1.07 KB

Versions: 185

Compression:

Stored size: 1.07 KB

Contents

require 'test_helper'

class I18nBackendExceptionsTest < Test::Unit::TestCase
  def setup
    I18n.backend = I18n::Backend::Simple.new
  end

  test "throw message: MissingTranslation message from #translate includes the given scope and full key" do
    exception = catch(:exception) do
      I18n.t(:'baz.missing', :scope => :'foo.bar', :throw => true)
    end
    assert_equal "translation missing: en.foo.bar.baz.missing", exception.message
  end

  test "exceptions: MissingTranslationData message from #translate includes the given scope and full key" do
    begin
      I18n.t(:'baz.missing', :scope => :'foo.bar', :raise => true)
    rescue I18n::MissingTranslationData => exception
    end
    assert_equal "translation missing: en.foo.bar.baz.missing", exception.message
  end

  test "exceptions: MissingTranslationData message from #localize includes the given scope and full key" do
    begin
      I18n.l(Time.now, :format => :foo)
    rescue I18n::MissingTranslationData => exception
    end
    assert_equal "translation missing: en.time.formats.foo", exception.message
  end
end

Version data entries

185 entries across 162 versions & 26 rubygems

Version Path
challah-0.7.1 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.5.10 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.5.9 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
dirty_history-0.6.4 dirty_history/ruby/1.9.1/gems/i18n-0.6.0/test/backend/exceptions_test.rb
challah-0.7.0 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
challah-0.7.0.pre2 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.5.8 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
dirty_history-0.6.3 dirty_history/ruby/1.9.1/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.5.7 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.5.6 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.5.5 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
challah-0.7.0.pre vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.5.2 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.5.1 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.5.0 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.4.2 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.4.1 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.4.0 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.3.9 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
challah-0.6.2 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb