Rename `Todo#to_reference` to `Todo#target_reference`

Since we're not actually returning a todo reference.
parent 05975e96
...@@ -16,7 +16,7 @@ module TodosHelper ...@@ -16,7 +16,7 @@ module TodosHelper
def todo_target_link(todo) def todo_target_link(todo)
target = todo.target_type.titleize.downcase target = todo.target_type.titleize.downcase
link_to "#{target} #{todo.to_reference}", todo_target_path(todo), { title: h(todo.target.title) } link_to "#{target} #{todo.target_reference}", todo_target_path(todo), { title: todo.target.title }
end end
def todo_target_path(todo) def todo_target_path(todo)
......
...@@ -71,7 +71,7 @@ class Todo < ActiveRecord::Base ...@@ -71,7 +71,7 @@ class Todo < ActiveRecord::Base
nil nil
end end
def to_reference def target_reference
if for_commit? if for_commit?
target.short_id target.short_id
else else
......
...@@ -115,18 +115,18 @@ describe Todo, models: true do ...@@ -115,18 +115,18 @@ describe Todo, models: true do
end end
end end
describe '#to_reference' do describe '#target_reference' do
it 'returns the short commit id for commits' do it 'returns the short commit id for commits' do
subject.project = project 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.short_id expect(subject.target_reference).to eq commit.short_id
end end
it 'returns reference for issuables' do it 'returns reference for issuables' do
subject.target = issue subject.target = issue
expect(subject.to_reference).to eq issue.to_reference expect(subject.target_reference).to eq issue.to_reference
end end
end end
end end
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