Skip to content

Commit

Permalink
directly include the module to Simple instead of the metaclass in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Fuchs committed Nov 14, 2009
1 parent 2677208 commit 6b67759
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion test/backend/cache/cache_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class I18nCacheBackendTest < Test::Unit::TestCase
def setup
super
I18n.backend.meta_class.send(:include, I18n::Backend::Cache)
I18n::Backend::Simple.send(:include, I18n::Backend::Cache)
I18n.cache_store = ActiveSupport::Cache.lookup_store(:memory_store)
end

Expand Down
4 changes: 2 additions & 2 deletions test/backend/fallbacks/api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
module FallbacksSetup
def setup
super
I18n.backend.meta_class.send(:include, I18n::Backend::Fallbacks)
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
end

def test_uses_fallbacks
assert I18n.backend.meta_class.included_modules.include?(I18n::Backend::Fallbacks)
assert I18n::Backend::Simple.included_modules.include?(I18n::Backend::Fallbacks)
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/backend/fallbacks/fallbacks_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class I18nFallbacksBackendTest < Test::Unit::TestCase
def setup
I18n.backend = I18n::Backend::Simple.new
I18n.backend.meta_class.send(:include, I18n::Backend::Fallbacks)
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
backend_store_translations(:en, :foo => 'Foo')
end

Expand Down
4 changes: 2 additions & 2 deletions test/backend/pluralization/api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
module PluralizationSetup
def setup
super
I18n.backend.meta_class.send(:include, I18n::Backend::Pluralization)
I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
I18n.load_path << locales_dir + '/plurals.rb'
end

def test_uses_pluralization
assert I18n.backend.meta_class.included_modules.include?(I18n::Backend::Pluralization)
assert I18n::Backend::Simple.included_modules.include?(I18n::Backend::Pluralization)
end
end

Expand Down
4 changes: 2 additions & 2 deletions test/backend/pluralization/pluralization_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class I18nPluralizationBackendTest < Test::Unit::TestCase
def setup
I18n.backend = I18n::Backend::Simple.new
I18n.backend.meta_class.send(:include, I18n::Backend::Pluralization)
I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
@pluralizer = lambda { |n| n == 1 ? :one : n == 0 || (2..10).include?(n % 100) ? :few : (11..19).include?(n % 100) ? :many : :other }
backend_store_translations(:foo, :i18n => { :pluralize => @pluralizer })
@entry = { :zero => 'zero', :one => 'one', :few => 'few', :many => 'many', :other => 'other' }
Expand Down Expand Up @@ -36,4 +36,4 @@ def setup
@entry.delete(:zero)
assert_equal 'few', I18n.t(:count => 0, :default => @entry, :locale => :foo)
end
end
end
10 changes: 5 additions & 5 deletions test/gettext/backend_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class I18nGettextBackendTest < Test::Unit::TestCase
def setup
I18n.locale = :en
I18n.load_path = [locales_dir + '/de.po']
I18n.backend.meta_class.send(:include, I18n::Backend::Gettext)
I18n::Backend::Simple.send(:include, I18n::Backend::Gettext)
end

def teardown
I18n.load_path = nil
I18n.backend = nil
Expand All @@ -22,14 +22,14 @@ def test_backend_loads_po_file
I18n.backend.send(:init_translations)
assert I18n.backend.send(:translations)[:de][:"Axis\001Axis"]
end

def test_looks_up_translation
I18n.locale = :de
assert_equal 'Auto', _('car')
end

def test_pluralizes_entry
I18n.locale = :de
assert_equal 'Achsen', ngettext('Axis', 'Axis', 2)
end
end
end

0 comments on commit 6b67759

Please sign in to comment.