diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /spec/models/issue_link_spec.rb | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) | |
download | gitlab-ce-7e9c479f7de77702622631cff2628a9c8dcbc627.tar.gz |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/models/issue_link_spec.rb')
-rw-r--r-- | spec/models/issue_link_spec.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/models/issue_link_spec.rb b/spec/models/issue_link_spec.rb index 00791d4a48b..ef41108ebea 100644 --- a/spec/models/issue_link_spec.rb +++ b/spec/models/issue_link_spec.rb @@ -27,7 +27,14 @@ RSpec.describe IssueLink do .with_message(/already related/) end - context 'self relation' do + it 'is not valid if an opposite link already exists' do + issue_link = build(:issue_link, source: subject.target, target: subject.source) + + expect(issue_link).to be_invalid + expect(issue_link.errors[:source]).to include('is already related to this issue') + end + + context 'when it relates to itself' do let(:issue) { create :issue } context 'cannot be validated' do |