Add i18n spec
Joel AZEMAR
committed Apr 01, 2014
commit d0877cad41ca67328ca9e7188e2312ca3d9b5957
Showing 13
changed files with
88 additions
and 12 deletions
.coveralls.yml
+1
-0
| @@ | @@ -0,0 +1 @@ |
| + | repo_token: K7iSITlpmmpgh2uanmudoO5Hv62coULxy |
| \ No newline at end of file | |
.travis.yml
+4
-0
| @@ | @@ -0,0 +1,4 @@ |
| + | language: ruby |
| + | rvm: |
| + | - 2.0.0 |
| + | - 2.1.1 |
| \ No newline at end of file | |
Gemfile
+1
-1
| @@ | @@ -4,5 +4,5 @@ gemspec |
| group :test do | |
| gem 'pry' | |
| - | # gem 'coveralls', require: false |
| + | gem 'coveralls', require: false |
| end | |
Gemfile.lock
+24
-0
| @@ | @@ -40,9 +40,16 @@ GEM |
| chunky_png (~> 1.2) | |
| fssm (>= 0.2.7) | |
| sass (~> 3.2.17) | |
| + | coveralls (0.7.0) |
| + | multi_json (~> 1.3) |
| + | rest-client |
| + | simplecov (>= 0.7) |
| + | term-ansicolor |
| + | thor |
| crack (0.4.2) | |
| safe_yaml (~> 1.0.0) | |
| diff-lcs (1.2.5) | |
| + | docile (1.1.3) |
| dragonfly (0.9.15) | |
| multi_json (~> 1.0) | |
| rack | |
| @@ | @@ -60,6 +67,10 @@ GEM |
| json (~> 1.8) | |
| multi_xml (>= 0.5.2) | |
| i18n (0.6.9) | |
| + | i18n-spec (0.4.1) |
| + | iso |
| + | iso (0.2.1) |
| + | i18n |
| json (1.8.1) | |
| launchy (2.4.2) | |
| addressable (~> 2.3) | |
| @@ | @@ -114,6 +125,8 @@ GEM |
| rb-inotify (0.9.3) | |
| ffi (>= 0.5.0) | |
| redcarpet (3.0.0) | |
| + | rest-client (1.6.7) |
| + | mime-types (>= 1.16) |
| rspec (2.14.1) | |
| rspec-core (~> 2.14.0) | |
| rspec-expectations (~> 2.14.0) | |
| @@ | @@ -124,6 +137,11 @@ GEM |
| rspec-mocks (2.14.6) | |
| safe_yaml (1.0.1) | |
| sass (3.2.18) | |
| + | simplecov (0.8.2) |
| + | docile (~> 1.1.0) |
| + | multi_json |
| + | simplecov-html (~> 0.8.0) |
| + | simplecov-html (0.8.0) |
| slop (3.5.0) | |
| sprockets (2.12.0) | |
| hike (~> 1.2) | |
| @@ | @@ -134,8 +152,12 @@ GEM |
| sprockets (~> 2.0) | |
| tilt (~> 1.1) | |
| stringex (2.0.11) | |
| + | term-ansicolor (1.3.0) |
| + | tins (~> 1.0) |
| + | thor (0.18.1) |
| tilt (1.4.1) | |
| timers (1.1.0) | |
| + | tins (1.0.0) |
| tzinfo (0.3.39) | |
| vcr (2.9.0) | |
| webmock (1.8.11) | |
| @@ | @@ -150,6 +172,8 @@ PLATFORMS |
| DEPENDENCIES | |
| Steam! | |
| bundler (~> 1.5) | |
| + | coveralls |
| + | i18n-spec |
| launchy | |
| pry | |
| rack-test | |
locomotivecms_steam.gemspec
+1
-0
| @@ | @@ -24,6 +24,7 @@ Gem::Specification.new do |spec| |
| spec.add_development_dependency 'vcr' | |
| spec.add_development_dependency 'webmock' | |
| spec.add_development_dependency 'rack-test' | |
| + | spec.add_development_dependency 'i18n-spec' |
| spec.add_dependency 'rack-cache', '~> 1.1' | |
| spec.add_dependency 'sprockets', '~> 2.0' | |
spec/locales/locales_spec.rb
+22
-0
| @@ | @@ -0,0 +1,22 @@ |
| + | require 'spec_helper' |
| + | |
| + | describe "#locales" do |
| + | |
| + | Dir.glob('config/locales/**/*.yml').each do |locale_file| |
| + | describe "#{locale_file}" do |
| + | it_behaves_like 'my valid locale file' do |
| + | let(:locale_file) { locale_file } |
| + | end |
| + | end |
| + | |
| + | unless locale_file == 'config/locales/en.yml' |
| + | describe "#{locale_file}", pending: 'need to be fixed' do |
| + | it_behaves_like 'complete translation of' do |
| + | let(:locale_target) { locale_file } |
| + | end |
| + | end |
| + | end |
| + | |
| + | end |
| + | |
| + | end |
spec/spec_helper.rb
+3
-5
| @@ | @@ -1,12 +1,10 @@ |
| require_relative '../lib/steam' | |
| - | require 'rspec' |
| - | require 'launchy' |
| require 'pry' | |
| + | require 'i18n-spec' |
| + | require 'rspec' |
| - | Dir["#{File.expand_path('../support', __FILE__)}/*.rb"].each do |file| |
| - | require file |
| - | end |
| + | require_relative 'support' |
| RSpec.configure do |c| | |
| c.filter_run focused: true | |
spec/support.rb
+4
-0
| @@ | @@ -0,0 +1,4 @@ |
| + | require_relative 'support/helpers' |
| + | require_relative 'support/matchers/hash' |
| + | require_relative 'support/examples/matching_locale' |
| + | require_relative 'support/examples/locale_file' |
| \ No newline at end of file | |
spec/support/examples/locale_file.rb
+14
-0
| @@ | @@ -0,0 +1,14 @@ |
| + | shared_examples_for 'my valid locale file' do |
| + | let(:local_file) { 'config/locales/app/en.yml' } |
| + | |
| + | subject { locale_file } |
| + | |
| + | it { should be_parseable } |
| + | it { should have_a_valid_locale } |
| + | |
| + | # it { should have_valid_pluralization_keys } |
| + | # it { should_not have_missing_pluralization_keys } |
| + | # it { should have_one_top_level_namespace } |
| + | # it { should be_named_like_top_level_namespace } |
| + | # it { should_not have_legacy_interpolations } |
| + | end |
| \ No newline at end of file | |
spec/support/examples/matching_locale.rb
+8
-0
| @@ | @@ -0,0 +1,8 @@ |
| + | shared_examples_for 'complete translation of' do |
| + | let(:locale_source) { 'config/locales/en.yml' } |
| + | let(:locale_target) { 'config/locales/fr.yml' } |
| + | |
| + | subject { locale_source } |
| + | |
| + | it { should be_a_complete_translation_of locale_target } |
| + | end |
spec/support/helpers.rb
+1
-1
| @@ | @@ -14,7 +14,7 @@ module Spec |
| Locomotive::Steam::Logger.setup(path, false) | |
| reader = Locomotive::Mounter::Reader::FileSystem.instance | |
| reader.run!(path: path) | |
| - | |
| + | |
| Locomotive::Steam::Server.new(reader, disable_listen: true) | |
| end | |
spec/support/matchers.rb
+0
-5
| @@ | @@ -1,5 +0,0 @@ |
| - | RSpec::Matchers.define :have_key_with_value do |key, expected| |
| - | match do |actual| |
| - | actual[key] == expected |
| - | end |
| - | end |
| \ No newline at end of file | |
spec/support/matchers/hash.rb
+5
-0
| @@ | @@ -0,0 +1,5 @@ |
| + | RSpec::Matchers.define :have_key_with_value do |key, expected| |
| + | match do |actual| |
| + | actual[key] == expected |
| + | end |
| + | end |
| \ No newline at end of file | |