rspec - Rails i18n spec doesn't work -
In my train app, I use the Mars i18n_spec to add the rspec tests that check whether my i18n config files are correct or not.
The device file
is required 'spec_helper.rb' is required 'i18n-spec / tasks' Dir.glob (' config / locales / *. Yml '). Locale_file | Describe "# {Locale_file}" {subject.should_parseable} Errors in the results
../gems/i18n-spec-0.6. 0 / lib / i18n-spec / tasks.rb: 5: `` at the top (required) & gt; ': Undefined method for' namespace 'key: Object (NoMethodError) from ../gems/backports-3.3.3/ Lib / backports / tools.rb: 328: to `requirement' in ../gems/backports-3.3 .3 / lib / backports / tools.rb: 328: From `require_with_backports' to ../gems/activesupport-3.2. 21 / lib / active_support / dependencies.rb: 251: `Block 'is required. / Gems / activesupport-3.2.21 / lib / active_support / dependencies.rb: 236: IN' load_dependency '../gems / Activesupport-3.2.21 / lib / active_support / dependencies.rb: 251: to `requirement 'in ../ spec / selftest / i18n_spec.rb: 3: in` & lt; Top (required) & gt;
Why do you want to test if they are handy? If you put any I18n key in a unit / feature speck, your I18n files will be loaded and if yml files are not capable of parsing then throw a syntax error!
You will receive such a claim:
within (". Mod-header .login") {click_link I18n.t ('public.menu.login') } ("# Main-container H1"). The hold is Icontent.content I18n.t ('pages.login.title') Rail your yml files in this way And will parse. And if there are any errors then you will find them in your test output!
and such errors:
& lt; Psych :: SyntaxError: (your_project_path / config / locales /nl.yml): In the context of mapping values in the line & lt; Num & gt; Column & lt; Num & gt; & Gt; or
& lt; Psych :: SyntaxError: (your_project_path / config / locales / nl.yml): expected key not found when parsing a block & lt; Num & gt; Column & lt; Num & gt; & Gt;