@@ -5,12 +5,12 | |||
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 |
# |
|
|
8 | # | |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 |
# |
|
|
13 | # | |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
@@ -24,27 +24,27 class GroupTest < ActiveSupport::TestCase | |||
|
24 | 24 | g = Group.new(:lastname => 'New group') |
|
25 | 25 | assert g.save |
|
26 | 26 | end |
|
27 | ||
|
27 | ||
|
28 | 28 | def test_roles_given_to_new_user |
|
29 | 29 | group = Group.find(11) |
|
30 | 30 | user = User.find(9) |
|
31 | 31 | project = Project.first |
|
32 | ||
|
32 | ||
|
33 | 33 | Member.create!(:principal => group, :project => project, :role_ids => [1, 2]) |
|
34 | 34 | group.users << user |
|
35 | 35 | assert user.member_of?(project) |
|
36 | 36 | end |
|
37 | ||
|
37 | ||
|
38 | 38 | def test_roles_given_to_existing_user |
|
39 | 39 | group = Group.find(11) |
|
40 | 40 | user = User.find(9) |
|
41 | 41 | project = Project.first |
|
42 | ||
|
42 | ||
|
43 | 43 | group.users << user |
|
44 | 44 | m = Member.create!(:principal => group, :project => project, :role_ids => [1, 2]) |
|
45 | 45 | assert user.member_of?(project) |
|
46 | 46 | end |
|
47 | ||
|
47 | ||
|
48 | 48 | def test_roles_updated |
|
49 | 49 | group = Group.find(11) |
|
50 | 50 | user = User.find(9) |
@@ -52,13 +52,13 class GroupTest < ActiveSupport::TestCase | |||
|
52 | 52 | group.users << user |
|
53 | 53 | m = Member.create!(:principal => group, :project => project, :role_ids => [1]) |
|
54 | 54 | assert_equal [1], user.reload.roles_for_project(project).collect(&:id).sort |
|
55 | ||
|
55 | ||
|
56 | 56 | m.role_ids = [1, 2] |
|
57 | 57 | assert_equal [1, 2], user.reload.roles_for_project(project).collect(&:id).sort |
|
58 | ||
|
58 | ||
|
59 | 59 | m.role_ids = [2] |
|
60 | 60 | assert_equal [2], user.reload.roles_for_project(project).collect(&:id).sort |
|
61 | ||
|
61 | ||
|
62 | 62 | m.role_ids = [1] |
|
63 | 63 | assert_equal [1], user.reload.roles_for_project(project).collect(&:id).sort |
|
64 | 64 | end |
@@ -74,14 +74,14 class GroupTest < ActiveSupport::TestCase | |||
|
74 | 74 | User.find(8).groups.clear |
|
75 | 75 | assert !User.find(8).member_of?(Project.find(5)) |
|
76 | 76 | end |
|
77 | ||
|
77 | ||
|
78 | 78 | def test_destroy_should_unassign_issues |
|
79 | 79 | group = Group.first |
|
80 | 80 | Issue.update_all(["assigned_to_id = ?", group.id], 'id = 1') |
|
81 | ||
|
81 | ||
|
82 | 82 | assert group.destroy |
|
83 | 83 | assert group.destroyed? |
|
84 | ||
|
84 | ||
|
85 | 85 | assert_equal nil, Issue.find(1).assigned_to_id |
|
86 | 86 | end |
|
87 | 87 | end |
General Comments 0
You need to be logged in to leave comments.
Login now