cirandas.net

ref: master

test/unit/noosfero_i18n_test.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require_relative "../test_helper"

class NoosferoI18nTest < ActiveSupport::TestCase

  def setup
    @locale = I18n.locale
  end

  def teardown
    I18n.locale = @locale
  end

  Noosfero.available_locales.each do |locale|

    next if locale == 'en'

    should('have locale file for %s' % locale) do
      locale_file = 'config/locales/%s.yml' % locale
      assert File.exists?(Rails.root.join(locale_file)), "#{locale_file} not found"
    end

    should('be able to translate activerecord errors header to %s' % locale) do
      I18n.locale = locale
      translation = I18n.translate 'activerecord.errors.template.header.one'
      assert translation !~ /translation missing/, "Missing translation for activerecord.errors.template.header.one to #{Noosfero.locales[locale]}"
    end

  end

end