summaryrefslogtreecommitdiff
path: root/spec/workers/post_receive_spec.rb
diff options
context:
space:
mode:
authorAriejan de Vroom <ariejan@ariejan.net>2011-12-14 17:38:52 +0100
committerAriejan de Vroom <ariejan@ariejan.net>2011-12-14 17:38:52 +0100
commitedab46e9fa5f568b1423c0021e81d30453d7dc1e (patch)
tree8efba8b082a534e1a069f4566d55d6117951e6ba /spec/workers/post_receive_spec.rb
parent56fc53e8d870b70ca66332daeb6da39ab0eb5ce7 (diff)
downloadgitlab-ce-edab46e9fa5f568b1423c0021e81d30453d7dc1e.tar.gz
Added web hooks functionality
This commit includes: * Projects can have zero or more WebHooks. * The PostReceive job will ask a project to execute any web hooks defined for that project. * WebHook has a URL, we post Github-compatible JSON to that URL. * Failure to execute a WebHook will be silently ignored.
Diffstat (limited to 'spec/workers/post_receive_spec.rb')
-rw-r--r--spec/workers/post_receive_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb
new file mode 100644
index 00000000000..500a69982c7
--- /dev/null
+++ b/spec/workers/post_receive_spec.rb
@@ -0,0 +1,26 @@
+require 'spec_helper'
+
+describe PostReceive do
+
+ context "as a resque worker" do
+ it "reponds to #perform" do
+ PostReceive.should respond_to(:perform)
+ end
+ end
+
+ context "web hooks" do
+ let(:project) { Factory :project }
+
+ it "it retrieves the correct project" do
+ Project.should_receive(:find_by_path).with(project.path)
+ PostReceive.perform(project.path, 'sha-old', 'sha-new', 'refs/heads/master')
+ end
+
+ it "asks the project to execute web hooks" do
+ Project.stub(find_by_path: project)
+ project.should_receive(:execute_web_hooks).with('sha-old', 'sha-new', 'refs/heads/master')
+
+ PostReceive.perform(project.path, 'sha-old', 'sha-new', 'refs/heads/master')
+ end
+ end
+end