Use `Commit#short_id` instead of `Commit.truncate_sha`

This commit is contained in:
Douglas Barbosa Alexandre 2016-03-18 10:32:22 -03:00
parent 2eeeb266e3
commit 231d4fb9f8
2 changed files with 4 additions and 2 deletions

View File

@ -73,7 +73,7 @@ class Todo < ActiveRecord::Base
def to_reference
if for_commit?
Commit.truncate_sha(commit_id)
target.short_id
else
target.to_reference
end

View File

@ -117,9 +117,11 @@ describe Todo, models: true do
describe '#to_reference' do
it 'returns the short commit id for commits' do
subject.project = project
subject.target_type = 'Commit'
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
it 'returns reference for issuables' do