diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2019-08-28 11:27:21 +0300 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2019-08-28 11:27:21 +0300 |
commit | 4576d55f44cfec6d6cab0df063ae9c26824222dd (patch) | |
tree | f66d553cb3f8489d76ba9789b55cb52d9e4fc721 /spec/models | |
parent | fe641cbd6a7d2e0598cdc34b50ad683ee078af84 (diff) | |
parent | 72544449cfb8e35b8c044f5bfd08a2fae2253408 (diff) |
Merge branch 'id-change-total-notes-calculation' into 'master'
Change the way totalNotes is calculated
See merge request gitlab-org/gitlab-ce!32191
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/concerns/noteable_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/concerns/noteable_spec.rb b/spec/models/concerns/noteable_spec.rb index e17b98536fa..929b5f52c7c 100644 --- a/spec/models/concerns/noteable_spec.rb +++ b/spec/models/concerns/noteable_spec.rb @@ -272,4 +272,22 @@ describe Noteable do expect(described_class.resolvable_types).to include('MergeRequest') end end + + describe '#capped_notes_count' do + context 'notes number < 10' do + it 'the number of notes is returned' do + expect(subject.capped_notes_count(10)).to eq(9) + end + end + + context 'notes number > 10' do + before do + create_list(:note, 2, project: project, noteable: subject) + end + + it '10 is returned' do + expect(subject.capped_notes_count(10)).to eq(10) + end + end + end end |