Correct error message on group name #873

This commit is contained in:
Robert Mitwicki 2012-03-26 09:14:49 +02:00 committed by Felix Schäfer
parent 20a79124f7
commit c6af5c7982
2 changed files with 14 additions and 0 deletions

View File

@ -48,4 +48,9 @@ class Group < Principal
:conditions => ["#{Member.table_name}.user_id = ? AND #{MemberRole.table_name}.inherited_from IN (?)", user.id, member.member_role_ids]).each(&:destroy)
end
end
def self.human_attribute_name(attribute_name)
attribute_name = "name" if attribute_name == "lastname"
super(attribute_name)
end
end

View File

@ -16,11 +16,20 @@ require File.expand_path('../../test_helper', __FILE__)
class GroupTest < ActiveSupport::TestCase
fixtures :all
include Redmine::I18n
def test_create
g = Group.new(:lastname => 'New group')
assert g.save
end
def test_blank_name_error_message
set_language_if_valid 'en'
new_group = Group.new
assert !new_group.valid?
assert new_group.errors.full_messages.include? "Name can't be blank"
end
def test_roles_given_to_new_user
group = Group.find(11)
user = User.find(9)