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/note_spec.rb')
-rw-r--r--spec/models/note_spec.rb42
1 files changed, 31 insertions, 11 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index 4b574540500..013070f7be5 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -1482,6 +1482,7 @@ RSpec.describe Note do
end
it "expires cache for note's issue when note is destroyed" do
+ note.save!
expect_expiration(note.noteable)
note.destroy!
@@ -1643,17 +1644,6 @@ RSpec.describe Note do
match_query_count(1).for_model(DiffNotePosition))
end
end
-
- context 'when skip_notes_diff_include flag is disabled' do
- before do
- stub_feature_flags(skip_notes_diff_include: false)
- end
-
- it 'includes additional diff associations' do
- expect { subject.reload }.to match_query_count(1).for_model(NoteDiffFile).and(
- match_query_count(1).for_model(DiffNotePosition))
- end
- end
end
context 'when noteable can have diffs' do
@@ -1889,4 +1879,34 @@ RSpec.describe Note do
it { is_expected.to eq :read_internal_note }
end
end
+
+ describe '#exportable_record?' do
+ let_it_be(:user) { create(:user) }
+ let_it_be(:project) { create(:project, :private) }
+ let_it_be(:noteable) { create(:issue, project: project) }
+
+ subject { note.exportable_record?(user) }
+
+ context 'when not a system note' do
+ let(:note) { build(:note, noteable: noteable) }
+
+ it { is_expected.to be_truthy }
+ end
+
+ context 'with system note' do
+ let(:note) { build(:system_note, project: project, noteable: noteable) }
+
+ it 'returns `false` when the user cannot read the note' do
+ is_expected.to be_falsey
+ end
+
+ context 'when user can read the note' do
+ before do
+ project.add_developer(user)
+ end
+
+ it { is_expected.to be_truthy }
+ end
+ end
+ end
end