spec/i18n_tasks_spec.rb in i18n-tasks-0.1.8 vs spec/i18n_tasks_spec.rb in i18n-tasks-0.2.0

- old
+ new

@@ -3,12 +3,15 @@ describe 'rake i18n' do describe 'missing' do it 'detects missing or identical' do TestCodebase.capture_stderr do - TestCodebase.rake_result('i18n:missing').should be_i18n_keys %w(en.used_but_missing.a en.index.missing_symbol_key es.missing_in_es.a es.blank_in_es.a es.same_in_es.a) - end.should =~ /Missing keys and translations \(5\)/ + TestCodebase.rake_result('i18n:missing').should be_i18n_keys %w( + en.used_but_missing.a en.missing_symbol_key en.relative.index.missing + es.missing_in_es.a es.blank_in_es.a es.same_in_es.a + ) + end.should =~ /Missing keys and translations \(6\)/ end end describe 'unused' do it 'detects unused' do @@ -16,14 +19,24 @@ TestCodebase.rake_result('i18n:unused').should be_i18n_keys %w(unused.a unused.numeric unused.plural) end.should =~ /Unused i18n keys \(3\)/ end end - describe 'prefill' do - it 'prefills from en' do + describe 'normalize' do + it 'moves keys to the corresponding files as per data.write' do + TestCodebase.in_test_app_dir { + File.exists?('config/locales/devise.en.yml').should be_false + TestCodebase.rake_result('i18n:normalize') + YAML.load_file('config/locales/devise.en.yml')['en']['devise']['a'].should == 'EN_TEXT' + } + end + end + + describe 'fill:' do + it 'with_base' do TestCodebase.in_test_app_dir { YAML.load_file('config/locales/es.yml')['es']['missing_in_es'].should be_nil } - TestCodebase.rake_result('i18n:prefill') + TestCodebase.rake_result('i18n:fill:with_base') TestCodebase.in_test_app_dir { YAML.load_file('config/locales/es.yml')['es']['missing_in_es']['a'].should == 'EN_TEXT' YAML.load_file('config/locales/devise.en.yml')['en']['devise']['a'].should == 'EN_TEXT' YAML.load_file('config/locales/devise.es.yml')['es']['devise']['a'].should == 'ES_TEXT' } @@ -45,10 +58,16 @@ 'missing_in_es' => {'a' => v}, 'same_in_es' => {'a' => v}, 'ignore_eq_base_all' => {'a' => v}, 'ignore_eq_base_es' => {'a' => v}, 'blank_in_es' => {'a' => v}, - 'relative' => {'index' => {'title' => v}}, + 'relative' => { + 'index' => { + 'title' => v, + 'description' => v, + 'summary' => v, + } + }, 'numeric' => {'a' => v_num}, 'plural' => {'a' => {'one' => v, 'other' => "%{count} #{v}s"}}, 'devise' => {'a' => v} }.tap { |r| gen = r["bench"] = {}