Sha256: 893671cee6c4ae4ac66258c4d43762a35558f8150acd37ba6831c7fb6a009522

Contents?: true

Size: 1.39 KB

Versions: 76

Compression:

Stored size: 1.39 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

  test "exceptions: MissingInterpolationArgument message includes missing key, provided keys and full string" do
    exception = I18n::MissingInterpolationArgument.new('key', {:this => 'was given'}, 'string')
    assert_equal 'missing interpolation argument "key" in "string" ({:this=>"was given"} given)', exception.message
  end
end

Version data entries

76 entries across 69 versions & 21 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/i18n-0.6.9/test/backend/exceptions_test.rb