1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2025-03-19 21:04:35 +00:00

add test translate

This commit is contained in:
Adrien Waksberg 2016-11-12 16:54:41 +01:00
parent c01c795eca
commit 04e8a2cd0b
2 changed files with 32 additions and 0 deletions

31
test/test_translate.rb Normal file
View file

@ -0,0 +1,31 @@
#!/usr/bin/ruby
require 'yaml'
require 'test/unit'
class TestTranslate < Test::Unit::TestCase
def test_00_check_translate
missing = 0
Dir.glob('i18n/*.yml').each do |yaml|
lang = File.basename(yaml, '.yml')
translate = YAML.load_file(yaml)
`grep -r -o "I18n.t('.*')" bin/ lib/ | cut -d"'" -f2`.each_line do |line|
begin
t = translate[lang]
line.strip.split('.').each do |v|
t = t[v]
end
assert(!t.to_s.empty?)
rescue
puts "#{lang}.#{line}"
missing = 1
end
end
end
assert_equal(0, missing)
end
end

View file

@ -3,3 +3,4 @@
require_relative 'test_config.rb' require_relative 'test_config.rb'
require_relative 'test_item.rb' require_relative 'test_item.rb'
require_relative 'test_mpw.rb' require_relative 'test_mpw.rb'
require_relative 'test_translate.rb'