BigW Consortium Gitlab

Fix mr controller specs

parent 0de6e2da
...@@ -214,8 +214,8 @@ class MergeRequest < ActiveRecord::Base ...@@ -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 ...@@ -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
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -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 ...@@ -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
......
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