Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2017-12-21 04:34:35 +0300
committerMatija Čupić <matteeyah@gmail.com>2017-12-21 04:34:35 +0300
commit8c449310e245083e72513ec3addd0d2355333127 (patch)
treea9ca028f0f19cab55e9d3d8afeffd58cc85bf192 /spec/services/notes/destroy_service_spec.rb
parent52b4a74a73cbd0b13d46d0bcd9b063e36b520f05 (diff)
parent5d8d72f18e9329978987fcb046467ceacd13c3ab (diff)
Merge branch 'master' into refactor-cluster-show-pagerefactor-cluster-show-page
Diffstat (limited to 'spec/services/notes/destroy_service_spec.rb')
-rw-r--r--spec/services/notes/destroy_service_spec.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/spec/services/notes/destroy_service_spec.rb b/spec/services/notes/destroy_service_spec.rb
index c9a99a43edb..64445be560e 100644
--- a/spec/services/notes/destroy_service_spec.rb
+++ b/spec/services/notes/destroy_service_spec.rb
@@ -1,15 +1,25 @@
require 'spec_helper'
describe Notes::DestroyService do
+ set(:project) { create(:project, :public) }
+ set(:issue) { create(:issue, project: project) }
+ let(:user) { issue.author }
+
describe '#execute' do
it 'deletes a note' do
- project = create(:project)
- issue = create(:issue, project: project)
note = create(:note, project: project, noteable: issue)
- described_class.new(project, note.author).execute(note)
+ described_class.new(project, user).execute(note)
expect(project.issues.find(issue.id).notes).not_to include(note)
end
+
+ it 'updates the todo counts for users with todos for the note' do
+ note = create(:note, project: project, noteable: issue)
+ create(:todo, note: note, target: issue, user: user, author: user, project: project)
+
+ expect { described_class.new(project, user).execute(note) }
+ .to change { user.todos_pending_count }.from(1).to(0)
+ end
end
end