Use ApplicationRecord instead of ActiveRecord::Base (#38975).

Patch by Minoru Maeda (@maeda-m).

git-svn-id: https://svn.redmine.org/redmine/trunk@22619 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2024-01-23 11:52:38 +00:00
parent 28061fbcdb
commit 13aeb797cf
63 changed files with 118 additions and 86 deletions

View File

@@ -27,16 +27,16 @@ class PatchesTest < ActiveSupport::TestCase
Setting.default_language = 'en'
end
test "ActiveRecord::Base.human_attribute_name should transform name to field_name" do
assert_equal l('field_last_login_on'), ActiveRecord::Base.human_attribute_name('last_login_on')
test "ApplicationRecord.human_attribute_name should transform name to field_name" do
assert_equal l('field_last_login_on'), ApplicationRecord.human_attribute_name('last_login_on')
end
test "ActiveRecord::Base.human_attribute_name should cut extra _id suffix for better validation" do
assert_equal l('field_last_login_on'), ActiveRecord::Base.human_attribute_name('last_login_on_id')
test "ApplicationRecord.human_attribute_name should cut extra _id suffix for better validation" do
assert_equal l('field_last_login_on'), ApplicationRecord.human_attribute_name('last_login_on_id')
end
test "ActiveRecord::Base.human_attribute_name should default to humanized value if no translation has been found (useful for custom fields)" do
assert_equal 'Patch name', ActiveRecord::Base.human_attribute_name('Patch name')
test "ApplicationRecord.human_attribute_name should default to humanized value if no translation has been found (useful for custom fields)" do
assert_equal 'Patch name', ApplicationRecord.human_attribute_name('Patch name')
end
test 'ActionView::Helpers::FormHelper.date_field should add max=9999-12-31 to limit year value to 4 digits by default' do