summaryrefslogtreecommitdiff
path: root/spec/workers/plugin_worker_spec.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-02-28 12:16:23 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-02-28 12:16:23 +0200
commit2577ff7fd656f301c4b1909f0a1c358c8c30a614 (patch)
treea7c04e89e47df5610fdd189597c58d48f9075e76 /spec/workers/plugin_worker_spec.rb
parent4eed9a12216296709306ce29faf607d8aed2a913 (diff)
downloadgitlab-ce-2577ff7fd656f301c4b1909f0a1c358c8c30a614.tar.gz
Refactor plugins feature and make some doc improvements
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec/workers/plugin_worker_spec.rb')
-rw-r--r--spec/workers/plugin_worker_spec.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/spec/workers/plugin_worker_spec.rb b/spec/workers/plugin_worker_spec.rb
index 60631def8f3..9238a8199bc 100644
--- a/spec/workers/plugin_worker_spec.rb
+++ b/spec/workers/plugin_worker_spec.rb
@@ -3,16 +3,22 @@ require 'spec_helper'
describe PluginWorker do
include RepoHelpers
- subject { described_class.new }
-
let(:filename) { 'my_plugin.rb' }
+ let(:data) { { 'event_name' => 'project_create' } }
+
+ subject { described_class.new }
describe '#perform' do
it 'executes Gitlab::Plugin with expected values' do
- data = { 'event_name' => 'project_create' }
+ allow(Gitlab::Plugin).to receive(:execute).with(filename, data).and_return([true, ''])
+
+ expect(subject.perform(filename, data)).to be_truthy
+ end
- allow(Gitlab::Plugin).to receive(:execute).with(filename, data).and_return(true)
+ it 'logs message in case of plugin execution failure' do
+ allow(Gitlab::Plugin).to receive(:execute).with(filename, data).and_return([false, 'permission denied'])
+ expect(Gitlab::PluginLogger).to receive(:error)
expect(subject.perform(filename, data)).to be_truthy
end
end