diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-03-16 03:32:46 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-03-16 03:32:46 +0400 |
commit | e2b39517003bb2045f63c2653471275cbbbc1c10 (patch) | |
tree | 7ec02e206c79b9f1203bbbdbf8778c0e61f92770 /spec | |
parent | 7f76d6cfee7f95e6d89691431540e8d948ca60ec (diff) |
Some test covering merge request update hook
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/project_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index cb28a7eca38..1f8133e7ff7 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -160,6 +160,34 @@ describe Project do end end end + + describe :update_merge_requests do + let(:project) { Factory :project } + + before do + @merge_request = Factory :merge_request, + :project => project, + :merged => false, + :closed => false + @key = Factory :key, :user_id => project.owner.id + end + + it "should close merge request if last commit from source branch was pushed to target branch" do + @merge_request.reloaded_commits + @merge_request.last_commit.id.should == "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a" + project.update_merge_requests("8716fc78f3c65bbf7bcf7b574febd583bc5d2812", "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a", "refs/heads/stable", @key.identifier) + @merge_request.reload + @merge_request.merged.should be_true + @merge_request.closed.should be_true + end + + it "should update merge request commits with new one if pushed to source branch" do + @merge_request.last_commit.should == nil + project.update_merge_requests("8716fc78f3c65bbf7bcf7b574febd583bc5d2812", "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a", "refs/heads/master", @key.identifier) + @merge_request.reload + @merge_request.last_commit.id.should == "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a" + end + end end # == Schema Information # |