Created
July 6, 2011 11:01
-
-
Save oriolgual/1067007 to your computer and use it in GitHub Desktop.
No more missing translations in Rails thanks to Cucumber!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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