summaryrefslogtreecommitdiff
path: root/spec/workers/post_receive_spec.rb
diff options
context:
space:
mode:
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