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
939391af
Commit
939391af
authored
Jan 31, 2018
by
Micaël Bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improvements from feedback
parent
b176b2ca
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
app/models/upload.rb
app/models/upload.rb
+1
-1
spec/models/upload_spec.rb
spec/models/upload_spec.rb
+12
-0
spec/uploaders/file_uploader_spec.rb
spec/uploaders/file_uploader_spec.rb
+1
-1
No files found.
app/models/upload.rb
View file @
939391af
...
...
@@ -14,7 +14,7 @@ class Upload < ActiveRecord::Base
# as the FileUploader is not mounted, the default CarrierWave ActiveRecord
# hooks are not executed and the file will not be deleted
after_
commit
:delete_file!
,
on: :destroy
,
if:
->
{
uploader_class
<=
FileUploader
}
after_
destroy
:delete_file!
,
if:
->
{
uploader_class
<=
FileUploader
}
def
self
.
hexdigest
(
path
)
Digest
::
SHA256
.
file
(
path
).
hexdigest
...
...
spec/models/upload_spec.rb
View file @
939391af
...
...
@@ -43,6 +43,18 @@ describe Upload do
.
to
(
a_string_matching
(
/\A\h{64}\z/
))
end
end
describe
'after_destroy'
do
context
'uploader is FileUploader-based'
do
subject
{
create
(
:upload
,
:issuable_upload
)
}
it
'calls delete_file!'
do
is_expected
.
to
receive
(
:delete_file!
)
subject
.
destroy
end
end
end
end
describe
'#absolute_path'
do
...
...
spec/uploaders/file_uploader_spec.rb
View file @
939391af
...
...
@@ -66,7 +66,7 @@ describe FileUploader do
it
'prune the store directory'
do
expect
{
uploader
.
remove!
}
.
to
change
{
File
.
exist
s
?
(
store_dir
)
}.
from
(
true
).
to
(
false
)
.
to
change
{
File
.
exist?
(
store_dir
)
}.
from
(
true
).
to
(
false
)
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