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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
afbaeb8c
Commit
afbaeb8c
authored
Apr 06, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary class method Upload.exist?
parent
04147857
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
16 deletions
+2
-16
app/models/upload.rb
app/models/upload.rb
+2
-6
spec/models/upload_spec.rb
spec/models/upload_spec.rb
+0
-10
No files found.
app/models/upload.rb
View file @
afbaeb8c
...
...
@@ -28,15 +28,11 @@ class Upload < ActiveRecord::Base
end
def
self
.
hexdigest
(
absolute_path
)
return
unless
exist?
(
absolute_path
)
return
unless
File
.
exist?
(
absolute_path
)
Digest
::
SHA256
.
file
(
absolute_path
).
hexdigest
end
def
self
.
exist?
(
absolute_path
)
File
.
exist?
(
absolute_path
)
end
def
absolute_path
return
path
unless
relative_path?
...
...
@@ -50,7 +46,7 @@ class Upload < ActiveRecord::Base
end
def
exist?
self
.
class
.
exist?
(
absolute_path
)
File
.
exist?
(
absolute_path
)
end
private
...
...
spec/models/upload_spec.rb
View file @
afbaeb8c
...
...
@@ -102,16 +102,6 @@ describe Upload, type: :model do
end
end
describe
'.exist?'
do
it
'returns true when the file exists'
do
expect
(
described_class
.
exist?
(
__FILE__
)).
to
eq
true
end
it
'returns false when the file does not exist'
do
expect
(
described_class
.
exist?
(
"
#{
__FILE__
}
-nope"
)).
to
eq
false
end
end
describe
'#absolute_path'
do
it
'returns the path directly when already absolute'
do
path
=
'/path/to/namespace/project/secret/file.jpg'
...
...
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