diff options
Diffstat (limited to 'spec/lib/gitlab/gitaly_client/commit_service_spec.rb')
-rw-r--r-- | spec/lib/gitlab/gitaly_client/commit_service_spec.rb | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/spec/lib/gitlab/gitaly_client/commit_service_spec.rb b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb index 29a5ef0d2fc..45a25ccfc88 100644 --- a/spec/lib/gitlab/gitaly_client/commit_service_spec.rb +++ b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::GitalyClient::CommitService do +RSpec.describe Gitlab::GitalyClient::CommitService do let(:project) { create(:project, :repository) } let(:storage_name) { project.repository_storage } let(:relative_path) { project.disk_path + '.git' } @@ -290,7 +290,8 @@ describe Gitlab::GitalyClient::CommitService do request = Gitaly::FindCommitsRequest.new( repository: repository_message, disable_walk: true, - order: 'NONE' + order: 'NONE', + global_options: Gitaly::GlobalOptions.new(literal_pathspecs: false) ) expect_any_instance_of(Gitaly::CommitService::Stub).to receive(:find_commits) @@ -303,7 +304,8 @@ describe Gitlab::GitalyClient::CommitService do request = Gitaly::FindCommitsRequest.new( repository: repository_message, disable_walk: true, - order: 'TOPO' + order: 'TOPO', + global_options: Gitaly::GlobalOptions.new(literal_pathspecs: false) ) expect_any_instance_of(Gitaly::CommitService::Stub).to receive(:find_commits) @@ -317,7 +319,8 @@ describe Gitlab::GitalyClient::CommitService do repository: repository_message, disable_walk: true, order: 'NONE', - author: "Billy Baggins <bilbo@shire.com>" + author: "Billy Baggins <bilbo@shire.com>", + global_options: Gitaly::GlobalOptions.new(literal_pathspecs: false) ) expect_any_instance_of(Gitaly::CommitService::Stub).to receive(:find_commits) @@ -338,7 +341,8 @@ describe Gitlab::GitalyClient::CommitService do revision: (options[:revision] || '').dup.force_encoding(Encoding::ASCII_8BIT), path: (options[:path] || '').dup.force_encoding(Encoding::ASCII_8BIT), limit: (options[:limit] || 1000).to_i, - offset: (options[:offset] || 0).to_i + offset: (options[:offset] || 0).to_i, + global_options: Gitaly::GlobalOptions.new(literal_pathspecs: true) ) allow_any_instance_of(Gitaly::CommitService::Stub) @@ -381,4 +385,19 @@ describe Gitlab::GitalyClient::CommitService do commits.map { |commit| Gitlab::Git::Commit.new(repository, commit) } end end + + describe '#list_commits_by_ref_name' do + let(:project) { create(:project, :repository, create_branch: 'ü/unicode/multi-byte') } + + it 'lists latest commits grouped by a ref name' do + response = client.list_commits_by_ref_name(%w[master feature v1.0.0 nonexistent ü/unicode/multi-byte]) + + expect(response.keys.count).to eq 4 + expect(response.fetch('master').id).to eq 'b83d6e391c22777fca1ed3012fce84f633d7fed0' + expect(response.fetch('feature').id).to eq '0b4bc9a49b562e85de7cc9e834518ea6828729b9' + expect(response.fetch('v1.0.0').id).to eq '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9' + expect(response.fetch('ü/unicode/multi-byte')).to be_present + expect(response).not_to have_key 'nonexistent' + end + end end |