summaryrefslogtreecommitdiff
path: root/spec/models/note_spec.rb
diff options
context:
space:
mode:
authorJarka Kadlecova <jarka@gitlab.com>2017-01-05 14:36:06 +0100
committerJarka Kadlecova <jarka@gitlab.com>2017-01-18 18:38:17 -0500
commitd6b11dafd37e78c12c982c42f274928293cdfa53 (patch)
treee20c62bc3b11b77e366bce2251146d5f5ec86e0c /spec/models/note_spec.rb
parent270dc22658424ee7f279db99e56c6fc69acd3eb7 (diff)
downloadgitlab-ce-d6b11dafd37e78c12c982c42f274928293cdfa53.tar.gz
Support notes without project
Diffstat (limited to 'spec/models/note_spec.rb')
-rw-r--r--spec/models/note_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index 310fecd8a5c..ddd62d7f0e6 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -52,6 +52,19 @@ describe Note, models: true do
subject { create(:note) }
it { is_expected.to be_valid }
end
+
+ context 'when project is missing for a project related note' do
+ subject { build(:note, project: nil, noteable: build_stubbed(:issue)) }
+ it { is_expected.to be_invalid }
+ end
+
+ context 'when noteable is a personal snippet' do
+ subject { create(:note_on_personal_snippet) }
+
+ it 'is valid without project' do
+ is_expected.to be_valid
+ end
+ end
end
describe "Commit notes" do