diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2018-03-06 16:08:11 +0100 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2018-03-06 16:08:11 +0100 |
commit | 4ff8db0d2e8371dfdae2ddef8a8595c1ef80c3d4 (patch) | |
tree | 3ff849c51603151baaf85ee0436d9c2f3e47915d /spec/workers/plugin_worker_spec.rb | |
parent | 60f5250893626620920d2f108df3b3e98d974f0e (diff) | |
parent | 5e8138aa54492dd3ace42d889ba01f82e8e19c83 (diff) | |
download | gitlab-ce-5029-support-cluster-metrics-ce.tar.gz |
Merge remote-tracking branch 'upstream/master' into 5029-support-cluster-metrics-ce5029-support-cluster-metrics-ce
# Conflicts:
# spec/models/clusters/applications/prometheus_spec.rb
Diffstat (limited to 'spec/workers/plugin_worker_spec.rb')
-rw-r--r-- | spec/workers/plugin_worker_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/workers/plugin_worker_spec.rb b/spec/workers/plugin_worker_spec.rb new file mode 100644 index 00000000000..9238a8199bc --- /dev/null +++ b/spec/workers/plugin_worker_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe PluginWorker do + include RepoHelpers + + 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 + allow(Gitlab::Plugin).to receive(:execute).with(filename, data).and_return([true, '']) + + expect(subject.perform(filename, data)).to be_truthy + end + + 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 +end |