Forum: Rails I18n i18n full_message testing problem

2f4da0b00002db5629dcaade6a8cdfc2?d=identicon&s=25 Michal Burak (michalb82)
on 2009-11-17 14:47
Hi.

Rails version 2.3.4

----------- Running a functional test: --------------

Exception: translation missing: pl, activerecord, errors, models, user,
attributes, email, email_short
app/views/users/new.pl.html.erb:3

    1: <h1>Rejestracja nowego użytkownika</h1>
    2:
    3: <%= error_messages_for :user %>
    4: <% form_for :user, :url => users_path do |f| -%>
    5:
    6: <p><label for="login">Nazwa użytkownika
<%=req_field%></label><br/>

    app/views/users/new.pl.html.erb:3
    app/controllers/users_controller.rb:59:in `create'
    /test/functional/users_controller_test.rb:91:in `create_user'
    /test/functional/users_controller_test.rb:53:in
`test_should_require_email_on_signup'
    /test/functional/users_controller_test.rb:52:in
`test_should_require_email_on_signup'
    /usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
    /usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
    /usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
    /usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
    /usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
    /usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
    /usr/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in
`run_suite'
    /home/wojtek/workspace_galileo/.metadata/.plugins/org.rubypeople.rdt.testunit/ruby/RemoteTestRunner.rb:117:in
`start_mediator'
    /home/wojtek/workspace_galileo/.metadata/.plugins/org.rubypeople.rdt.testunit/ruby/RemoteTestRunner.rb:62:in
`start'
    /home/wojtek/workspace_galileo/.metadata/.plugins/org.rubypeople.rdt.testunit/ruby/RemoteTestRunner.rb:328

-------------- My model users.rb ------------------

validates_length_of       :email,    :within => 3..100, :too_short =>
:email_short, :too_long => :email_long


---------  My translations in pl.yml  -------------

The below works when I use the application the standard way through WWW.
This does not get read only within test environment.

pl:
(...)
  activerecord:
    (...)
    errors:
      (...)
      full_messages:
        email_short: "my message 1 {{count}}"
        email_long: "my message 2 {{count}}"

(...)


---------------- QUESTION -------------------------

How do I avoid this testing error? I am not using this translation node
" pl, activerecord, errors, models, user, attributes, email,
email_short" but a full_mesage instead (cos I need a specific message,
not a {attribute} {message} pair, it will not work in my language).

Any help appreciated.
This topic is locked and can not be replied to.