summaryrefslogtreecommitdiff
path: root/spec/workers/plugin_worker_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/workers/plugin_worker_spec.rb')
-rw-r--r--spec/workers/plugin_worker_spec.rb27
1 files changed, 27 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..29c55482321
--- /dev/null
+++ b/spec/workers/plugin_worker_spec.rb
@@ -0,0 +1,27 @@
+require 'spec_helper'
+
+describe PluginWorker do
+ include RepoHelpers
+
+ subject { described_class.new }
+
+ let(:filename) { 'my_plugin.rb' }
+
+ 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
+
+ it 'handles exception well' do
+ data = { 'event_name' => 'project_create' }
+
+ allow(Gitlab::Plugin).to receive(:execute).with(filename, data).and_raise('Permission denied')
+
+ expect { subject.perform(filename, data) }.to_not raise_error
+ end
+ end
+end