diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-03-18 13:24:47 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-03-18 13:24:47 -0300 |
commit | 2a8858ca8adbc54d7e24e698fa8ce370a1e91157 (patch) | |
tree | f57df67358d3c113412e9f9f910e18515f835ddf | |
parent | 05975e96f98521a219788a0bec3d6f71458833e1 (diff) | |
download | gitlab-ce-2a8858ca8adbc54d7e24e698fa8ce370a1e91157.tar.gz |
Rename `Todo#to_reference` to `Todo#target_reference`
Since we're not actually returning a todo reference.
-rw-r--r-- | app/helpers/todos_helper.rb | 2 | ||||
-rw-r--r-- | app/models/todo.rb | 2 | ||||
-rw-r--r-- | spec/models/todo_spec.rb | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index 9604a4e01b4..edc5686cf08 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -16,7 +16,7 @@ module TodosHelper def todo_target_link(todo) 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 def todo_target_path(todo) diff --git a/app/models/todo.rb b/app/models/todo.rb index b135407a8ee..ab804d712a0 100644 --- a/app/models/todo.rb +++ b/app/models/todo.rb @@ -71,7 +71,7 @@ class Todo < ActiveRecord::Base nil end - def to_reference + def target_reference if for_commit? target.short_id else diff --git a/spec/models/todo_spec.rb b/spec/models/todo_spec.rb index 0fbd36f3a22..22acfdfe2c0 100644 --- a/spec/models/todo_spec.rb +++ b/spec/models/todo_spec.rb @@ -115,18 +115,18 @@ describe Todo, models: true do end end - describe '#to_reference' do + describe '#target_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.short_id + expect(subject.target_reference).to eq commit.short_id end it 'returns reference for issuables' do subject.target = issue - expect(subject.to_reference).to eq issue.to_reference + expect(subject.target_reference).to eq issue.to_reference end end end |