noosfero_i18n_test.rb
824 Bytes
require File.dirname(__FILE__) + '/../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?(File.join(Rails.root, 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