diff options
author | José Valim <jose.valim@gmail.com> | 2009-04-01 11:24:00 +0200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2009-04-05 21:08:14 +1200 |
commit | 1ab7c37671d7c0cd9d8698bd462916a7e6f95470 (patch) | |
tree | 0281185b8aaa208449538158106adedb7e964e9f /actionpack/test | |
parent | 42cdc7571d115c5eb4ece440001d221f24553100 (diff) | |
download | rails-1ab7c37671d7c0cd9d8698bd462916a7e6f95470.tar.gz rails-1ab7c37671d7c0cd9d8698bd462916a7e6f95470.tar.bz2 rails-1ab7c37671d7c0cd9d8698bd462916a7e6f95470.zip |
Object names with underscore do the wrong lookup in I18n on error_messages_for.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2390 state:committed]
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/active_record_helper_i18n_test.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/actionpack/test/template/active_record_helper_i18n_test.rb b/actionpack/test/template/active_record_helper_i18n_test.rb index 4b6e8ddcca..9d04c882c8 100644 --- a/actionpack/test/template/active_record_helper_i18n_test.rb +++ b/actionpack/test/template/active_record_helper_i18n_test.rb @@ -4,9 +4,12 @@ class ActiveRecordHelperI18nTest < Test::Unit::TestCase include ActionView::Helpers::ActiveRecordHelper attr_reader :request + def setup @object = stub :errors => stub(:count => 1, :full_messages => ['full_messages']) - @object_name = 'book' + @object_name = 'book_seller' + @object_name_without_underscore = 'book seller' + stubs(:content_tag).returns 'content_tag' I18n.stubs(:t).with(:'header', :locale => 'en', :scope => [:activerecord, :errors, :template], :count => 1, :model => '').returns "1 error prohibited this from being saved" @@ -37,8 +40,8 @@ class ActiveRecordHelperI18nTest < Test::Unit::TestCase end def test_error_messages_for_given_object_name_it_translates_object_name - I18n.expects(:t).with(:header, :locale => 'en', :scope => [:activerecord, :errors, :template], :count => 1, :model => @object_name).returns "1 error prohibited this #{@object_name} from being saved" - I18n.expects(:t).with(@object_name, :default => @object_name, :count => 1, :scope => [:activerecord, :models]).once.returns @object_name + I18n.expects(:t).with(:header, :locale => 'en', :scope => [:activerecord, :errors, :template], :count => 1, :model => @object_name_without_underscore).returns "1 error prohibited this #{@object_name_without_underscore} from being saved" + I18n.expects(:t).with(@object_name, :default => @object_name_without_underscore, :count => 1, :scope => [:activerecord, :models]).once.returns @object_name_without_underscore error_messages_for(:object => @object, :locale => 'en', :object_name => @object_name) end end |