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
77f06178
Commit
77f06178
authored
Jan 19, 2018
by
Micaël Bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove a path building method only used in the specs
parent
5df8efac
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
51 deletions
+2
-51
app/uploaders/file_uploader.rb
app/uploaders/file_uploader.rb
+0
-10
spec/ee/spec/services/ee/projects/hashed_storage/migrate_attachments_service_spec.rb
...ojects/hashed_storage/migrate_attachments_service_spec.rb
+1
-1
spec/models/upload_spec.rb
spec/models/upload_spec.rb
+0
-39
spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb
...ojects/hashed_storage/migrate_attachments_service_spec.rb
+1
-1
No files found.
app/uploaders/file_uploader.rb
View file @
77f06178
...
...
@@ -56,16 +56,6 @@ class FileUploader < GitlabUploader
end
end
# Auxiliary method to build dynamic path segment when not using a project model
#
# Prefer to use the `.model_path_segment` as it includes Hashed Storage specific logic
#
# TODO: review this path?
# TODO: remove me this makes no sense
def
self
.
dynamic_path_builder
(
path
)
File
.
join
(
root
,
path
)
end
def
self
.
upload_path
(
secret
,
identifier
)
File
.
join
(
secret
,
identifier
)
end
...
...
spec/ee/spec/services/ee/projects/hashed_storage/migrate_attachments_service_spec.rb
View file @
77f06178
...
...
@@ -15,7 +15,7 @@ describe Projects::HashedStorage::MigrateAttachmentsService do
context
'on success'
do
before
do
TestEnv
.
clean_test_path
FileUtils
.
mkdir_p
(
File
Uploader
.
dynamic_path_builder
(
old_attachments_path
))
FileUtils
.
mkdir_p
(
File
.
join
(
FileUploader
.
root
,
old_attachments_path
))
end
it
'returns true'
do
...
...
spec/models/upload_spec.rb
View file @
77f06178
...
...
@@ -45,45 +45,6 @@ describe Upload do
end
end
describe
'.remove_path'
do
it
'removes all records at the given path'
do
described_class
.
create!
(
size:
File
.
size
(
__FILE__
),
path:
__FILE__
,
model:
build_stubbed
(
:user
),
uploader:
'AvatarUploader'
)
expect
{
described_class
.
remove_path
(
__FILE__
)
}
.
to
change
{
described_class
.
count
}.
from
(
1
).
to
(
0
)
end
end
describe
'.record'
do
let
(
:fake_uploader
)
do
double
(
file:
double
(
size:
12_345
),
upload_path:
'foo/bar.jpg'
,
model:
build_stubbed
(
:user
),
class:
'AvatarUploader'
,
upload:
nil
)
end
it
'creates a new record and assigns size, path, model, and uploader'
do
upload
=
described_class
.
record
(
fake_uploader
)
aggregate_failures
do
expect
(
upload
).
to
be_persisted
expect
(
upload
.
size
).
to
eq
fake_uploader
.
file
.
size
expect
(
upload
.
path
).
to
eq
fake_uploader
.
upload_path
expect
(
upload
.
model_id
).
to
eq
fake_uploader
.
model
.
id
expect
(
upload
.
model_type
).
to
eq
fake_uploader
.
model
.
class
.
to_s
expect
(
upload
.
uploader
).
to
eq
fake_uploader
.
class
end
end
end
describe
'#absolute_path'
do
it
'returns the path directly when already absolute'
do
path
=
'/path/to/namespace/project/secret/file.jpg'
...
...
spec/services/projects/hashed_storage/migrate_attachments_service_spec.rb
View file @
77f06178
...
...
@@ -58,6 +58,6 @@ describe Projects::HashedStorage::MigrateAttachmentsService do
end
def
base_path
(
storage
)
File
Uploader
.
dynamic_path_builder
(
storage
.
disk_path
)
File
.
join
(
FileUploader
.
root
,
storage
.
disk_path
)
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