diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/models/diff_note_spec.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) | |
download | gitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/models/diff_note_spec.rb')
-rw-r--r-- | spec/models/diff_note_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
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 |