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/models/issue_link_spec.rb')
-rw-r--r--spec/models/issue_link_spec.rb9
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