diff options
author | Ariejan de Vroom <ariejan@ariejan.net> | 2011-12-15 10:33:20 +0100 |
---|---|---|
committer | Ariejan de Vroom <ariejan@ariejan.net> | 2011-12-15 10:33:20 +0100 |
commit | 7ffb8fc616a2890cc46924b099c28709e491495e (patch) | |
tree | 3a24464884af4e139f6dea772719523dd3f83a15 /spec | |
parent | edab46e9fa5f568b1423c0021e81d30453d7dc1e (diff) | |
download | gitlab-ce-7ffb8fc616a2890cc46924b099c28709e491495e.tar.gz |
Added specs for special cases
We don't execute web hooks when:
* You create a new branch. Make sure you first create the branch, and then push any commits. This is the way Github works, so its expected behavior.
* When tags are pushed.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/project_spec.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 0afb73f8dbf..242461d0473 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -91,10 +91,31 @@ describe Project do @webhook.should_receive(:execute).once @webhook_2.should_receive(:execute).once - project.execute_web_hooks('oldrev', 'newrev', 'ref') + project.execute_web_hooks('oldrev', 'newrev', 'refs/heads/master') end end + context "does not execute web hooks" do + before do + @webhook = Factory(:web_hook) + project.web_hooks << [@webhook] + end + + it "when pushing a branch for the first time" do + @webhook.should_not_receive(:execute) + project.execute_web_hooks('00000000000000000000000000000000', 'newrev', 'refs/heads/mster') + end + + it "when pushing tags" do + @webhook.should_not_receive(:execute) + project.execute_web_hooks('oldrev', 'newrev', 'refs/tags/v1.0.0') + end + end + + context "when pushing new branches" do + + end + context "when gathering commit data" do before do @oldrev, @newrev, @ref = project.fresh_commits(2).last.sha, project.fresh_commits(2).first.sha, 'refs/heads/master' |