Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
231d4fb9
Commit
231d4fb9
authored
Mar 18, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `Commit#short_id` instead of `Commit.truncate_sha`
parent
2eeeb266
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
app/models/todo.rb
app/models/todo.rb
+1
-1
spec/models/todo_spec.rb
spec/models/todo_spec.rb
+3
-1
No files found.
app/models/todo.rb
View file @
231d4fb9
...
@@ -73,7 +73,7 @@ class Todo < ActiveRecord::Base
...
@@ -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
...
...
spec/models/todo_spec.rb
View file @
231d4fb9
...
@@ -117,9 +117,11 @@ describe Todo, models: true do
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment