Sha256: ab0d40728df4d58c7f1395aecb770333365c40db66ee0004276218cfd068854a

Contents?: true

Size: 823 Bytes

Versions: 13

Compression:

Stored size: 823 Bytes

Contents

require 'test_helper'

class I18nTest < Zena::View::TestCase
  include Zena::Use::I18n::ViewMethods
  include Zena::Use::Refactor::ViewMethods # fquote
  include Zena::Use::I18n::ViewMethods # _
  include Zena::Use::Urls::ViewMethods # data_path

  def setup
    super
    I18n.locale = 'en'
  end

  def test_trans
    assert_equal 'yoba', _('yoba')
    assert_equal '%A, %B %d %Y', _('full_date')
    I18n.locale = 'fr'
    assert_equal '%A, %d %B %Y', _('full_date')
  end

  def test_check_lang_same
    I18n.locale = 'en'
    obj = secure!(Node) { nodes(:zena) }
    assert_equal 'en', obj.v_lang
    assert_no_match /\[en\]/, check_lang(obj)
  end

  def test_check_other_lang
    visitor.lang = 'es'
    I18n.locale = 'es'
    obj = secure!(Node) { nodes(:zena) }
    assert_match /\[en\]/, check_lang(obj)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
zena-0.16.9 test/unit/zena/use/i18n_test.rb
zena-0.16.8 test/unit/zena/use/i18n_test.rb
zena-0.16.7 test/unit/zena/use/i18n_test.rb
zena-0.16.6 test/unit/zena/use/i18n_test.rb
zena-0.16.5 test/unit/zena/use/i18n_test.rb
zena-0.16.4 test/unit/zena/use/i18n_test.rb
zena-0.16.3 test/unit/zena/use/i18n_test.rb
zena-0.16.2 test/unit/zena/use/i18n_test.rb
zena-0.16.1 test/unit/zena/use/i18n_test.rb
zena-0.16.0 test/unit/zena/use/i18n_test.rb
zena-0.15.2 test/unit/zena/use/i18n_test.rb
zena-0.15.1 test/unit/zena/use/i18n_test.rb
zena-0.15.0 test/unit/zena/use/i18n_test.rb