diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-02-29 23:04:09 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-02-29 23:04:09 +0200 |
commit | 25bde28d13cdffda8efa4ecae00985085e6aa565 (patch) | |
tree | 61c676f45e05b4b2e3a7dd6b0b3196486d481f32 /spec/models | |
parent | bb164ebf1bd672527a76a6699427cbec728d638b (diff) | |
download | gitlab-ce-25bde28d13cdffda8efa4ecae00985085e6aa565.tar.gz |
Fixed tests. removed delegate to id
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/project_hooks_spec.rb | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/spec/models/project_hooks_spec.rb b/spec/models/project_hooks_spec.rb index 841c85ba803..5a03b01f80b 100644 --- a/spec/models/project_hooks_spec.rb +++ b/spec/models/project_hooks_spec.rb @@ -2,17 +2,21 @@ require 'spec_helper' describe Project, "Hooks" do let(:project) { Factory :project } + before do + @key = Factory :key, :user => project.owner + @key_id = @key.identifier + end describe "Post Receive Event" do it "should create push event" do oldrev, newrev, ref = '00000000000000000000000000000000', 'newrev', 'refs/heads/master' - project.observe_push(oldrev, newrev, ref) + project.observe_push(oldrev, newrev, ref, @key_id) event = Event.last event.should_not be_nil event.project.should == project event.action.should == Event::Pushed - event.data == project.web_hook_data(oldrev, newrev, ref) + event.data == project.web_hook_data(oldrev, newrev, ref, @key_id) end end @@ -20,7 +24,7 @@ describe Project, "Hooks" do context "with no web hooks" do it "raises no errors" do lambda { - project.execute_web_hooks('oldrev', 'newrev', 'ref') + project.execute_web_hooks('oldrev', 'newrev', 'ref', @key_id) }.should_not raise_error end end @@ -36,7 +40,7 @@ describe Project, "Hooks" do @webhook.should_receive(:execute).once @webhook_2.should_receive(:execute).once - project.execute_web_hooks('oldrev', 'newrev', 'refs/heads/master') + project.execute_web_hooks('oldrev', 'newrev', 'refs/heads/master', @key_id) end end @@ -48,12 +52,12 @@ describe Project, "Hooks" do it "when pushing a branch for the first time" do @webhook.should_not_receive(:execute) - project.execute_web_hooks('00000000000000000000000000000000', 'newrev', 'refs/heads/master') + project.execute_web_hooks('00000000000000000000000000000000', 'newrev', 'refs/heads/master', @key_id) end it "when pushing tags" do @webhook.should_not_receive(:execute) - project.execute_web_hooks('oldrev', 'newrev', 'refs/tags/v1.0.0') + project.execute_web_hooks('oldrev', 'newrev', 'refs/tags/v1.0.0', @key_id) end end @@ -69,7 +73,7 @@ describe Project, "Hooks" do # Fill nil/empty attributes project.description = "This is a description" - @data = project.web_hook_data(@oldrev, @newrev, @ref) + @data = project.web_hook_data(@oldrev, @newrev, @ref, @key_id) end subject { @data } @@ -77,6 +81,8 @@ describe Project, "Hooks" do it { should include(before: @oldrev) } it { should include(after: @newrev) } it { should include(ref: @ref) } + it { should include(user_id: project.owner.id) } + it { should include(user_name: project.owner.name) } context "with repository data" do subject { @data[:repository] } |