diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-16 18:08:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-16 18:08:41 +0300 |
commit | d47f9d2304dbc3a23bba7fe7a5cd07218eeb41cd (patch) | |
tree | 4b4efa1ccd8246fba2dc9f8816d9d2c0268e9818 /spec/workers/file_hook_worker_spec.rb | |
parent | c158fa8d69c704663d289341a014c44c062cda88 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/file_hook_worker_spec.rb')
-rw-r--r-- | spec/workers/file_hook_worker_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/workers/file_hook_worker_spec.rb b/spec/workers/file_hook_worker_spec.rb new file mode 100644 index 00000000000..1a7e753fc4a --- /dev/null +++ b/spec/workers/file_hook_worker_spec.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe FileHookWorker do + include RepoHelpers + + let(:filename) { 'my_file_hook.rb' } + let(:data) { { 'event_name' => 'project_create' } } + + subject { described_class.new } + + describe '#perform' do + it 'executes Gitlab::FileHook with expected values' do + allow(Gitlab::FileHook).to receive(:execute).with(filename, data).and_return([true, '']) + + expect(subject.perform(filename, data)).to be_truthy + end + + it 'logs message in case of file_hook execution failure' do + allow(Gitlab::FileHook).to receive(:execute).with(filename, data).and_return([false, 'permission denied']) + + expect(Gitlab::FileHookLogger).to receive(:error) + expect(subject.perform(filename, data)).to be_truthy + end + end +end |