diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2018-08-20 14:45:31 +1000 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2018-09-08 00:52:57 +1000 |
commit | 6fd4f6804125c0992296d064f3c074d39efeb091 (patch) | |
tree | cfdaf9a1f6ea83fb249a712c0f9704d6397ffb64 /spec/gitlab_shell_spec.rb | |
parent | 1ff3561895f361b79f46a059880ea122e3500d08 (diff) | |
download | gitlab-shell-ash.mckenzie/custom-action-support.tar.gz |
Custom Action supportash.mckenzie/custom-action-support
Diffstat (limited to 'spec/gitlab_shell_spec.rb')
-rw-r--r-- | spec/gitlab_shell_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/gitlab_shell_spec.rb b/spec/gitlab_shell_spec.rb index 24fe151..77fb6cd 100644 --- a/spec/gitlab_shell_spec.rb +++ b/spec/gitlab_shell_spec.rb @@ -256,6 +256,29 @@ describe GitlabShell do user_string = "user with id #{gl_id}" expect($logger).to receive(:info).with(message, command: "gitaly-receive-pack unix:gitaly.socket #{gitaly_message}", user: user_string) end + + context 'with a custom action' do + let(:fake_payload) { { 'api_endpoints' => [ '/fake/api/endpoint' ], 'data' => {} } } + let(:custom_action_gitlab_access_status) do + GitAccessStatus.new( + true, + HTTPCodes::HTTP_MULTIPLE_CHOICES, + 'Multiple Choices', + payload: fake_payload + ) + end + let(:action_custom) { double(Action::Custom) } + + before do + allow(api).to receive(:check_access).and_return(custom_action_gitlab_access_status) + end + + it "should not process the command" do + expect(subject).to_not receive(:process_cmd).with(%w(git-receive-pack gitlab-ci.git)) + expect(Action::Custom).to receive(:new).with(gl_id, fake_payload).and_return(action_custom) + expect(action_custom).to receive(:execute) + end + end end context 'gitaly-receive-pack' do |