Skip to content

Instantly share code, notes, and snippets.

@futhr
Last active December 20, 2015 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save futhr/6041347 to your computer and use it in GitHub Desktop.
Save futhr/6041347 to your computer and use it in GitHub Desktop.
Standard locale testing for consistency using i18n-spec gem.
RSpec.describe 'locale:' do
Dir.glob('config/locales/*.yml') do |locale_file|
context locale_file do
it { is_expected.to be_parseable }
it { is_expected.to have_valid_pluralization_keys }
it { is_expected.not_to have_missing_pluralization_keys }
it { is_expected.to have_one_top_level_namespace }
it { is_expected.not_to have_legacy_interpolations }
it { is_expected.to have_a_valid_locale }
it { is_expected.to be_a_complete_translation_of 'config/locales/en.yml' }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment