comparison test/unit/initializers/patches_test.rb @ 507:0c939c159af4 redmine-1.2

Update to Redmine 1.2.1 on 1.2-stable branch (Redmine SVN rev 6270)
author Chris Cannam
date Thu, 14 Jul 2011 10:32:19 +0100
parents
children 433d4f72a19b
comparison
equal deleted inserted replaced
441:cbce1fd3b1b7 507:0c939c159af4
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