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:
Diffstat (limited to 'spec/services/issues/move_service_spec.rb')
-rw-r--r--spec/services/issues/move_service_spec.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/services/issues/move_service_spec.rb b/spec/services/issues/move_service_spec.rb
index ee809aabac0..ccd4dd4231b 100644
--- a/spec/services/issues/move_service_spec.rb
+++ b/spec/services/issues/move_service_spec.rb
@@ -6,7 +6,7 @@ describe Issues::MoveService do
let(:user) { create(:user) }
let(:author) { create(:user) }
let(:title) { 'Some issue' }
- let(:description) { 'Some issue description' }
+ let(:description) { "Some issue description with mention to #{user.to_reference}" }
let(:group) { create(:group, :private) }
let(:sub_group_1) { create(:group, :private, parent: group) }
let(:sub_group_2) { create(:group, :private, parent: group) }
@@ -36,6 +36,9 @@ describe Issues::MoveService do
end
context 'issue movable' do
+ let!(:note_with_mention) { create(:note, noteable: old_issue, author: author, project: old_project, note: "note with mention #{user.to_reference}") }
+ let!(:note_with_no_mention) { create(:note, noteable: old_issue, author: author, project: old_project, note: "note without mention") }
+
include_context 'user can move issue'
context 'generic issue' do
@@ -94,6 +97,15 @@ describe Issues::MoveService do
it 'moves the award emoji' do
expect(old_issue.award_emoji.first.name).to eq new_issue.reload.award_emoji.first.name
end
+
+ context 'when issue has notes with mentions' do
+ it 'saves user mentions with actual mentions for new issue' do
+ expect(new_issue.user_mentions.where(note_id: nil).first.mentioned_users_ids).to match_array([user.id])
+ expect(new_issue.user_mentions.where.not(note_id: nil).first.mentioned_users_ids).to match_array([user.id])
+ expect(new_issue.user_mentions.where.not(note_id: nil).count).to eq 1
+ expect(new_issue.user_mentions.count).to eq 2
+ end
+ end
end
context 'issue with assignee' do