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
dirty_history-0.6.7 dirty_history/ruby/1.9.1/gems/i18n-0.6.0/test/backend/exceptions_test.rb
dirty_history-0.6.6 dirty_history/ruby/1.9.1/gems/i18n-0.6.0/test/backend/exceptions_test.rb
dirty_history-0.6.5 dirty_history/ruby/1.9.1/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.6.3 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.6.2 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.6.1 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.6.0 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
challah-0.8.1 vendor/bundle/gems/i18n-0.6.1/test/backend/exceptions_test.rb
classiccms-0.5.17 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.5.16 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.5.15 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.5.14 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.5.13 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.5.12 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.5.11 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
challah-rolls-0.1.0 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
challah-rolls-0.1.0 vendor/bundle/gems/i18n-0.6.1/test/backend/exceptions_test.rb
challah-rolls-0.1.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
challah-0.8.0.pre vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
i18n-0.6.1 test/backend/exceptions_test.rb