From 09d5868c2286f927ce2cc23dfcc2c446723985b3 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 14 Jan 2014 10:47:28 +0200 Subject: [PATCH] Fix mr controller specs Signed-off-by: Dmitriy Zaporozhets --- app/models/merge_request.rb | 9 +++++---- spec/controllers/merge_requests_controller_spec.rb | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 39165631894..da7aebd944f 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -214,8 +214,8 @@ class MergeRequest < ActiveRecord::Base self.merge end - def automerge!(current_user, merge_commit_message = nil) - if Gitlab::Satellite::MergeAction.new(current_user, self).merge!(merge_commit_message) && self.unmerged_commits.empty? + def automerge!(current_user, commit_message = nil) + if Gitlab::Satellite::MergeAction.new(current_user, self).merge!(commit_message) && self.unmerged_commits.empty? self.merge!(current_user.id) true end @@ -322,9 +322,10 @@ class MergeRequest < ActiveRecord::Base def merge_commit_message message = "Merge branch '#{source_branch}' into '#{target_branch}'" message << "\n\n" - message << title + message << title.to_s message << "\n\n" - message << description + message << description.to_s + message end private diff --git a/spec/controllers/merge_requests_controller_spec.rb b/spec/controllers/merge_requests_controller_spec.rb index 69708edd8b1..f237f358452 100644 --- a/spec/controllers/merge_requests_controller_spec.rb +++ b/spec/controllers/merge_requests_controller_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Projects::MergeRequestsController do let(:project) { create(:project_with_code) } 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 sign_in(user) @@ -61,7 +61,7 @@ describe Projects::MergeRequestsController 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 - 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 it "should contain git diffs" do