diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/services/discussions | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/services/discussions')
-rw-r--r-- | spec/services/discussions/resolve_service_spec.rb | 14 | ||||
-rw-r--r-- | spec/services/discussions/unresolve_service_spec.rb | 32 |
2 files changed, 46 insertions, 0 deletions
diff --git a/spec/services/discussions/resolve_service_spec.rb b/spec/services/discussions/resolve_service_spec.rb index 42c4ef52741..2e30455eb0a 100644 --- a/spec/services/discussions/resolve_service_spec.rb +++ b/spec/services/discussions/resolve_service_spec.rb @@ -24,6 +24,13 @@ RSpec.describe Discussions::ResolveService do expect(discussion).to be_resolved end + it 'tracks thread resolve usage data' do + expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter) + .to receive(:track_resolve_thread_action).with(user: user) + + service.execute + end + it 'executes the notification service' do expect_next_instance_of(MergeRequests::ResolvedDiscussionNotificationService) do |instance| expect(instance).to receive(:execute).with(discussion.noteable) @@ -101,6 +108,13 @@ RSpec.describe Discussions::ResolveService do service.execute end + it 'does not track thread resolve usage data' do + expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter) + .not_to receive(:track_resolve_thread_action).with(user: user) + + service.execute + end + it 'does not schedule an auto-merge' do expect(AutoMergeProcessWorker).not_to receive(:perform_async) diff --git a/spec/services/discussions/unresolve_service_spec.rb b/spec/services/discussions/unresolve_service_spec.rb new file mode 100644 index 00000000000..6298a00a474 --- /dev/null +++ b/spec/services/discussions/unresolve_service_spec.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +require "spec_helper" + +RSpec.describe Discussions::UnresolveService do + describe "#execute" do + let_it_be(:project) { create(:project, :repository) } + let_it_be(:user) { create(:user, developer_projects: [project]) } + let_it_be(:merge_request) { create(:merge_request, :merge_when_pipeline_succeeds, source_project: project) } + let(:discussion) { create(:diff_note_on_merge_request, noteable: merge_request, project: project).to_discussion } + + let(:service) { described_class.new(discussion, user) } + + before do + project.add_developer(user) + discussion.resolve!(user) + end + + it "unresolves the discussion" do + service.execute + + expect(discussion).not_to be_resolved + end + + it "counts the unresolve event" do + expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter) + .to receive(:track_unresolve_thread_action).with(user: user) + + service.execute + end + end +end |