Commit 44402592 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 857cd46a b224efe7
......@@ -1345,7 +1345,7 @@ class MergeRequest < ApplicationRecord
end
def has_commits?
merge_request_diff && commits_count > 0
merge_request_diff && commits_count.to_i > 0
end
def has_no_commits?
......
......@@ -2713,14 +2713,21 @@ describe MergeRequest do
end
describe '#has_commits?' do
before do
it 'returns true when merge request diff has commits' do
allow(subject.merge_request_diff).to receive(:commits_count)
.and_return(2)
end
it 'returns true when merge request diff has commits' do
expect(subject.has_commits?).to be_truthy
end
context 'when commits_count is nil' do
it 'returns false' do
allow(subject.merge_request_diff).to receive(:commits_count)
.and_return(nil)
expect(subject.has_commits?).to be_falsey
end
end
end
describe '#has_no_commits?' 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