From 4bfc377ff62656879691c0a6fc03a4b2c534f42e Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Wed, 17 Feb 2016 14:36:37 -0200 Subject: Rename TaskService#mark_as_done to mark_pending_tasks_as_done --- app/services/issues/update_service.rb | 2 +- app/services/merge_requests/update_service.rb | 2 +- app/services/task_service.rb | 12 ++++++------ spec/services/task_service_spec.rb | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index 48645a8e558..9e39847dc54 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -6,7 +6,7 @@ module Issues def handle_changes(issue, options = {}) if have_changes?(issue, options) - task_service.mark_as_done(issue, current_user) + task_service.mark_pending_tasks_as_done(issue, current_user) end if issue.previous_changes.include?('milestone_id') diff --git a/app/services/merge_requests/update_service.rb b/app/services/merge_requests/update_service.rb index f9f4d9a4f27..38ae067877a 100644 --- a/app/services/merge_requests/update_service.rb +++ b/app/services/merge_requests/update_service.rb @@ -16,7 +16,7 @@ module MergeRequests def handle_changes(merge_request, options = {}) if have_changes?(merge_request, options) - task_service.mark_as_done(merge_request, current_user) + task_service.mark_pending_tasks_as_done(merge_request, current_user) end if merge_request.previous_changes.include?('target_branch') diff --git a/app/services/task_service.rb b/app/services/task_service.rb index 2d65eee854d..4c040ee0fff 100644 --- a/app/services/task_service.rb +++ b/app/services/task_service.rb @@ -19,7 +19,7 @@ class TaskService # * mark all pending tasks related to the target for the current user as done # def close_issue(issue, current_user) - mark_as_done(issue, current_user) + mark_pending_tasks_as_done(issue, current_user) end # When we reassign an issue we should: @@ -43,7 +43,7 @@ class TaskService # * mark all pending tasks related to the target for the current user as done # def close_merge_request(merge_request, current_user) - mark_as_done(merge_request, current_user) + mark_pending_tasks_as_done(merge_request, current_user) end # When we reassign a merge request we should: @@ -59,14 +59,14 @@ class TaskService # * mark all pending tasks related to the target for the current user as done # def merge_merge_request(merge_request, current_user) - mark_as_done(merge_request, current_user) + mark_pending_tasks_as_done(merge_request, current_user) end # When we mark a task as done we should: # # * mark all pending tasks related to the target for the user as done # - def mark_as_done(target, user) + def mark_pending_tasks_as_done(target, user) pending_tasks = pending_tasks_for(user, target.project, target) pending_tasks.update_all(state: :done) end @@ -78,7 +78,7 @@ class TaskService def new_note(note) # Skip system notes, like status changes and cross-references unless note.system - mark_as_done(note.noteable, note.author) + mark_pending_tasks_as_done(note.noteable, note.author) end end @@ -89,7 +89,7 @@ class TaskService def update_note(note, current_user) # Skip system notes, like status changes and cross-references unless note.system - mark_as_done(note.noteable, current_user) + mark_pending_tasks_as_done(note.noteable, current_user) end end diff --git a/spec/services/task_service_spec.rb b/spec/services/task_service_spec.rb index 8e78f4e242a..0cd0011b041 100644 --- a/spec/services/task_service_spec.rb +++ b/spec/services/task_service_spec.rb @@ -63,7 +63,7 @@ describe TaskService, services: true do end end - describe '#mark_as_done' do + describe '#mark_pending_tasks_as_done' do let!(:first_pending_task) do create(:pending_assigned_task, user: john_doe, project: project, target: assigned_issue, author: author) end @@ -73,7 +73,7 @@ describe TaskService, services: true do end it 'marks related pending tasks to the target for the user as done' do - service.mark_as_done(assigned_issue, john_doe) + service.mark_pending_tasks_as_done(assigned_issue, john_doe) expect(first_pending_task.reload).to be_done expect(second_pending_task.reload).to be_done -- cgit v1.2.1