diff options
author | Stan Hu <stanhu@gmail.com> | 2019-02-15 05:58:23 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-02-15 05:58:23 -0800 |
commit | 886f00bcba23d67e2c86591c2eb5359ef457a2f9 (patch) | |
tree | 0ee446afb776d14433abd83b8e366517a976d867 /spec/models/merge_request_spec.rb | |
parent | d9328cb3e3c4e71b02e2a1ceb304997ddebd6fdd (diff) | |
download | gitlab-ce-886f00bcba23d67e2c86591c2eb5359ef457a2f9.tar.gz |
Backport commit author changes from CE
This backports the changes made in EE to fix merge request approvers
from https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9574.
Diffstat (limited to 'spec/models/merge_request_spec.rb')
-rw-r--r-- | spec/models/merge_request_spec.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index afa87b8a62d..39ffef5f051 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -435,6 +435,7 @@ describe MergeRequest do it 'does not cache issues from external trackers' do issue = ExternalIssue.new('JIRA-123', subject.project) commit = double('commit1', safe_message: "Fixes #{issue.to_reference}") + allow(subject).to receive(:commits).and_return([commit]) expect { subject.cache_merge_request_closes_issues!(subject.author) }.not_to raise_error @@ -1023,23 +1024,23 @@ describe MergeRequest do end end - describe '#committers' do - it 'returns all the committers of every commit in the merge request' do - users = subject.commits.map(&:committer_email).uniq.map do |email| + describe '#commit_authors' do + it 'returns all the authors of every commit in the merge request' do + users = subject.commits.map(&:author_email).uniq.map do |email| create(:user, email: email) end - expect(subject.committers).to match_array(users) + expect(subject.commit_authors).to match_array(users) end - it 'returns an empty array if no committer is associated with a user' do - expect(subject.committers).to be_empty + it 'returns an empty array if no author is associated with a user' do + expect(subject.commit_authors).to be_empty end end describe '#authors' do - it 'returns a list with all the committers in the merge request and author' do - users = subject.commits.map(&:committer_email).uniq.map do |email| + it 'returns a list with all the commit authors in the merge request and author' do + users = subject.commits.map(&:author_email).uniq.map do |email| create(:user, email: email) end |