diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2017-08-31 18:12:08 -0300 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2017-09-05 14:29:06 -0300 |
commit | c658360e94ea31a411923dbd14591c41fbecffdd (patch) | |
tree | 972700e41e7a9fc55bce9a1680567161dec3d9b5 /spec/gitlab_net_spec.rb | |
parent | 9a0f4703acb3b7304216ff5d00d1779232a8b70f (diff) | |
download | gitlab-shell-gitaly-redis-refactor.tar.gz |
Support new /internal/pre-receive API endpoint for post-receivegitaly-redis-refactor
Diffstat (limited to 'spec/gitlab_net_spec.rb')
-rw-r--r-- | spec/gitlab_net_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/gitlab_net_spec.rb b/spec/gitlab_net_spec.rb index cbcef90..c22540b 100644 --- a/spec/gitlab_net_spec.rb +++ b/spec/gitlab_net_spec.rb @@ -126,6 +126,32 @@ describe GitlabNet, vcr: true do end end + describe :pre_receive do + let(:gl_repository) { "project-1" } + let(:params) { { gl_repository: gl_repository } } + + subject { gitlab_net.pre_receive(gl_repository) } + + it 'sends the correct parameters and returns the request body parsed' do + Net::HTTP::Post.any_instance.should_receive(:set_form_data) + .with(hash_including(params)) + + VCR.use_cassette("pre-receive") { subject } + end + + it 'calls /internal/pre-receive' do + VCR.use_cassette("pre-receive") do + expect(subject['reference_counter_increased']).to be(true) + end + end + + it 'throws a NotFound error when pre-receive is not available' do + VCR.use_cassette("pre-receive-not-found") do + expect { subject }.to raise_error(GitlabNet::NotFound) + end + end + end + describe :post_receive do let(:gl_repository) { "project-1" } let(:changes) { "123456 789012 refs/heads/test\n654321 210987 refs/tags/tag" } |