diff options
Diffstat (limited to 'spec/services/todo_service_spec.rb')
-rw-r--r-- | spec/services/todo_service_spec.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/services/todo_service_spec.rb b/spec/services/todo_service_spec.rb index 7103cb0b66a..6e10d0281b7 100644 --- a/spec/services/todo_service_spec.rb +++ b/spec/services/todo_service_spec.rb @@ -628,12 +628,32 @@ RSpec.describe TodoService do stub_feature_flags(multiple_todos: true) end - it 'creates a todo even if user already has a pending todo' do + it 'creates a MENTIONED todo even if user already has a pending MENTIONED todo' do create(:todo, :mentioned, user: member, project: project, target: issue, author: author) expect { service.update_issue(issue, author) }.to change(member.todos, :count) end + it 'creates a DIRECTLY_ADDRESSED todo even if user already has a pending DIRECTLY_ADDRESSED todo' do + create(:todo, :directly_addressed, user: member, project: project, target: issue, author: author) + + issue.update!(description: "#{member.to_reference}, what do you think?") + + expect { service.update_issue(issue, author) }.to change(member.todos, :count) + end + + it 'creates an ASSIGNED todo even if user already has a pending MARKED todo' do + create(:todo, :marked, user: john_doe, project: project, target: assigned_issue, author: author) + + expect { service.reassigned_assignable(assigned_issue, author) }.to change(john_doe.todos, :count) + end + + it 'does not create an ASSIGNED todo if user already has an ASSIGNED todo' do + create(:todo, :assigned, user: john_doe, project: project, target: assigned_issue, author: author) + + expect { service.reassigned_assignable(assigned_issue, author) }.not_to change(john_doe.todos, :count) + end + it 'creates multiple todos if a user is assigned and mentioned in a new issue' do assigned_issue.description = mentions service.new_issue(assigned_issue, author) |