To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / .svn / pristine / 81 / 8152a8429a670810e05571a0d05bddd66f5b7e5e.svn-base @ 1297:0a574315af3e
History | View | Annotate | Download (1.54 KB)
| 1 |
# Redmine - project management software |
|---|---|
| 2 |
# Copyright (C) 2006-2011 Jean-Philippe Lang |
| 3 |
# |
| 4 |
# This program is free software; you can redistribute it and/or |
| 5 |
# modify it under the terms of the GNU General Public License |
| 6 |
# as published by the Free Software Foundation; either version 2 |
| 7 |
# of the License, or (at your option) any later version. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, |
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
# GNU General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License |
| 15 |
# along with this program; if not, write to the Free Software |
| 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 |
|
| 18 |
require File.expand_path('../../../test_helper', __FILE__)
|
| 19 |
|
| 20 |
class PatchesTest < ActiveSupport::TestCase |
| 21 |
include Redmine::I18n |
| 22 |
|
| 23 |
context "ActiveRecord::Base.human_attribute_name" do |
| 24 |
setup do |
| 25 |
Setting.default_language = 'en' |
| 26 |
end |
| 27 |
|
| 28 |
should "transform name to field_name" do |
| 29 |
assert_equal l('field_last_login_on'), ActiveRecord::Base.human_attribute_name('last_login_on')
|
| 30 |
end |
| 31 |
|
| 32 |
should "cut extra _id suffix for better validation" do |
| 33 |
assert_equal l('field_last_login_on'), ActiveRecord::Base.human_attribute_name('last_login_on_id')
|
| 34 |
end |
| 35 |
|
| 36 |
should "default to humanized value if no translation has been found (useful for custom fields)" do |
| 37 |
assert_equal 'Patch name', ActiveRecord::Base.human_attribute_name('Patch name')
|
| 38 |
end |
| 39 |
end |
| 40 |
end |