Sha256: bca81c58af7d56a0db95e3ec1d8236003e51a0613112fa20b606b55dfb968701

Contents?: true

Size: 1.67 KB

Versions: 4

Compression:

Stored size: 1.67 KB

Contents

# encoding: utf-8
$:.unshift(File.expand_path(File.dirname(__FILE__) + '/../')); $:.uniq!
begin
  require 'rubygems'
  require 'active_support'
rescue LoadError
  puts "not testing with Cache enabled because active_support can not be found"
end

require 'test_helper'
require 'api'

class I18nAllFeaturesApiTest < Test::Unit::TestCase
  class Backend
    include I18n::Backend::Base
    include I18n::Backend::Cache
    include I18n::Backend::Metadata
    include I18n::Backend::Cascade
    include I18n::Backend::Fallbacks
    include I18n::Backend::Pluralization
    include I18n::Backend::Fast
    include I18n::Backend::InterpolationCompiler
  end

  def setup
    I18n.backend = I18n::Backend::Chain.new(Backend.new, I18n::Backend::Simple.new)
    I18n.cache_store = cache_store
    super
  end

  def teardown
    I18n.cache_store.clear
    I18n.cache_store = nil
    super
  end

  def cache_store
    ActiveSupport::Cache.lookup_store(:memory_store) if defined?(ActiveSupport) && defined?(ActiveSupport::Cache)
  end

  include Tests::Api::Basics
  include Tests::Api::Defaults
  include Tests::Api::Interpolation
  include Tests::Api::Link
  include Tests::Api::Lookup
  include Tests::Api::Pluralization
  include Tests::Api::Procs
  include Tests::Api::Localization::Date
  include Tests::Api::Localization::DateTime
  include Tests::Api::Localization::Time
  include Tests::Api::Localization::Procs

  test "make sure we use a Chain backend with an all features backend" do
    assert_equal I18n::Backend::Chain, I18n.backend.class
    assert_equal Backend, I18n.backend.backends.first.class
  end

  # links: test that keys stored on one backend can link to keys stored on another backend
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
i18n-0.3.6 test/api/all_features_test.rb
i18n-0.3.6.pre test/api/all_features_test.rb
i18n-0.3.5 test/api/all_features_test.rb
i18n-0.3.4 test/api/all_features_test.rb