Class: I18nSimpleBackendApiTranslateTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Includes:
Tests::Backend::Api::Translation, Tests::Backend::Simple::Setup::Base
Defined in:
lib/vendor/i18n/test/backend/simple/api_test.rb

Instance Method Summary collapse

Methods included from Tests::Backend::Api::Translation

#test_given_no_keys_it_returns_the_default, #test_translate_an_array_of_keys_translates_all_of_them, #test_translate_default_with_scope_stays_in_scope_when_looking_up_the_symbol, #test_translate_given_a_symbol_as_a_default_translates_the_symbol, #test_translate_given_an_array_as_default_uses_the_first_match, #test_translate_given_an_array_of_inexistent_keys_it_raises_missing_translation_data, #test_translate_given_nil_as_a_locale_raises_an_argument_error, #test_translate_with_a_missing_key_and_no_default_raises_missing_translation_data, #translate

Methods included from Tests::Backend::Simple::Setup::Base

#setup, #teardown

Instance Method Details

#test_translate_calls_interpolateObject



30
31
32
33
# File 'lib/vendor/i18n/test/backend/simple/api_test.rb', line 30

def test_translate_calls_interpolate
  I18n.backend.expects(:interpolate).with 'en', 'bar', {}
  I18n.backend.translate 'en', :bar, :scope => [:foo]
end

#test_translate_calls_interpolate_including_count_as_a_valueObject



35
36
37
38
# File 'lib/vendor/i18n/test/backend/simple/api_test.rb', line 35

def test_translate_calls_interpolate_including_count_as_a_value
  I18n.backend.expects(:interpolate).with 'en', 'bar', {:count => 1}
  I18n.backend.translate 'en', :bar, :scope => [:foo], :count => 1
end

#test_translate_calls_lookup_with_locale_givenObject

implementation specific tests



20
21
22
23
# File 'lib/vendor/i18n/test/backend/simple/api_test.rb', line 20

def test_translate_calls_lookup_with_locale_given
  I18n.backend.expects(:lookup).with('de', :bar, [:foo], nil).returns 'bar'
  I18n.backend.translate 'de', :bar, :scope => [:foo]
end

#test_translate_calls_pluralizeObject



25
26
27
28
# File 'lib/vendor/i18n/test/backend/simple/api_test.rb', line 25

def test_translate_calls_pluralize
  I18n.backend.expects(:pluralize).with 'en', 'bar', 1
  I18n.backend.translate 'en', :bar, :scope => [:foo], :count => 1
end