summaryrefslogtreecommitdiff
path: root/spec/services/system_notes
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-13 06:09:37 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-13 06:09:37 +0000
commit0301a0cad0063d76b1607358dc6c711ea043fdda (patch)
tree894ac424a6fb370ad8dc5de4294cdc87f0ae164e /spec/services/system_notes
parentdcce066c5059c4df112dce4a9edf288d74aec48b (diff)
downloadgitlab-ce-0301a0cad0063d76b1607358dc6c711ea043fdda.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/system_notes')
-rw-r--r--spec/services/system_notes/issuables_service_spec.rb31
1 files changed, 21 insertions, 10 deletions
diff --git a/spec/services/system_notes/issuables_service_spec.rb b/spec/services/system_notes/issuables_service_spec.rb
index 228d69fda4e..c0aaa65971a 100644
--- a/spec/services/system_notes/issuables_service_spec.rb
+++ b/spec/services/system_notes/issuables_service_spec.rb
@@ -598,8 +598,8 @@ describe ::SystemNotes::IssuablesService do
context 'when mentioner is not a MergeRequest' do
it 'is falsey' do
mentioner = noteable.dup
- expect(service.cross_reference_disallowed?(mentioner))
- .to be_falsey
+
+ expect(service.cross_reference_disallowed?(mentioner)).to be_falsey
end
end
@@ -609,24 +609,35 @@ describe ::SystemNotes::IssuablesService do
it 'is truthy when noteable is in commits' do
expect(mentioner).to receive(:commits).and_return([noteable])
- expect(service.cross_reference_disallowed?(mentioner))
- .to be_truthy
+
+ expect(service.cross_reference_disallowed?(mentioner)).to be_truthy
end
it 'is falsey when noteable is not in commits' do
expect(mentioner).to receive(:commits).and_return([])
- expect(service.cross_reference_disallowed?(mentioner))
- .to be_falsey
+
+ expect(service.cross_reference_disallowed?(mentioner)).to be_falsey
end
end
context 'when notable is an ExternalIssue' do
+ let(:project) { create(:project) }
let(:noteable) { ExternalIssue.new('EXT-1234', project) }
- it 'is truthy' do
- mentioner = noteable.dup
- expect(service.cross_reference_disallowed?(mentioner))
- .to be_truthy
+ it 'is false with issue tracker supporting referencing' do
+ create(:jira_service, project: project)
+
+ expect(service.cross_reference_disallowed?(noteable)).to be_falsey
+ end
+
+ it 'is true with issue tracker not supporting referencing' do
+ create(:bugzilla_service, project: project)
+
+ expect(service.cross_reference_disallowed?(noteable)).to be_truthy
+ end
+
+ it 'is true without issue tracker' do
+ expect(service.cross_reference_disallowed?(noteable)).to be_truthy
end
end
end