| ... | @@ -476,7 +476,6 @@ describe MergeRequest do |
... | @@ -476,7 +476,6 @@ describe MergeRequest do |
|
|
it 'does not cache issues from external trackers' do
|
|
it 'does not cache issues from external trackers' do
|
|
|
issue = ExternalIssue.new('JIRA-123', subject.project)
|
|
issue = ExternalIssue.new('JIRA-123', subject.project)
|
|
|
commit = double('commit1', safe_message: "Fixes #{issue.to_reference}")
|
|
commit = double('commit1', safe_message: "Fixes #{issue.to_reference}")
|
|
|
|
|
|
|
|
allow(subject).to receive(:commits).and_return([commit])
|
|
allow(subject).to receive(:commits).and_return([commit])
|
|
|
|
|
|
|
|
expect { subject.cache_merge_request_closes_issues!(subject.author) }.not_to raise_error
|
|
expect { subject.cache_merge_request_closes_issues!(subject.author) }.not_to raise_error
|
| ... | @@ -1065,31 +1064,17 @@ describe MergeRequest do |
... | @@ -1065,31 +1064,17 @@ describe MergeRequest do |
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
describe '#commit_authors' do
|
|
describe '#committers' do
|
|
|
it 'returns all the authors of every commit in the merge request' do
|
|
it 'returns all the committers of every commit in the merge request' do
|
|
|
users = subject.commits.without_merge_commits.map(&:author_email).uniq.map do |email|
|
|
users = subject.commits.without_merge_commits.map(&:committer_email).uniq.map do |email|
|
|
|
create(:user, email: email)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expect(subject.commit_authors).to match_array(users)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
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 commit authors in the merge request and author' do
|
|
|
|
|
users = subject.commits.without_merge_commits.map(&:author_email).uniq.map do |email|
|
|
|
|
|
create(:user, email: email)
|
|
create(:user, email: email)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
expect(subject.authors).to match_array([subject.author, *users])
|
|
expect(subject.committers).to match_array(users)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
it 'returns only the author if no committer is associated with a user' do
|
|
it 'returns an empty array if no committer is associated with a user' do
|
|
|
expect(subject.authors).to contain_exactly(subject.author)
|
|
expect(subject.committers).to be_empty
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
| ... | |
... | |
| ... | | ... | |