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
c11d3c57
Commit
c11d3c57
authored
Apr 23, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove param from CommitRange#to_s
parent
81a21e57
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
22 deletions
+6
-22
app/models/commit_range.rb
app/models/commit_range.rb
+2
-6
spec/models/commit_range_spec.rb
spec/models/commit_range_spec.rb
+4
-16
No files found.
app/models/commit_range.rb
View file @
c11d3c57
...
@@ -67,12 +67,8 @@ class CommitRange
...
@@ -67,12 +67,8 @@ class CommitRange
end
end
end
end
def
to_s
(
short:
true
)
def
to_s
if
short
"
#{
sha_from
[
0
..
7
]
}#{
notation
}#{
sha_to
[
0
..
7
]
}
"
"
#{
sha_from
[
0
..
7
]
}#{
notation
}#{
sha_to
[
0
..
7
]
}
"
else
"
#{
sha_from
}#{
notation
}#{
sha_to
}
"
end
end
end
# Returns a String for use in a link's title attribute
# Returns a String for use in a link's title attribute
...
...
spec/models/commit_range_spec.rb
View file @
c11d3c57
...
@@ -39,24 +39,12 @@ describe CommitRange do
...
@@ -39,24 +39,12 @@ describe CommitRange do
end
end
describe
'#to_s'
do
describe
'#to_s'
do
context
'with short IDs'
do
it
'is correct for three-dot syntax'
do
it
'is correct for three-dot syntax'
do
expect
(
range
.
to_s
).
to
eq
"
#{
sha_from
[
0
..
7
]
}
...
#{
sha_to
[
0
..
7
]
}
"
expect
(
range
.
to_s
).
to
eq
"
#{
sha_from
[
0
..
7
]
}
...
#{
sha_to
[
0
..
7
]
}
"
end
it
'is correct for two-dot syntax'
do
expect
(
range2
.
to_s
).
to
eq
"
#{
sha_from
[
0
..
7
]
}
..
#{
sha_to
[
0
..
7
]
}
"
end
end
end
context
'with full IDs'
do
it
'is correct for two-dot syntax'
do
it
'is correct for three-dot syntax'
do
expect
(
range2
.
to_s
).
to
eq
"
#{
sha_from
[
0
..
7
]
}
..
#{
sha_to
[
0
..
7
]
}
"
expect
(
range
.
to_s
(
short:
false
)).
to
eq
"
#{
sha_from
}
...
#{
sha_to
}
"
end
it
'is correct for two-dot syntax'
do
expect
(
range2
.
to_s
(
short:
false
)).
to
eq
"
#{
sha_from
}
..
#{
sha_to
}
"
end
end
end
end
end
...
...
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