summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/git/repository_spec.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2019-02-06 09:54:53 +0000
committerJohn Cai <jcai@gitlab.com>2019-02-11 10:44:06 -0800
commitb502d90a9f0521247e8c42f1ed586f6f4a52507a (patch)
treed6808a5da1a71e6ceb6f6bf29d6b5b03a8248c7b /spec/lib/gitlab/git/repository_spec.rb
parent1f2f38f59a719f7dae110835b8beb3d94fdcd94d (diff)
downloadgitlab-ce-b502d90a9f0521247e8c42f1ed586f6f4a52507a.tar.gz
Adapt that diverging commits could be just one baradd-client-for-count-diverging-commits
refactors the ui for diverging commits so that it's only a single bar instead of two separate bars
Diffstat (limited to 'spec/lib/gitlab/git/repository_spec.rb')
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index aef4e433439..8a9e78ba3c3 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -302,6 +302,7 @@ describe Gitlab::Git::Repository, :seed_helper do
before do
repository.create_branch('left-branch', 'master')
repository.create_branch('right-branch', 'master')
+
left.times do
new_commit_edit_new_file_on_branch(repository_rugged, 'encoding/CHANGELOG', 'left-branch', 'some more content for a', 'some stuff')
end
@@ -319,10 +320,10 @@ describe Gitlab::Git::Repository, :seed_helper do
it 'returns the correct count bounding at max_count' do
branch_a_sha = repository_rugged.branches['left-branch'].target.oid
branch_b_sha = repository_rugged.branches['right-branch'].target.oid
- expect(
- repository.diverging_commit_count(
- branch_a_sha, branch_b_sha, max_count: 1000)
- ).to eq(expected)
+
+ count = repository.diverging_commit_count(branch_a_sha, branch_b_sha, max_count: 1000)
+
+ expect(count).to eq(expected)
end
end
end
@@ -341,6 +342,7 @@ describe Gitlab::Git::Repository, :seed_helper do
before do
repository.create_branch('left-branch', 'master')
repository.create_branch('right-branch', 'master')
+
left.times do
new_commit_edit_new_file_on_branch(repository_rugged, 'encoding/CHANGELOG', 'left-branch', 'some more content for a', 'some stuff')
end
@@ -358,7 +360,9 @@ describe Gitlab::Git::Repository, :seed_helper do
it 'returns the correct count bounding at max_count' do
branch_a_sha = repository_rugged.branches['left-branch'].target.oid
branch_b_sha = repository_rugged.branches['right-branch'].target.oid
+
results = repository.diverging_commit_count(branch_a_sha, branch_b_sha, max_count: max_count)
+
expect(results[0] + results[1]).to eq(max_count)
end
end