Ability to assign issues to groups (#2964).
Option is disabled by default. It can be turned on in application settings. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6306 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -64,6 +64,15 @@ class IssueTest < ActiveSupport::TestCase
|
||||
issue.reload
|
||||
assert_equal 'PostgreSQL', issue.custom_value_for(field).value
|
||||
end
|
||||
|
||||
def test_create_with_group_assignment
|
||||
with_settings :issue_group_assignment => '1' do
|
||||
assert Issue.new(:project_id => 2, :tracker_id => 1, :author_id => 1, :subject => 'Group assignment', :assigned_to_id => 11).save
|
||||
issue = Issue.first(:order => 'id DESC')
|
||||
assert_kind_of Group, issue.assigned_to
|
||||
assert_equal Group.find(11), issue.assigned_to
|
||||
end
|
||||
end
|
||||
|
||||
def assert_visibility_match(user, issues)
|
||||
assert_equal issues.collect(&:id).sort, Issue.all.select {|issue| issue.visible?(user)}.collect(&:id).sort
|
||||
@@ -579,6 +588,16 @@ class IssueTest < ActiveSupport::TestCase
|
||||
# author is not a member of project anymore
|
||||
assert !copy.recipients.include?(copy.author.mail)
|
||||
end
|
||||
|
||||
def test_recipients_should_include_the_assigned_group_members
|
||||
group_member = User.generate_with_protected!
|
||||
group = Group.generate!
|
||||
group.users << group_member
|
||||
|
||||
issue = Issue.find(12)
|
||||
issue.assigned_to = group
|
||||
assert issue.recipients.include?(group_member.mail)
|
||||
end
|
||||
|
||||
def test_watcher_recipients_should_not_include_users_that_cannot_view_the_issue
|
||||
user = User.find(3)
|
||||
@@ -682,6 +701,28 @@ class IssueTest < ActiveSupport::TestCase
|
||||
assert_equal 1, assignable_user_ids.select {|i| i == user_id}.length, "User #{user_id} appears more or less than once"
|
||||
end
|
||||
end
|
||||
|
||||
context "with issue_group_assignment" do
|
||||
should "include groups" do
|
||||
issue = Issue.new(:project => Project.find(2))
|
||||
|
||||
with_settings :issue_group_assignment => '1' do
|
||||
assert_equal %w(Group User), issue.assignable_users.map {|a| a.class.name}.uniq.sort
|
||||
assert issue.assignable_users.include?(Group.find(11))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "without issue_group_assignment" do
|
||||
should "not include groups" do
|
||||
issue = Issue.new(:project => Project.find(2))
|
||||
|
||||
with_settings :issue_group_assignment => '0' do
|
||||
assert_equal %w(User), issue.assignable_users.map {|a| a.class.name}.uniq.sort
|
||||
assert !issue.assignable_users.include?(Group.find(11))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_create_should_send_email_notification
|
||||
|
||||
Reference in New Issue
Block a user