From eac8260b381999bf64917d3fe8a3afdf891698ce Mon Sep 17 00:00:00 2001 From: wvengen Date: Thu, 25 Jul 2013 14:46:25 +0200 Subject: [PATCH] add i18n tests --- Gemfile | 7 +++++++ Gemfile.lock | 7 +++++++ spec/i18n_spec.rb | 12 ++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 spec/i18n_spec.rb diff --git a/Gemfile b/Gemfile index 2e4afaa1..ba7bd657 100644 --- a/Gemfile +++ b/Gemfile @@ -70,6 +70,9 @@ end group :development, :test do gem 'ruby-prof' +end + +group :test do gem 'rspec-rails' gem 'factory_girl_rails', '~> 4.0' gem 'faker' @@ -77,6 +80,10 @@ group :development, :test do # webkit and poltergeist don't seem to work yet gem 'database_cleaner' gem 'simplecov', require: false + # need to include rspec components before i18n-spec or rake fails in test environment + gem 'rspec-core' + gem 'rspec-expectations' + gem 'i18n-spec' end # Gems left for backwards compatibility diff --git a/Gemfile.lock b/Gemfile.lock index 2faaccac..f6c33e69 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -118,9 +118,13 @@ GEM highline (1.6.19) hike (1.2.3) i18n (0.6.1) + i18n-spec (0.4.0) + iso inherited_resources (1.3.1) has_scope (~> 0.5.0) responders (~> 0.6) + iso (0.2.0) + i18n journey (1.0.4) jquery-rails (2.1.3) railties (>= 3.1.0, < 5.0) @@ -324,6 +328,7 @@ DEPENDENCIES factory_girl_rails (~> 4.0) faker haml-rails + i18n-spec inherited_resources jquery-rails kaminari @@ -336,6 +341,8 @@ DEPENDENCIES rails (~> 3.2.9) rails-settings-cached (= 0.2.4) resque + rspec-core + rspec-expectations rspec-rails ruby-prof sass-rails (~> 3.2.3) diff --git a/spec/i18n_spec.rb b/spec/i18n_spec.rb new file mode 100644 index 00000000..e07d74b9 --- /dev/null +++ b/spec/i18n_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' +require 'i18n-spec' + +Dir.glob('config/locales/*.yml').each do |locale_file| + describe "#{locale_file}" do + it_behaves_like 'a valid locale file', locale_file + # We're currently allowing both German and English as source language + # besides, we're using localeapp, so that it's ok if pull requests + # don't have this - a localapp pull will fix that right away. + #it { expect(locale_file).to be_a_subset_of 'config/locales/en.yml' } + end +end