gitlabhq/spec/workers/post_receive_spec.rb
Ariejan de Vroom edab46e9fa 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.
2011-12-14 17:38:52 +01:00

27 lines
731 B
Ruby

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