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
Tatuya Kamada
gitlab-ce
Commits
92c681a5
Commit
92c681a5
authored
Apr 25, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove CommitRange#to_a
parent
2207e5a6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
40 deletions
+0
-40
app/models/commit_range.rb
app/models/commit_range.rb
+0
-13
spec/models/commit_range_spec.rb
spec/models/commit_range_spec.rb
+0
-27
No files found.
app/models/commit_range.rb
View file @
92c681a5
...
...
@@ -15,7 +15,6 @@
# # Assuming `project` is a Project with a repository containing both commits:
# range.project = project
# range.valid_commits? # => true
# range.to_a # => [#<Commit ...>, #<Commit ...>]
#
class
CommitRange
include
ActiveModel
::
Conversion
...
...
@@ -55,18 +54,6 @@ class CommitRange
%(#<#{self.class}:#{object_id} #{to_s}>)
end
# Returns an Array of Commit objects, where the first value is the starting
# commit, and the second value is the ending commit
#
# Returns `[nil, nil]` if `valid_commits?` is falsey
def
to_a
if
valid_commits?
[
commit_from
,
commit_to
]
else
[
nil
,
nil
]
end
end
def
to_s
"
#{
sha_from
[
0
..
7
]
}#{
notation
}#{
sha_to
[
0
..
7
]
}
"
end
...
...
spec/models/commit_range_spec.rb
View file @
92c681a5
...
...
@@ -11,33 +11,6 @@ describe CommitRange do
expect
{
described_class
.
new
(
"Foo"
)
}.
to
raise_error
end
describe
'#to_a'
do
context
'when valid'
do
let
(
:commit1
)
{
double
(
'commit1'
)
}
let
(
:commit2
)
{
double
(
'commit2'
)
}
before
do
expect
(
range
).
to
receive
(
:valid_commits?
).
and_return
(
true
)
allow
(
range
).
to
receive
(
:commit_from
).
and_return
(
commit1
)
allow
(
range
).
to
receive
(
:commit_to
).
and_return
(
commit2
)
end
it
'returns an Array of Commits'
do
expect
(
range
.
to_a
).
to
eq
[
commit1
,
commit2
]
end
end
context
'when invalid'
do
before
do
expect
(
range
).
to
receive
(
:valid_commits?
).
and_return
(
false
)
end
it
'returns [nil, nil]'
do
expect
(
range
.
to_a
).
to
eq
[
nil
,
nil
]
end
end
end
describe
'#to_s'
do
it
'is correct for three-dot syntax'
do
expect
(
range
.
to_s
).
to
eq
"
#{
sha_from
[
0
..
7
]
}
...
#{
sha_to
[
0
..
7
]
}
"
...
...
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