Commit e2b39517 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Some test covering merge request update hook

parent 7f76d6cf
...@@ -160,6 +160,34 @@ describe Project do ...@@ -160,6 +160,34 @@ describe Project do
end end
end 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 end
# == Schema Information # == Schema Information
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment