From 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 17 Dec 2020 11:59:07 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-7-stable-ee --- spec/models/diff_note_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'spec/models/diff_note_spec.rb') diff --git a/spec/models/diff_note_spec.rb b/spec/models/diff_note_spec.rb index f7ce44f7281..215c733f26b 100644 --- a/spec/models/diff_note_spec.rb +++ b/spec/models/diff_note_spec.rb @@ -38,6 +38,26 @@ RSpec.describe DiffNote do it_behaves_like 'a valid diff positionable note' do subject { build(:diff_note_on_commit, project: project, commit_id: commit_id, position: position) } end + + it "is not valid when noteable is empty" do + note = build(:diff_note_on_merge_request, project: project, noteable: nil) + + note.valid? + + expect(note.errors[:noteable]).to include("doesn't support new-style diff notes") + end + + context 'when importing' do + it "does not check if it's supported" do + note = build(:diff_note_on_merge_request, project: project, noteable: nil) + note.importing = true + note.valid? + + expect(note.errors.full_messages).not_to include( + "Noteable doesn't support new-style diff notes" + ) + end + end end describe "#position=" do -- cgit v1.2.1