diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2017-10-10 15:15:21 +0300 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2017-10-13 15:07:31 +0300 |
commit | 0aff29f96b54e8036fe46315adb45295bc6c9efd (patch) | |
tree | 23110ac96a9d0d8455aed256d5bdb05174af5919 /spec/models/repository_spec.rb | |
parent | c08fea6fd3b69c5efad14cf39783ef71a7006fad (diff) |
Merge Merge Requests via Gitaly
Diffstat (limited to 'spec/models/repository_spec.rb')
-rw-r--r-- | spec/models/repository_spec.rb | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index f44693a71bb..39d188f18af 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -1286,21 +1286,31 @@ describe Repository do let(:message) { 'Test \r\n\r\n message' } - it 'merges the code and returns the commit id' do - expect(merge_commit).to be_present - expect(repository.blob_at(merge_commit.id, 'files/ruby/feature.rb')).to be_present - end + shared_examples '#merge' do + it 'merges the code and returns the commit id' do + expect(merge_commit).to be_present + expect(repository.blob_at(merge_commit.id, 'files/ruby/feature.rb')).to be_present + end - it 'sets the `in_progress_merge_commit_sha` flag for the given merge request' do - merge_commit_id = merge(repository, user, merge_request, message) + it 'sets the `in_progress_merge_commit_sha` flag for the given merge request' do + merge_commit_id = merge(repository, user, merge_request, message) - expect(merge_request.in_progress_merge_commit_sha).to eq(merge_commit_id) + expect(merge_request.in_progress_merge_commit_sha).to eq(merge_commit_id) + end + + it 'removes carriage returns from commit message' do + merge_commit_id = merge(repository, user, merge_request, message) + + expect(repository.commit(merge_commit_id).message).to eq(message.delete("\r")) + end end - it 'removes carriage returns from commit message' do - merge_commit_id = merge(repository, user, merge_request, message) + context 'with gitaly' do + it_behaves_like '#merge' + end - expect(repository.commit(merge_commit_id).message).to eq(message.delete("\r")) + context 'without gitaly', :skip_gitaly_mock do + it_behaves_like '#merge' end def merge(repository, user, merge_request, message) |