summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/gitaly_client
diff options
context:
space:
mode:
authorAlejandro Rodríguez <alejorro70@gmail.com>2017-02-15 23:08:30 -0300
committerJacob Vosmaer <jacob@gitlab.com>2017-04-04 16:53:44 +0200
commit267cd3e3594dcb1555b5018723f3cc620873499d (patch)
tree323bdac4cd84427ed64b9d2a0065eff9e762c340 /spec/lib/gitlab/gitaly_client
parent3301f4a22b685975d664ea8abdd7c43b3e929e5a (diff)
downloadgitlab-ce-267cd3e3594dcb1555b5018723f3cc620873499d.tar.gz
Incorporate Gitaly client for refs service
Diffstat (limited to 'spec/lib/gitlab/gitaly_client')
-rw-r--r--spec/lib/gitlab/gitaly_client/notifications_spec.rb9
-rw-r--r--spec/lib/gitlab/gitaly_client/ref_spec.rb41
2 files changed, 47 insertions, 3 deletions
diff --git a/spec/lib/gitlab/gitaly_client/notifications_spec.rb b/spec/lib/gitlab/gitaly_client/notifications_spec.rb
index bb5d93994ad..39c2048fef8 100644
--- a/spec/lib/gitlab/gitaly_client/notifications_spec.rb
+++ b/spec/lib/gitlab/gitaly_client/notifications_spec.rb
@@ -2,12 +2,15 @@ require 'spec_helper'
describe Gitlab::GitalyClient::Notifications do
describe '#post_receive' do
+ let(:project) { create(:empty_project) }
+ let(:repo_path) { project.repository.path_to_repo }
+ subject { described_class.new(project.repository_storage, project.full_path + '.git') }
+
it 'sends a post_receive message' do
- repo_path = create(:empty_project).repository.path_to_repo
expect_any_instance_of(Gitaly::Notifications::Stub).
- to receive(:post_receive).with(post_receive_request_with_repo_path(repo_path))
+ to receive(:post_receive).with(gitaly_request_with_repo_path(repo_path))
- described_class.new(repo_path).post_receive
+ subject.post_receive
end
end
end
diff --git a/spec/lib/gitlab/gitaly_client/ref_spec.rb b/spec/lib/gitlab/gitaly_client/ref_spec.rb
new file mode 100644
index 00000000000..79c9ca993e4
--- /dev/null
+++ b/spec/lib/gitlab/gitaly_client/ref_spec.rb
@@ -0,0 +1,41 @@
+require 'spec_helper'
+
+describe Gitlab::GitalyClient::Ref do
+ let(:project) { create(:empty_project) }
+ let(:repo_path) { project.repository.path_to_repo }
+ let(:client) { Gitlab::GitalyClient::Ref.new(project.repository_storage, project.full_path + '.git') }
+
+ before do
+ allow(Gitlab.config.gitaly).to receive(:enabled).and_return(true)
+ end
+
+ describe '#branch_names' do
+ it 'sends a find_all_branch_names message' do
+ expect_any_instance_of(Gitaly::Ref::Stub).
+ to receive(:find_all_branch_names).with(gitaly_request_with_repo_path(repo_path)).
+ and_return([])
+
+ client.branch_names
+ end
+ end
+
+ describe '#tag_names' do
+ it 'sends a find_all_tag_names message' do
+ expect_any_instance_of(Gitaly::Ref::Stub).
+ to receive(:find_all_tag_names).with(gitaly_request_with_repo_path(repo_path)).
+ and_return([])
+
+ client.tag_names
+ end
+ end
+
+ describe '#default_branch_name' do
+ it 'sends a find_default_branch_name message' do
+ expect_any_instance_of(Gitaly::Ref::Stub).
+ to receive(:find_default_branch_name).with(gitaly_request_with_repo_path(repo_path)).
+ and_return(double(name: 'foo'))
+
+ client.default_branch_name
+ end
+ end
+end