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
classiccms-0.7.5 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.7.4 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.7.3 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/i18n-0.6.1/test/backend/exceptions_test.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/i18n-0.6.2/test/backend/exceptions_test.rb
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/i18n-0.6.4/test/backend/exceptions_test.rb
challah-1.0.0 vendor/bundle/gems/i18n-0.6.4/test/backend/exceptions_test.rb
vagrant-shell-0.2.9 demo/templates/vendor/bundle/ruby/1.9.1/gems/i18n-0.6.4/test/backend/exceptions_test.rb
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/i18n-0.6.4/test/backend/exceptions_test.rb
vagrant-shell-0.2.8 demo/templates/vendor/bundle/ruby/1.9.1/gems/i18n-0.6.4/test/backend/exceptions_test.rb
classiccms-0.7.2 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
classiccms-0.7.1 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
swipe-rails-0.0.5 vendor/bundle/gems/i18n-0.6.1/test/backend/exceptions_test.rb
active_mailer-0.0.9 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/i18n-0.6.1/test/backend/exceptions_test.rb
active_mailer-0.0.8 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/i18n-0.6.1/test/backend/exceptions_test.rb
active_mailer-0.0.7 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/i18n-0.6.1/test/backend/exceptions_test.rb
active_mailer-0.0.6 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/i18n-0.6.1/test/backend/exceptions_test.rb
classiccms-0.7.0 vendor/bundle/gems/i18n-0.6.0/test/backend/exceptions_test.rb
font-awesome-rails-3.1.1.2 vendor/ruby/2.0.0/gems/i18n-0.6.4/test/backend/exceptions_test.rb
font-awesome-rails-3.1.1.2 vendor/ruby/1.9.1/gems/i18n-0.6.1/test/backend/exceptions_test.rb