diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2017-07-03 11:00:18 -0400 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2017-07-03 11:00:18 -0400 |
commit | c6ed2b058b5ab5fb435114491889676732aefcb2 (patch) | |
tree | 4cf184d4559cf0d7b10e8937c9fd93ee825de562 /spec/gitlab_net_spec.rb | |
parent | 4539a066ecd2c5a16cab66f9e85f8f0ab747fc5f (diff) | |
download | gitlab-shell-revert-gl-repository.tar.gz |
Revert "Merge branch '86-follow-up-from-use-gl_repository-if-present-when-enqueing-sidekiq-postreceive-jobs' into 'master'"revert-gl-repository
This reverts commit fa6343515ba65423e9de4c98c6005facc6059938, reversing
changes made to 62af7f6af72728cecb98c5275d8b7aeb3953e564.
Diffstat (limited to 'spec/gitlab_net_spec.rb')
-rw-r--r-- | spec/gitlab_net_spec.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/spec/gitlab_net_spec.rb b/spec/gitlab_net_spec.rb index eb2dd12..f3c67fd 100644 --- a/spec/gitlab_net_spec.rb +++ b/spec/gitlab_net_spec.rb @@ -97,13 +97,20 @@ describe GitlabNet, vcr: true do describe :merge_request_urls do let(:gl_repository) { "project-1" } + let(:repo_path) { "/path/to/my/repo.git" } let(:changes) { "123456 789012 refs/heads/test\n654321 210987 refs/tags/tag" } let(:encoded_changes) { "123456%20789012%20refs/heads/test%0A654321%20210987%20refs/tags/tag" } it "sends the given arguments as encoded URL parameters" do - gitlab_net.should_receive(:get).with("#{host}/merge_request_urls?gl_repository=#{gl_repository}&changes=#{encoded_changes}") + gitlab_net.should_receive(:get).with("#{host}/merge_request_urls?project=#{repo_path}&changes=#{encoded_changes}&gl_repository=#{gl_repository}") - gitlab_net.merge_request_urls(gl_repository, changes) + gitlab_net.merge_request_urls(gl_repository, repo_path, changes) + end + + it "omits the gl_repository parameter if it's nil" do + gitlab_net.should_receive(:get).with("#{host}/merge_request_urls?project=#{repo_path}&changes=#{encoded_changes}") + + gitlab_net.merge_request_urls(nil, repo_path, changes) end end @@ -158,20 +165,21 @@ describe GitlabNet, vcr: true do describe '#notify_post_receive' do let(:gl_repository) { 'project-1' } + let(:repo_path) { '/path/to/my/repo.git' } let(:params) do - { gl_repository: gl_repository } + { gl_repository: gl_repository, project: repo_path } end it 'sets the arguments as form parameters' do VCR.use_cassette('notify-post-receive') do Net::HTTP::Post.any_instance.should_receive(:set_form_data).with(hash_including(params)) - gitlab_net.notify_post_receive(gl_repository) + gitlab_net.notify_post_receive(gl_repository, repo_path) end end it 'returns true if notification was succesful' do VCR.use_cassette('notify-post-receive') do - expect(gitlab_net.notify_post_receive(gl_repository)).to be_true + expect(gitlab_net.notify_post_receive(gl_repository, repo_path)).to be_true end end end |