Skip to content

Instantly share code, notes, and snippets.

@oriolgual
Created July 6, 2011 11:01
Show Gist options
  • Save oriolgual/1067007 to your computer and use it in GitHub Desktop.
Save oriolgual/1067007 to your computer and use it in GitHub Desktop.
No more missing translations in Rails thanks to Cucumber!
# features/support/missing_translations.rb
missing_translations = []
After do |scenario|
temp = all('.translation_missing')
if temp.any?
missing_translations << temp.to_a
raise "Missing Translation"
end
end
at_exit do
if missing_translations.any?
keys = missing_translations.flatten.map do |translation|
translation[:title]
end.uniq
puts '-------------------------------------------------------------'
puts "There are #{keys.length} untranslated strings. Please check your locales:"
puts '-------------------------------------------------------------'
puts "\n"
keys.each do |translation|
puts translation
end
puts "\n"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment