Skip to content

Commit

Permalink
add test with group for auto watch assignee
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermeindl committed Mar 15, 2024
1 parent 67e604a commit a4fd664
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions test/unit/issue_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require File.expand_path '../../test_helper', __FILE__

class IssueTest < Additionals::TestCase
fixtures :projects, :users, :members, :member_roles, :roles,
fixtures :projects, :users, :groups_users, :members, :member_roles, :roles,
:trackers, :projects_trackers,
:enabled_modules,
:issue_statuses, :issue_categories, :workflows,
Expand Down Expand Up @@ -168,7 +168,7 @@ def test_disabled_auto_assigned_to
end

def test_assigned_to_should_add_watcher
user = User.first
user = users :users_001
user.pref.auto_watch_on = ['issue_assigned']
user.pref.save
issue = Issue.new author_id: user.id, project_id: 1, tracker_id: 1, assigned_to_id: user.id, subject: 'test_assigned_should_add_watcher'
Expand All @@ -177,4 +177,17 @@ def test_assigned_to_should_add_watcher
assert_save issue
end
end

def test_assigned_to_with_group_should_not_add_watcher
group = Group.find 10
Member.create! project_id: 1, principal: group, role_ids: [1]

with_settings issue_group_assignment: '1' do
issue = Issue.new author_id: 1, project_id: 1, tracker_id: 1, assigned_to_id: group.id, subject: 'test_assigned_should_add_watcher'

assert_no_difference 'Watcher.count' do
assert_save issue
end
end
end
end

0 comments on commit a4fd664

Please sign in to comment.