##// END OF EJS Templates
Fixed that the reminder email excludes issues assigned to groups (#11723)....
Fixed that the reminder email excludes issues assigned to groups (#11723). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10335 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r9579:0523ac387b82
r10152:197a14a82e3e
Show More
group_test.rb
130 lines | 4.0 KiB | text/x-ruby | RubyLexer
Jean-Philippe Lang
User groups branch merged....
r2755 # Redmine - project management software
Jean-Philippe Lang
Copyright update....
r9453 # Copyright (C) 2006-2012 Jean-Philippe Lang
Jean-Philippe Lang
User groups branch merged....
r2755 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces from test/unit/group_test.rb....
r6622 #
Jean-Philippe Lang
User groups branch merged....
r2755 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from test/unit/group_test.rb....
r6622 #
Jean-Philippe Lang
User groups branch merged....
r2755 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jean-Baptiste Barth
Use absolute paths in test/**/* requires for Ruby 1.9.2 compatibility. #4050...
r4395 require File.expand_path('../../test_helper', __FILE__)
Jean-Philippe Lang
User groups branch merged....
r2755
Eric Davis
Upgraded to Rails 2.3.4 (#3597)...
r2773 class GroupTest < ActiveSupport::TestCase
Toshi MARUYAMA
Rails3: replace "all" fixtures at test/unit/group_test.rb...
r7391 fixtures :projects, :trackers, :issue_statuses, :issues,
:enumerations, :users, :issue_categories,
:projects_trackers,
:roles,
:member_roles,
:members,
:enabled_modules,
:workflows,
:groups_users
Jean-Philippe Lang
User groups branch merged....
r2755
Toshi MARUYAMA
use set_language_if_valid instead of I18n.locale at unit group test (#9795)...
r8115 include Redmine::I18n
Jean-Philippe Lang
User groups branch merged....
r2755 def test_create
Jean-Philippe Lang
Replaced group[lastname] parameter with group[name]....
r9562 g = Group.new(:name => 'New group')
Jean-Philippe Lang
User groups branch merged....
r2755 assert g.save
Jean-Philippe Lang
Replaced group[lastname] parameter with group[name]....
r9562 g.reload
assert_equal 'New group', g.name
Jean-Philippe Lang
User groups branch merged....
r2755 end
Toshi MARUYAMA
remove trailing white-spaces from test/unit/group_test.rb....
r6622
Jean-Philippe Lang
Fixed: Unrelated error message when creating a group with an invalid name (#9795)....
r8111 def test_blank_name_error_message
Toshi MARUYAMA
use set_language_if_valid instead of I18n.locale at unit group test (#9795)...
r8115 set_language_if_valid 'en'
Jean-Philippe Lang
Fixed: Unrelated error message when creating a group with an invalid name (#9795)....
r8111 g = Group.new
assert !g.save
assert_include "Name can't be blank", g.errors.full_messages
end
Toshi MARUYAMA
add unit test of group blank name in French (#9795)...
r8116 def test_blank_name_error_message_fr
set_language_if_valid 'fr'
str = "Nom doit \xc3\xaatre renseign\xc3\xa9(e)"
str.force_encoding('UTF-8') if str.respond_to?(:force_encoding)
g = Group.new
assert !g.save
assert_include str, g.errors.full_messages
end
Jean-Philippe Lang
REST Api for Groups (#8981)....
r9575 def test_group_roles_should_be_given_to_added_user
Jean-Philippe Lang
User groups branch merged....
r2755 group = Group.find(11)
user = User.find(9)
project = Project.first
Toshi MARUYAMA
remove trailing white-spaces from test/unit/group_test.rb....
r6622
Jean-Philippe Lang
User groups branch merged....
r2755 Member.create!(:principal => group, :project => project, :role_ids => [1, 2])
group.users << user
assert user.member_of?(project)
end
Toshi MARUYAMA
remove trailing white-spaces from test/unit/group_test.rb....
r6622
Jean-Philippe Lang
REST Api for Groups (#8981)....
r9575 def test_new_roles_should_be_given_to_existing_user
Jean-Philippe Lang
User groups branch merged....
r2755 group = Group.find(11)
user = User.find(9)
project = Project.first
Toshi MARUYAMA
remove trailing white-spaces from test/unit/group_test.rb....
r6622
Jean-Philippe Lang
User groups branch merged....
r2755 group.users << user
m = Member.create!(:principal => group, :project => project, :role_ids => [1, 2])
assert user.member_of?(project)
end
Toshi MARUYAMA
remove trailing white-spaces from test/unit/group_test.rb....
r6622
Jean-Philippe Lang
REST Api for Groups (#8981)....
r9575 def test_user_roles_should_updated_when_updating_user_ids
group = Group.find(11)
user = User.find(9)
project = Project.first
Member.create!(:principal => group, :project => project, :role_ids => [1, 2])
group.user_ids = [user.id]
group.save!
assert User.find(9).member_of?(project)
group.user_ids = [1]
group.save!
assert !User.find(9).member_of?(project)
end
def test_user_roles_should_updated_when_updating_group_roles
Jean-Philippe Lang
User groups branch merged....
r2755 group = Group.find(11)
user = User.find(9)
project = Project.first
group.users << user
m = Member.create!(:principal => group, :project => project, :role_ids => [1])
assert_equal [1], user.reload.roles_for_project(project).collect(&:id).sort
Toshi MARUYAMA
remove trailing white-spaces from test/unit/group_test.rb....
r6622
Jean-Philippe Lang
User groups branch merged....
r2755 m.role_ids = [1, 2]
assert_equal [1, 2], user.reload.roles_for_project(project).collect(&:id).sort
Toshi MARUYAMA
remove trailing white-spaces from test/unit/group_test.rb....
r6622
Jean-Philippe Lang
User groups branch merged....
r2755 m.role_ids = [2]
assert_equal [2], user.reload.roles_for_project(project).collect(&:id).sort
Toshi MARUYAMA
remove trailing white-spaces from test/unit/group_test.rb....
r6622
Jean-Philippe Lang
User groups branch merged....
r2755 m.role_ids = [1]
assert_equal [1], user.reload.roles_for_project(project).collect(&:id).sort
end
Jean-Philippe Lang
REST Api for Groups (#8981)....
r9575 def test_user_memberships_should_be_removed_when_removing_group_membership
Jean-Philippe Lang
User groups branch merged....
r2755 assert User.find(8).member_of?(Project.find(5))
Member.find_by_project_id_and_user_id(5, 10).destroy
assert !User.find(8).member_of?(Project.find(5))
end
Jean-Philippe Lang
REST Api for Groups (#8981)....
r9575 def test_user_roles_should_be_removed_when_removing_user_from_group
Jean-Philippe Lang
User groups branch merged....
r2755 assert User.find(8).member_of?(Project.find(5))
Jean-Philippe Lang
Test failure due to a regression in Rails 3.2.5....
r9579 User.find(8).groups = []
Jean-Philippe Lang
User groups branch merged....
r2755 assert !User.find(8).member_of?(Project.find(5))
end
Toshi MARUYAMA
remove trailing white-spaces from test/unit/group_test.rb....
r6622
Jean-Philippe Lang
Ability to assign issues to groups (#2964)....
r6186 def test_destroy_should_unassign_issues
group = Group.first
Issue.update_all(["assigned_to_id = ?", group.id], 'id = 1')
Toshi MARUYAMA
remove trailing white-spaces from test/unit/group_test.rb....
r6622
Jean-Philippe Lang
Ability to assign issues to groups (#2964)....
r6186 assert group.destroy
assert group.destroyed?
Toshi MARUYAMA
remove trailing white-spaces from test/unit/group_test.rb....
r6622
Jean-Philippe Lang
Ability to assign issues to groups (#2964)....
r6186 assert_equal nil, Issue.find(1).assigned_to_id
end
Jean-Philippe Lang
User groups branch merged....
r2755 end