Add spec to notify us when translations have invalid interpolation keys.

This commit is contained in:
Guo Xiang Tan 2017-06-19 11:13:23 +09:00
parent 48fb19d9e4
commit b9fbc95ef4

View File

@ -59,6 +59,16 @@ describe "i18n integrity checks" do
end
end
Dir["#{Rails.root}/config/locales/{client,server}.*.yml"].each do |path|
it "does not contain invalid interpolation keys for '#{path}'" do
matches = File.read(path).scan(/%\{([^a-zA-Z\s]+)\}|\{\{([^a-zA-Z\s]+)\}\}/)
matches.flatten!
matches.compact!
matches.uniq!
expect(matches).to eq([])
end
end
Dir["#{Rails.root}/config/locales/client.*.yml"].each do |path|
it "has valid client YAML for '#{path}'" do
yaml = YAML.load_file(path)