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:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-12 00:05:59 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-12 00:05:59 +0300
commitac062237da66db75b22f5dab2cc5766ee62a44d1 (patch)
treeae5a7eb248ddbf5c8c32c29a269127a936356364 /spec/models/note_spec.rb
parent0dfbcd8f8b1587a7e10eb79940a8dc13bd72c664 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/note_spec.rb')
-rw-r--r--spec/models/note_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index 66e3c6d5e9d..989024dee60 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -70,6 +70,37 @@ describe Note do
is_expected.to be_valid
end
end
+
+ describe 'max notes limit' do
+ let_it_be(:noteable) { create(:issue) }
+ let_it_be(:existing_note) { create(:note, project: noteable.project, noteable: noteable) }
+
+ before do
+ stub_const('Noteable::MAX_NOTES_LIMIT', 1)
+ end
+
+ context 'when creating a system note' do
+ subject { build(:system_note, project: noteable.project, noteable: noteable) }
+
+ it { is_expected.to be_valid }
+ end
+
+ context 'when creating a user note' do
+ subject { build(:note, project: noteable.project, noteable: noteable) }
+
+ it { is_expected.not_to be_valid }
+ end
+
+ context 'when updating an existing note on a noteable that already exceeds the limit' do
+ subject { existing_note }
+
+ before do
+ create(:system_note, project: noteable.project, noteable: noteable)
+ end
+
+ it { is_expected.to be_valid }
+ end
+ end
end
describe "Commit notes" do