Use `Commit#short_id` instead of `Commit.truncate_sha`
This commit is contained in:
parent
2eeeb266e3
commit
231d4fb9f8
|
@ -73,7 +73,7 @@ class Todo < ActiveRecord::Base
|
||||||
|
|
||||||
def to_reference
|
def to_reference
|
||||||
if for_commit?
|
if for_commit?
|
||||||
Commit.truncate_sha(commit_id)
|
target.short_id
|
||||||
else
|
else
|
||||||
target.to_reference
|
target.to_reference
|
||||||
end
|
end
|
||||||
|
|
|
@ -117,9 +117,11 @@ describe Todo, models: true do
|
||||||
|
|
||||||
describe '#to_reference' do
|
describe '#to_reference' do
|
||||||
it 'returns the short commit id for commits' do
|
it 'returns the short commit id for commits' do
|
||||||
|
subject.project = project
|
||||||
subject.target_type = 'Commit'
|
subject.target_type = 'Commit'
|
||||||
subject.commit_id = commit.id
|
subject.commit_id = commit.id
|
||||||
expect(subject.to_reference).to eq Commit.truncate_sha(commit.id)
|
|
||||||
|
expect(subject.to_reference).to eq commit.short_id
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns reference for issuables' do
|
it 'returns reference for issuables' do
|
||||||
|
|
Loading…
Reference in New Issue