diff options
author | Lin Jen-Shin (godfat) <godfat@godfat.org> | 2018-01-05 16:52:06 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-01-05 16:52:06 +0000 |
commit | 33c5630b02a783a749cc0bf63474f643652cdeeb (patch) | |
tree | 0d30ab08be0f71e4317822f7a5a2dd13a5ad4fd7 /spec/lib | |
parent | b72af2b9c78527ea988bc6a69c62ec95645a6c48 (diff) | |
download | gitlab-ce-33c5630b02a783a749cc0bf63474f643652cdeeb.tar.gz |
Use --left-right and --max-count for counting diverging commits
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index faccc2c8e00..f94234f6010 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -1030,12 +1030,50 @@ describe Gitlab::Git::Repository, seed_helper: true do end end + context 'with max_count' do + it 'returns the number of commits with path ' do + options = { ref: 'master', max_count: 5 } + + expect(repository.count_commits(options)).to eq(5) + end + end + context 'with path' do it 'returns the number of commits with path ' do - options = { ref: 'master', path: "encoding" } + options = { ref: 'master', path: 'encoding' } + + expect(repository.count_commits(options)).to eq(2) + end + end + + context 'with option :from and option :to' do + it 'returns the number of commits ahead for fix-mode..fix-blob-path' do + options = { from: 'fix-mode', to: 'fix-blob-path' } expect(repository.count_commits(options)).to eq(2) end + + it 'returns the number of commits ahead for fix-blob-path..fix-mode' do + options = { from: 'fix-blob-path', to: 'fix-mode' } + + expect(repository.count_commits(options)).to eq(1) + end + + context 'with option :left_right' do + it 'returns the number of commits for fix-mode...fix-blob-path' do + options = { from: 'fix-mode', to: 'fix-blob-path', left_right: true } + + expect(repository.count_commits(options)).to eq([1, 2]) + end + + context 'with max_count' do + it 'returns the number of commits with path ' do + options = { from: 'fix-mode', to: 'fix-blob-path', left_right: true, max_count: 1 } + + expect(repository.count_commits(options)).to eq([1, 1]) + end + end + end end context 'with max_count' do |