diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-02-18 19:12:52 -0200 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-02-20 12:12:05 -0200 |
commit | fc3f8a8ff75a09aae62b2a56c7f78fd9d21d2af3 (patch) | |
tree | 283974010e5b0caeafc2c91c864c30bbc27bd758 /spec | |
parent | 44656136475d8842628d0a1112aecc9ec412a16f (diff) | |
download | gitlab-ce-fc3f8a8ff75a09aae62b2a56c7f78fd9d21d2af3.tar.gz |
Ensure that we only have one task per issue/mr
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/task_service_spec.rb | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/spec/services/task_service_spec.rb b/spec/services/task_service_spec.rb index 75498514093..43022ca1604 100644 --- a/spec/services/task_service_spec.rb +++ b/spec/services/task_service_spec.rb @@ -45,13 +45,6 @@ describe TaskService, services: true do end describe '#update_issue' do - it 'marks pending tasks to the issue for the user as done' do - pending_task = create(:task, :assigned, user: john_doe, project: project, target: issue, author: author) - service.update_issue(issue, john_doe) - - expect(pending_task.reload).to be_done - end - it 'creates a task for each valid mentioned user' do service.update_issue(issue, author) @@ -101,6 +94,18 @@ describe TaskService, services: true do end end + describe '#mark_pending_tasks_as_done' do + it 'marks related pending tasks to the target for the user as done' do + first_task = create(:task, :assigned, user: john_doe, project: project, target: issue, author: author) + second_task = create(:task, :assigned, user: john_doe, project: project, target: issue, author: author) + + service.mark_pending_tasks_as_done(issue, john_doe) + + expect(first_task.reload).to be_done + expect(second_task.reload).to be_done + end + end + describe '#new_note' do let!(:first_task) { create(:task, :assigned, user: john_doe, project: project, target: issue, author: author) } let!(:second_task) { create(:task, :assigned, user: john_doe, project: project, target: issue, author: author) } @@ -112,28 +117,28 @@ describe TaskService, services: true do first_task = create(:task, :assigned, user: john_doe, project: project, target: issue, author: author) second_task = create(:task, :assigned, user: john_doe, project: project, target: issue, author: author) - service.new_note(note) + service.new_note(note, john_doe) expect(first_task.reload).to be_done expect(second_task.reload).to be_done end it 'mark related pending tasks to the noteable for the award note author as done' do - service.new_note(award_note) + service.new_note(award_note, john_doe) expect(first_task.reload).to be_done expect(second_task.reload).to be_done end it 'does not mark related pending tasks it is a system note' do - service.new_note(system_note) + service.new_note(system_note, john_doe) expect(first_task.reload).to be_pending expect(second_task.reload).to be_pending end it 'creates a task for each valid mentioned user' do - service.new_note(note) + service.new_note(note, john_doe) should_create_task(user: michael, target: issue, author: john_doe, action: Task::MENTIONED, note: note) should_create_task(user: author, target: issue, author: john_doe, action: Task::MENTIONED, note: note) @@ -173,13 +178,6 @@ describe TaskService, services: true do end describe '#update_merge_request' do - it 'marks pending tasks to the merge request for the user as done' do - pending_task = create(:task, :assigned, user: john_doe, project: project, target: mr_assigned, author: author) - service.update_merge_request(mr_assigned, john_doe) - - expect(pending_task.reload).to be_done - end - it 'creates a task for each valid mentioned user' do service.update_merge_request(mr_assigned, author) |