Sha256: 17501a9d518c33d5ea62481f9350d8985cffd431fdae1257052a54df78dda66e

Contents?: true

Size: 1.03 KB

Versions: 9

Compression:

Stored size: 1.03 KB

Contents

require 'test_helper'

class I18nLoadPathTest < I18n::TestCase
  def setup
    I18n.locale = :en
    I18n.backend = I18n::Backend::Simple.new
    store_translations(:en, :foo => {:bar => 'bar', :baz => 'baz'})
  end

  test "nested load paths do not break locale loading" do
    I18n.load_path = [[locales_dir + '/en.yml']]
    assert_equal "baz", I18n.t(:'foo.bar')
  end

  test "loading an empty yml file raises an InvalidLocaleData exception" do
    assert_raise I18n::InvalidLocaleData do
      I18n.load_path = [[locales_dir + '/invalid/empty.yml']]
      I18n.t(:'foo.bar', :default => "baz")
    end
  end

  test "loading an invalid yml file raises an InvalidLocaleData exception" do
    assert_raise I18n::InvalidLocaleData do
      I18n.load_path = [[locales_dir + '/invalid/syntax.yml']]
      I18n.t(:'foo.bar', :default => "baz")
    end
  end

  test "adding arrays of filenames to the load path does not break locale loading" do
    I18n.load_path << Dir[locales_dir + '/*.{rb,yml}']
    assert_equal "baz", I18n.t(:'foo.bar')
  end
end

Version data entries

9 entries across 4 versions & 4 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/i18n-0.6.11/test/i18n/load_path_test.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/i18n-0.6.11/test/i18n/load_path_test.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/i18n-0.6.11/test/i18n/load_path_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/i18n-0.6.11/test/i18n/load_path_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/i18n-0.6.11/test/i18n/load_path_test.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/i18n-0.6.11/test/i18n/load_path_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/i18n-0.6.11/test/i18n/load_path_test.rb
nanumfont-rails-0.1 vendor/bundle/ruby/2.1.0/gems/i18n-0.6.11/test/i18n/load_path_test.rb
i18n-0.6.11 test/i18n/load_path_test.rb