Fix mr controller specs

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2014-01-14 10:47:28 +02:00
parent 0de6e2da38
commit 09d5868c22
No known key found for this signature in database
GPG key ID: 627C5F589F467F17
2 changed files with 7 additions and 6 deletions

View file

@ -214,8 +214,8 @@ class MergeRequest < ActiveRecord::Base
self.merge self.merge
end end
def automerge!(current_user, merge_commit_message = nil) def automerge!(current_user, commit_message = nil)
if Gitlab::Satellite::MergeAction.new(current_user, self).merge!(merge_commit_message) && self.unmerged_commits.empty? if Gitlab::Satellite::MergeAction.new(current_user, self).merge!(commit_message) && self.unmerged_commits.empty?
self.merge!(current_user.id) self.merge!(current_user.id)
true true
end end
@ -322,9 +322,10 @@ class MergeRequest < ActiveRecord::Base
def merge_commit_message def merge_commit_message
message = "Merge branch '#{source_branch}' into '#{target_branch}'" message = "Merge branch '#{source_branch}' into '#{target_branch}'"
message << "\n\n" message << "\n\n"
message << title message << title.to_s
message << "\n\n" message << "\n\n"
message << description message << description.to_s
message
end end
private private

View file

@ -3,7 +3,7 @@ require 'spec_helper'
describe Projects::MergeRequestsController do describe Projects::MergeRequestsController do
let(:project) { create(:project_with_code) } let(:project) { create(:project_with_code) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project, target_branch: "bcf03b5d~3", source_branch: "bcf03b5d") } let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project, target_branch: "stable", source_branch: "master") }
before do before do
sign_in(user) sign_in(user)
@ -61,7 +61,7 @@ describe Projects::MergeRequestsController do
it "should really be a git email patch with commit" do it "should really be a git email patch with commit" do
get :show, project_id: project.to_param, id: merge_request.iid, format: format get :show, project_id: project.to_param, id: merge_request.iid, format: format
expect(response.body[0..100]).to start_with("From #{merge_request.commits.last.id}") expect(response.body[0..100]).to start_with("From 6ea87c47f0f8a24ae031c3fff17bc913889ecd00")
end end
it "should contain git diffs" do it "should contain git diffs" do