diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2017-12-27 14:16:24 +0100 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2017-12-27 14:16:24 +0100 |
commit | 13932b0b12c91e9ddc17e0bbf3d7afa44b5e3fb1 (patch) | |
tree | ff8d0c5a508df47d9b7ab32d512714c53ec8ba4a /spec/lib/gitlab | |
parent | af490ea87b20bfa5062bf661abdeff9012d5884a (diff) | |
download | gitlab-ce-13932b0b12c91e9ddc17e0bbf3d7afa44b5e3fb1.tar.gz |
Add support for max_count option to Git::Repository#count_commitsfeature/add-max-count-to-count-commits-rpc
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index 0e4292026df..477bf0b8d68 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -1015,7 +1015,7 @@ describe Gitlab::Git::Repository, seed_helper: true do shared_examples 'extended commit counting' do context 'with after timestamp' do it 'returns the number of commits after timestamp' do - options = { ref: 'master', limit: nil, after: Time.iso8601('2013-03-03T20:15:01+00:00') } + options = { ref: 'master', after: Time.iso8601('2013-03-03T20:15:01+00:00') } expect(repository.count_commits(options)).to eq(25) end @@ -1023,7 +1023,7 @@ describe Gitlab::Git::Repository, seed_helper: true do context 'with before timestamp' do it 'returns the number of commits before timestamp' do - options = { ref: 'feature', limit: nil, before: Time.iso8601('2015-03-03T20:15:01+00:00') } + options = { ref: 'feature', before: Time.iso8601('2015-03-03T20:15:01+00:00') } expect(repository.count_commits(options)).to eq(9) end @@ -1031,11 +1031,19 @@ describe Gitlab::Git::Repository, seed_helper: true do context 'with path' do it 'returns the number of commits with path ' do - options = { ref: 'master', limit: nil, path: "encoding" } + options = { ref: 'master', path: "encoding" } expect(repository.count_commits(options)).to eq(2) end end + + context 'with max_count' do + it 'returns the number of commits up to the passed limit' do + options = { ref: 'master', max_count: 10, after: Time.iso8601('2013-03-03T20:15:01+00:00') } + + expect(repository.count_commits(options)).to eq(10) + end + end end context 'when Gitaly count_commits feature is enabled' do |