Sha256: 7dfae0dc3d55198923cd30ecc500c4667812cd356bd61a7e1e86b35a7bd2cd5b

Contents?: true

Size: 882 Bytes

Versions: 4

Compression:

Stored size: 882 Bytes

Contents

# encoding: utf-8
$:.unshift(File.expand_path(File.dirname(__FILE__) + '/../')); $:.uniq!
require 'test_helper'

class I18nBackendExceptionsTest < Test::Unit::TestCase
  def setup
    I18n.backend = I18n::Backend::Simple.new
  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

4 entries across 4 versions & 1 rubygems

Version Path
i18n-0.3.6 test/backend/exceptions_test.rb
i18n-0.3.6.pre test/backend/exceptions_test.rb
i18n-0.3.5 test/backend/exceptions_test.rb
i18n-0.3.4 test/backend/exceptions_test.rb